-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
427 additions
and
431 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,37 @@ | ||
#include <windows.h> | ||
#include <string> | ||
using std::wstring; | ||
|
||
// Tried to use wmain, but GCC/MinGW doesn't define it cause it's MS specific | ||
// So, I'm sticking to the Windows API for now | ||
|
||
int main() { | ||
// Fill an argv array and argc similar to the standard ones | ||
int argc; | ||
wchar_t** argv = CommandLineToArgvW(GetCommandLineW(),&argc); | ||
int ArgumentCount = 0; | ||
wchar_t** ArgumentInput = CommandLineToArgvW(GetCommandLineW(),&ArgumentCount); | ||
|
||
// Then build our selection to pass to devcpp.exe | ||
wchar_t argtodev[400] = L"-c .\\config "; | ||
for(unsigned int i = 1;i < argc;i++) { | ||
wcscat(argtodev,&argv[i][0]); | ||
wstring ArgumentsToDev = L"-c .\\config "; | ||
for(int i = 1;i < ArgumentCount;i++) { | ||
ArgumentsToDev.append(ArgumentInput[i]); | ||
} | ||
|
||
HINSTANCE returnvalue = ShellExecuteW(NULL,L"open",L"devcpp.exe",argtodev,NULL,SW_SHOWNORMAL); | ||
if((int)returnvalue <= 32) { | ||
if(GetLastError()==ERROR_FILE_NOT_FOUND) { | ||
MessageBoxW(NULL,L"devcpp.exe",L"File not found",MB_OK); | ||
} else { | ||
MessageBoxW(NULL,L"no worky!",L"Error",MB_OK); | ||
// Free the strings pointed to by argv | ||
LocalFree(ArgumentInput); | ||
|
||
// Attempt to execute | ||
int Result = (INT_PTR)ShellExecuteW(NULL,L"open",L"devcpp.exe",ArgumentsToDev.c_str(),NULL,SW_SHOWNORMAL); | ||
if(Result <= 32) { | ||
switch(Result) { | ||
case ERROR_FILE_NOT_FOUND: { | ||
MessageBoxW(NULL,L"devcpp.exe",L"File not found",MB_OK); | ||
break; | ||
} | ||
default: { | ||
MessageBoxW(NULL,L"An unspecified error has occured!",L"Error",MB_OK); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
// Free the strings pointed to by argv | ||
LocalFree(argv); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.