Sync'ed show-window flag in MDI child constructor; added initial wxKill implementation

for wxMSW


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10582 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 2001-06-15 12:59:22 +00:00
parent eaac8805cd
commit e949bf13c5
2 changed files with 58 additions and 3 deletions

View File

@ -650,6 +650,7 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
: wxDEFAULT_MDICHILDFRAME_ICON);
SetName(name);
wxWindowBase::Show(TRUE); // MDI child frame starts off shown
if ( id > -1 )
m_windowId = id;

View File

@ -513,11 +513,65 @@ bool wxSetEnv(const wxString& var, const wxChar *value)
// process management
// ----------------------------------------------------------------------------
int wxKill(long WXUNUSED(pid), int WXUNUSED(sig))
int wxKill(long pid, wxSignal sig)
{
// TODO use SendMessage(WM_QUIT) and TerminateProcess() if needed
#ifndef __WIN32__
return -1;
#else
// This in a work in progress. We need to eliminate the call to wxSleep,
// deal with child processes, and also test it :-)
HWND hHwnd;
HANDLE hProcess;
unsigned long code;
bool terminateSuccess = TRUE;
return 0;
hProcess = OpenProcess(PROCESS_TERMINATE | PROCESS_QUERY_INFORMATION,
FALSE, (unsigned long)pid);
if (hProcess == NULL)
return -1;
if (sig == wxSIGKILL)
terminateSuccess = (TerminateProcess(hProcess, 0) != 0);
else if (sig != wxSIGNONE)
{
hHwnd = ::FindWindow(NULL, NULL);
while (hHwnd != 0)
{
if (::GetParent(hHwnd) == 0)
{
unsigned long testpid = 0;
GetWindowThreadProcessId(hHwnd, &testpid);
if ((unsigned long)pid == testpid)
{
PostMessage(hHwnd, WM_QUIT, 0, 0);
// How to make this better?
// If we don't wait, the return value is wrong.
wxSleep(1);
break;
}
}
hHwnd = GetWindow(hHwnd, GW_HWNDNEXT);
}
}
GetExitCodeProcess(hProcess, &code);
CloseHandle(hProcess);
if (sig == wxSIGNONE)
{
if (code == STILL_ACTIVE)
return 0;
else
return -1;
}
else
{
if (!terminateSuccess || code == STILL_ACTIVE)
return -1;
else
return 0;
}
#endif
}
// Execute a program in an Interactive Shell