int exec(pchar s, int mode, bool do_wait) //-------------------------------------- { // return WinExec(s,mode); PROCESS_INFORMATION pi; STARTUPINFO si; TWin *lastw = TWin::get_active_window(); ZeroMemory(&si,sizeof(STARTUPINFO)); si.cb = sizeof(STARTUPINFO); si.dwFlags = STARTF_USESHOWWINDOW; si.wShowWindow = mode; BOOL bRet = CreateProcess(NULL, s, NULL,NULL, // no security! FALSE, // inherited handles CREATE_NEW_CONSOLE, // creation flags NULL,NULL, &si, &pi); if (!bRet) return 0; if (do_wait) { WaitForSingleObject(pi.hProcess,1000); CloseHandle(pi.hProcess); CloseHandle(pi.hThread); } //process_id = pi.dwProcessId; lastw->set_focus(); delete lastw; return 1; }
void TSetupSheet::ReflectToMainWindow() { TWin *win = parent ? parent->Parent() : NULL; if (!win) return; if (cfg->estimateMode != sv->estimateMode) { win->CheckDlgButton(ESTIMATE_CHECK, cfg->estimateMode); } if (cfg->ignoreErr != sv->ignoreErr) { win->CheckDlgButton(IGNORE_CHECK, cfg->ignoreErr); } if (cfg->enableVerify != sv->enableVerify) { win->CheckDlgButton(VERIFY_CHECK, cfg->enableVerify); } if (cfg->enableAcl != sv->enableAcl) { win->CheckDlgButton(ACL_CHECK, cfg->enableAcl); } if (cfg->enableStream != sv->enableStream) { win->CheckDlgButton(STREAM_CHECK, cfg->enableStream); } if (cfg->speedLevel != sv->speedLevel) { SetSpeedLevelLabel(win, cfg->speedLevel); win->PostMessage(WM_HSCROLL, MAKEWPARAM(SB_THUMBTRACK, cfg->speedLevel), (LPARAM)win->GetDlgItem(SPEED_SLIDER)); } if (cfg->isExtendFilter != sv->isExtendFilter) { win->CheckDlgButton(EXTENDFILTER_CHECK, cfg->isExtendFilter); } if (cfg->enableOwdel != sv->enableOwdel) { win->CheckDlgButton(OWDEL_CHECK, cfg->enableOwdel); } }
BOOL TApp::PreProcMsg(MSG *msg) // for TranslateAccel & IsDialogMessage { for (HWND hWnd=msg->hwnd; hWnd; hWnd=::GetParent(hWnd)) { TWin *win = SearchWnd(hWnd); if (win) return win->PreProcMsg(msg); } return FALSE; }
LRESULT CALLBACK TApp::WinProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { TApp *app = TApp::GetApp(); TWin *win = app->SearchWnd(hWnd); if (win) return win->WinProc(uMsg, wParam, lParam); if ((win = app->preWnd)) { app->preWnd = NULL; app->AddWinByWnd(win, hWnd); return win->WinProc(uMsg, wParam, lParam); } return ::DefWindowProc(hWnd, uMsg, wParam, lParam); }
int ucw_cmd(UCWin win, char *cmd) { PWin pwin = (PWin)win; Rect rt; pwin->get_client_rect(rt); switch(cmd[0]) { case 'W': return pwin->width(); case 'H': return pwin->height(); case 'w': return rt.right; case 'h': return rt.bottom; case 'X': pwin->get_dc()->xor_pen(); return 0; case 'F': pwin->show(); return 0; case 'T': { TWin *p = TWin::get_active_window(); // presumably the console! pwin->on_top(); // puts graphix window on top! p->set_focus(); // but restore focus to console return 0; } default: return 0; } }
LRESULT CALLBACK TApp::WinProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { TApp *app = TApp::GetApp(); TWin *win = app->SearchWnd(hWnd); LRESULT ret = 0; if (win) { ret = win->WinProc(uMsg, wParam, lParam); } else if ((win = app->preWnd)) { app->preWnd = NULL; app->AddWinByWnd(win, hWnd); ret = win->WinProc(uMsg, wParam, lParam); } else { ret = ::DefWindowProcW(hWnd, uMsg, wParam, lParam); } if (uMsg == WM_DESTROY && app->mainWnd && hWnd == app->mainWnd->hWnd) { ::PostQuitMessage(app->result); } return ret; }