2005-04-17 17:11:15 +04:00
|
|
|
//+---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include <windows.h>
|
2013-02-04 19:12:17 +04:00
|
|
|
#include <stdlib.h>
|
2005-04-17 17:11:15 +04:00
|
|
|
|
|
|
|
#define __UNKNOWN_APP 0
|
|
|
|
#define __CONSOLE_APP 1
|
|
|
|
#define __GUI_APP 2
|
|
|
|
void __set_app_type(int);
|
|
|
|
void _controlfp(unsigned a, unsigned b);
|
|
|
|
|
2015-03-03 22:35:33 +03:00
|
|
|
#ifndef __TRY__
|
|
|
|
#ifdef _WIN64
|
|
|
|
#define __TRY__
|
|
|
|
#else
|
|
|
|
#define __TRY__ void __try__(void**), *_sehrec[6]; __try__(_sehrec);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2005-04-17 17:11:15 +04:00
|
|
|
int _winstart(void)
|
|
|
|
{
|
2010-10-19 15:15:06 +04:00
|
|
|
__TRY__
|
2009-07-19 00:07:10 +04:00
|
|
|
char *szCmd;
|
|
|
|
STARTUPINFO startinfo;
|
|
|
|
int fShow;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
__set_app_type(__GUI_APP);
|
|
|
|
_controlfp(0x10000, 0x30000);
|
|
|
|
|
|
|
|
szCmd = GetCommandLine();
|
|
|
|
if (szCmd) {
|
|
|
|
while (' ' == *szCmd)
|
|
|
|
szCmd++;
|
|
|
|
if ('\"' == *szCmd) {
|
|
|
|
while (*++szCmd)
|
|
|
|
if ('\"' == *szCmd) {
|
|
|
|
szCmd++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
while (*szCmd && ' ' != *szCmd)
|
|
|
|
szCmd++;
|
|
|
|
}
|
|
|
|
while (' ' == *szCmd)
|
|
|
|
szCmd++;
|
|
|
|
}
|
|
|
|
|
|
|
|
GetStartupInfo(&startinfo);
|
|
|
|
fShow = startinfo.wShowWindow;
|
|
|
|
if (0 == (startinfo.dwFlags & STARTF_USESHOWWINDOW))
|
|
|
|
fShow = SW_SHOWDEFAULT;
|
|
|
|
|
|
|
|
ret = WinMain(GetModuleHandle(NULL), NULL, szCmd, fShow);
|
|
|
|
exit(ret);
|
2005-04-17 17:11:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
int _runwinmain(int argc, char **argv)
|
|
|
|
{
|
2009-07-19 00:07:10 +04:00
|
|
|
char *szCmd, *p;
|
|
|
|
|
|
|
|
p = GetCommandLine();
|
|
|
|
szCmd = NULL;
|
|
|
|
if (argc > 1)
|
|
|
|
szCmd = strstr(p, argv[1]);
|
|
|
|
if (NULL == szCmd)
|
|
|
|
szCmd = "";
|
|
|
|
else if (szCmd > p && szCmd[-1] == '\"')
|
|
|
|
--szCmd;
|
2013-08-29 00:55:05 +04:00
|
|
|
_controlfp(0x10000, 0x30000);
|
2009-07-19 00:07:10 +04:00
|
|
|
return WinMain(GetModuleHandle(NULL), NULL, szCmd, SW_SHOWDEFAULT);
|
2005-04-17 17:11:15 +04:00
|
|
|
}
|