* Changed "true" to "TRUE" in some file: "true" doesn't exist in BC++ 5
* Added wxDataStream and wxProcess * Added the asynchronous end process notification on GTK and MSW * Updated configure* and setup.h * Added extended.c: Apple code to encode/decode float in IEEE format this code is removable by disabling USE_APPLE_CODEC git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@162 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -207,97 +207,6 @@ bool wxGetUserName(char *buf, int maxSize)
|
||||
#endif
|
||||
}
|
||||
|
||||
// Execute a command (e.g. another program) in a
|
||||
// system-independent manner.
|
||||
|
||||
long wxExecute(char **argv, bool sync)
|
||||
{
|
||||
if (*argv == NULL)
|
||||
return 0;
|
||||
|
||||
char command[1024];
|
||||
command[0] = '\0';
|
||||
|
||||
int argc;
|
||||
for (argc = 0; argv[argc]; argc++)
|
||||
{
|
||||
if (argc)
|
||||
strcat(command, " ");
|
||||
strcat(command, argv[argc]);
|
||||
}
|
||||
|
||||
return wxExecute((char *)command, sync);
|
||||
}
|
||||
|
||||
long wxExecute(const wxString& command, bool sync)
|
||||
{
|
||||
if (command == "")
|
||||
return 0;
|
||||
|
||||
#ifdef __WIN32__
|
||||
char * cl;
|
||||
char * argp;
|
||||
int clen;
|
||||
HINSTANCE result;
|
||||
DWORD dresult;
|
||||
|
||||
// copy the command line
|
||||
clen = command.Length();
|
||||
if (!clen) return -1;
|
||||
cl = (char *) calloc( 1, 256);
|
||||
if (!cl) return -1;
|
||||
strcpy( cl, WXSTRINGCAST command);
|
||||
|
||||
// isolate command and arguments
|
||||
argp = strchr( cl, ' ');
|
||||
if (argp)
|
||||
*argp++ = '\0';
|
||||
|
||||
// execute the command
|
||||
#ifdef __GNUWIN32__
|
||||
result = ShellExecute( (HWND) (wxTheApp->GetTopWindow() ? (HWND) wxTheApp->GetTopWindow()->GetHWND() : NULL),
|
||||
(const wchar_t) "open", (const wchar_t) cl, (const wchar_t) argp, (const wchar_t) NULL, SW_SHOWNORMAL);
|
||||
#else
|
||||
result = ShellExecute( (HWND) (wxTheApp->GetTopWindow() ? wxTheApp->GetTopWindow()->GetHWND() : NULL),
|
||||
"open", cl, argp, NULL, SW_SHOWNORMAL);
|
||||
#endif
|
||||
|
||||
if (((long)result) <= 32) {
|
||||
free(cl);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!sync)
|
||||
{
|
||||
free(cl);
|
||||
return dresult;
|
||||
}
|
||||
|
||||
// waiting until command executed
|
||||
do {
|
||||
wxYield();
|
||||
dresult = GetModuleFileName( result, cl, 256);
|
||||
} while( dresult);
|
||||
|
||||
/* long lastError = GetLastError(); */
|
||||
|
||||
free(cl);
|
||||
return 0;
|
||||
#else
|
||||
long instanceID = WinExec((LPCSTR) WXSTRINGCAST command, SW_SHOW);
|
||||
if (instanceID < 32) return(0);
|
||||
|
||||
if (sync) {
|
||||
int running;
|
||||
do {
|
||||
wxYield();
|
||||
running = GetModuleUsage((HANDLE)instanceID);
|
||||
} while (running);
|
||||
}
|
||||
return(instanceID);
|
||||
#endif
|
||||
}
|
||||
|
||||
int wxKill(long pid, int sig)
|
||||
{
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user