
Untitled
By: a guest on Nov 26th, 2010 | syntax:
C++ | size: 1.40 KB | hits: 416 | expires: Never
// Phoenix.cpp
// used to direct all shortcuts and existing bat files to the new
// phoenixviewer.exe
/* This program is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public License, Version 2, as published by Sam Hocevar. See
* http://sam.zoy.org/wtfpl/COPYING for more details. */
#include "stdafx.h"
#include <windows.h>
#include <string>
#include <iostream>
int _tmain(int argc, wchar_t* argv[])
{
std::wstring Parameters=L" ";
for(int i = 0; i < argc; i++)
{
std::wcout << "argv[" << i << "] = " << argv[i] << std::endl;
if(i==0)Parameters.append(L" ");
else Parameters.append(argv[i]);
}
PROCESS_INFORMATION processInformation;
STARTUPINFO startupInfo;
memset(&processInformation, 0, sizeof(processInformation));
memset(&startupInfo, 0, sizeof(startupInfo));
startupInfo.cb = sizeof(startupInfo);
BOOL result=FALSE;
const wchar_t* pchrTemp = Parameters.c_str();
wchar_t * pwszParam = new wchar_t[Parameters.size() + 1];
wcscpy_s(pwszParam, Parameters.size() + 1, pchrTemp);
std::wcout << "DONE is " << Parameters.c_str() << std::endl;
result = ::CreateProcess(L"PhoenixViewer.exe",pwszParam, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &startupInfo, &processInformation);
return result;
}