VOID PROGRAM_CopyMoveProgram(HLOCAL hProgram, BOOL bMove) { PROGRAM *program = LocalLock(hProgram); PROGGROUP *fromgroup = LocalLock(program->hGroup); HLOCAL hGroup = DIALOG_CopyMove(LocalLock(program->hName), LocalLock(fromgroup->hName), bMove); if (!hGroup) return; /* FIXME shouldn't be necessary */ OpenIcon(((PROGGROUP*)LocalLock(hGroup))->hWnd); if (!PROGRAM_AddProgram(hGroup, #if 0 CopyIcon(program->hIcon), #else program->hIcon, #endif LocalLock(program->hName), program->x, program->y, LocalLock(program->hCmdLine), LocalLock(program->hIconFile), program->nIconIndex, LocalLock(program->hWorkDir), program->nHotKey, program->nCmdShow)) return; GRPFILE_WriteGroupFile(hGroup); if (bMove) PROGRAM_DeleteProgram(hProgram, TRUE); }
void CMainFrame::OnClose() { if (IsIconic()) { OpenIcon(); } CString strInfo; strInfo.Format(LOAD_STRING(IDS_EXITQUESTION), theApp.GetCurCashier()->GetName()); CMsgBoxDlg dlg; dlg.SetText(strInfo); dlg.SetType(MB_OKCANCEL | MB_ICONQUESTION); if (dlg.DoModal() == IDOK) { CIBALog::GetInstance()->Write(_T("Goodbye, IBA!")); theApp.GetRealName()->UnInitRealName(); //theApp.GetIBAView()->SendMessage(WM_CHILDCLOSE, GetDlgCtrlID(), (LPARAM)theApp.GetIBAView()->m_hDodonewView); CBCGPFrameWnd::OnClose(); } CCashierHelper::UninitDiankaPlatform(); }
static void TaskManager_OnRestoreMainWindow(void) { BOOL OnTop; OnTop = (GetWindowLongW(hMainWnd, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0; OpenIcon(hMainWnd); SetForegroundWindow(hMainWnd); SetWindowPos(hMainWnd, (OnTop ? HWND_TOPMOST : HWND_TOP), 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW); }
void TaskManager_OnRestoreMainWindow(void) { //HMENU hMenu, hOptionsMenu; BOOL OnTop; //hMenu = GetMenu(hMainWnd); //hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX); OnTop = ((GetWindowLongPtrW(hMainWnd, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0); OpenIcon(hMainWnd); SetForegroundWindow(hMainWnd); SetWindowPos(hMainWnd, (OnTop ? HWND_TOPMOST : HWND_TOP), 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW); }
BOOL CALLBACK AFEnumWindowsProc( HWND hwnd, LPARAM otherProcessId ) { int pid = (int)otherProcessId; int winPid; GetWindowThreadProcessId( hwnd, (DWORD*)&winPid ); LOG_5( "Found window with process id: " + QString::number( winPid ) ); if( winPid == pid ) { LOG_5( "Raising window" ); if( IsIconic( hwnd ) ) OpenIcon( hwnd ); SetForegroundWindow( hwnd ); // SetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_ASYNCWINDOWPOS | SWP_NOMOVE | SWP_NOSIZE ); } return true; }
//------------------------------------------------------------------- int CALLBACK EnumWindowsProc(HWND hWnd, LPARAM /*lParam*/) { COPYDATASTRUCT cds; char *lpCmdLine; if(GetProp(hWnd, PROP_NAME)){ // コマンドラインを既存のウィンドウに送信 // Send command-line to lpCmdLine = GetCommandLine(); cds.dwData = 0; cds.lpData = (void *)lpCmdLine; cds.cbData = lstrlen(lpCmdLine) + 1; SendMessage(hWnd, WM_COPYDATA, (WPARAM)NULL, (LPARAM)&cds); // ウィンドウをアクティブにしてフォーカスを移す // Activate window and set focus to window. if(IsMinimized(hWnd)) OpenIcon(hWnd); SetForegroundWindow(hWnd); return FALSE; } return TRUE; }
/* * Create - displays the dialog box */ BOOL SysDlg_Create(HWND parentWnd, SYS *sys) { /* * If the editor window already exists, just re-initialize it. */ if (Prog_sysDlg) { SysDlg_Update(Prog_sysDlg, sys); if (IsIconic(Prog_sysDlg)) { OpenIcon(Prog_sysDlg); } BringWindowToTop(Prog_sysDlg); } else { sd_parentWnd = parentWnd; sd_data = sys->data; Prog_sysDlg = CreateDialogParam(Prog_instance, (LPCTSTR) IDD_SYSDLG , HWND_DESKTOP, sd_DlgProc, 0); if (!Prog_sysDlg) { MsgBox_LastError(parentWnd); return FALSE; } } return TRUE; }
/* * Create() */ BOOL MtfDlg_Create(HWND parentWnd, MTF *mtf) { /* * If the editor window already exists, just re-initialize it. */ if (Prog_mtfDlg) { MtfDlg_Update(Prog_mtfDlg, mtf); if (IsIconic(Prog_mtfDlg)) { OpenIcon(Prog_mtfDlg); } BringWindowToTop(Prog_mtfDlg); } else { mfd_parentWnd = parentWnd; mfd_dlgData.data = mtf->data; CreateDialogParam(Prog_instance, (LPCTSTR) IDD_MTFDLG, HWND_DESKTOP , mfd_DlgProc, 0); if (!Prog_mtfDlg) { MsgBox_LastError(parentWnd); return FALSE; } } return TRUE; }
LRESULT CALLBACK _glfwWindowCallback( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { int WheelDelta, Iconified; // ZBS added this code to look for the correct _glfwWin given the hWnd // Changed all the references from _glfwWin. to winPtr-> _GLFWwin *winPtr = 0; int i; for( i=0; i<MAX_ALIASES; i++ ) { if( aliases[i].Wnd == hWnd ) { winPtr = &aliases[i]; break; } } if( winPtr == 0 ) { winPtr = &_glfwWin; } // Handle certain window messages switch( uMsg ) { // Window activate message? (iconification?) case WM_ACTIVATE: winPtr->Active = LOWORD(wParam) != WA_INACTIVE ? GL_TRUE : GL_FALSE; Iconified = HIWORD(wParam) ? GL_TRUE : GL_FALSE; // Were we deactivated/iconified? if( (!winPtr->Active || Iconified) && !winPtr->Iconified ) { // If we are in fullscreen mode we need to iconify if( winPtr->Fullscreen ) { // Do we need to manually iconify? if( !Iconified ) { // Minimize window CloseWindow( winPtr->Wnd ); // The window is now iconified Iconified = GL_TRUE; } // Change display settings to the desktop resolution ChangeDisplaySettings( NULL, CDS_FULLSCREEN ); } // Unlock mouse if( !winPtr->OldMouseLockValid ) { winPtr->OldMouseLock = winPtr->MouseLock; winPtr->OldMouseLockValid = GL_TRUE; glfwEnable( GLFW_MOUSE_CURSOR ); } } else if( winPtr->Active || !Iconified ) { // If we are in fullscreen mode we need to maximize if( winPtr->Fullscreen && winPtr->Iconified ) { // Change display settings to the user selected mode _glfwSetVideoModeMODE( winPtr->ModeID ); // Do we need to manually restore window? if( Iconified ) { // Restore window OpenIcon( winPtr->Wnd ); // The window is no longer iconified Iconified = GL_FALSE; // Activate window ShowWindow( hWnd, SW_SHOW ); _glfwSetForegroundWindow( winPtr->Wnd ); SetFocus( winPtr->Wnd ); } } // Lock mouse, if necessary if( winPtr->OldMouseLockValid && winPtr->OldMouseLock ) { glfwDisable( GLFW_MOUSE_CURSOR ); } winPtr->OldMouseLockValid = GL_FALSE; } winPtr->Iconified = Iconified; return 0; // Intercept system commands (forbid certain actions/events) case WM_SYSCOMMAND: switch( wParam ) { // Screensaver trying to start or monitor trying to enter // powersave? case SC_SCREENSAVE: case SC_MONITORPOWER: if( winPtr->Fullscreen ) { return 0; } else { break; } // User trying to access application menu using ALT? case SC_KEYMENU: return 0; } break; // Did we receive a close message? case WM_CLOSE: PostQuitMessage( 0 ); return 0; // Is a key being pressed? case WM_KEYDOWN: case WM_SYSKEYDOWN: // Translate and report key press _glfwInputKey( _glfwTranslateKey( wParam, lParam ), GLFW_PRESS ); // Translate and report character input if( winPtr->CharCallback ) { _glfwTranslateChar( wParam, lParam, GLFW_PRESS ); } return 0; // Is a key being released? case WM_KEYUP: case WM_SYSKEYUP: // Special trick: release both shift keys on SHIFT up event if( wParam == VK_SHIFT ) { _glfwInputKey( GLFW_KEY_LSHIFT, GLFW_RELEASE ); _glfwInputKey( GLFW_KEY_RSHIFT, GLFW_RELEASE ); } else { // Translate and report key release _glfwInputKey( _glfwTranslateKey( wParam, lParam ), GLFW_RELEASE ); } // Translate and report character input if( winPtr->CharCallback ) { _glfwTranslateChar( wParam, lParam, GLFW_RELEASE ); } return 0; // Were any of the mouse-buttons pressed? case WM_LBUTTONDOWN: SetCapture(hWnd); _glfwInputMouseClick( GLFW_MOUSE_BUTTON_LEFT, GLFW_PRESS ); return 0; case WM_RBUTTONDOWN: SetCapture(hWnd); _glfwInputMouseClick( GLFW_MOUSE_BUTTON_RIGHT, GLFW_PRESS ); return 0; case WM_MBUTTONDOWN: SetCapture(hWnd); _glfwInputMouseClick( GLFW_MOUSE_BUTTON_MIDDLE, GLFW_PRESS ); return 0; case WM_XBUTTONDOWN: if( HIWORD(wParam) == XBUTTON1 ) { SetCapture(hWnd); _glfwInputMouseClick( GLFW_MOUSE_BUTTON_4, GLFW_PRESS ); } else if( HIWORD(wParam) == XBUTTON2 ) { SetCapture(hWnd); _glfwInputMouseClick( GLFW_MOUSE_BUTTON_5, GLFW_PRESS ); } return 1; // Were any of the mouse-buttons released? case WM_LBUTTONUP: ReleaseCapture(); _glfwInputMouseClick( GLFW_MOUSE_BUTTON_LEFT, GLFW_RELEASE ); return 0; case WM_RBUTTONUP: ReleaseCapture(); _glfwInputMouseClick( GLFW_MOUSE_BUTTON_RIGHT, GLFW_RELEASE ); return 0; case WM_MBUTTONUP: ReleaseCapture(); _glfwInputMouseClick( GLFW_MOUSE_BUTTON_MIDDLE, GLFW_RELEASE ); return 0; case WM_XBUTTONUP: if( HIWORD(wParam) == XBUTTON1 ) { ReleaseCapture(); _glfwInputMouseClick( GLFW_MOUSE_BUTTON_4, GLFW_RELEASE ); } else if( HIWORD(wParam) == XBUTTON2 ) { ReleaseCapture(); _glfwInputMouseClick( GLFW_MOUSE_BUTTON_5, GLFW_RELEASE ); } return 1; // Did the mouse move? case WM_MOUSEMOVE: { int NewMouseX, NewMouseY; // Get signed (!) mouse position NewMouseX = (int)((short)LOWORD(lParam)); NewMouseY = (int)((short)HIWORD(lParam)); if( NewMouseX != _glfwInput.OldMouseX || NewMouseY != _glfwInput.OldMouseY ) { if( winPtr->MouseLock ) { _glfwInput.MousePosX += NewMouseX - _glfwInput.OldMouseX; _glfwInput.MousePosY += NewMouseY - _glfwInput.OldMouseY; } else { _glfwInput.MousePosX = NewMouseX; _glfwInput.MousePosY = NewMouseY; } _glfwInput.OldMouseX = NewMouseX; _glfwInput.OldMouseY = NewMouseY; _glfwInput.MouseMoved = GL_TRUE; // Call user callback function if( winPtr->MousePosCallback ) { winPtr->MousePosCallback( _glfwInput.MousePosX, _glfwInput.MousePosY ); } } } return 0; // Mouse wheel action? case WM_MOUSEWHEEL: // WM_MOUSEWHEEL is not supported under Windows 95 if( _glfwSys.WinVer != _GLFW_WIN_95 ) { WheelDelta = (((int)wParam) >> 16) / WHEEL_DELTA; _glfwInput.WheelPos += WheelDelta; if( winPtr->MouseWheelCallback ) { winPtr->MouseWheelCallback( _glfwInput.WheelPos ); } return 0; } break; // Resize the window? case WM_SIZE: winPtr->Width = LOWORD(lParam); winPtr->Height = HIWORD(lParam); if( winPtr->WindowSizeCallback ) { winPtr->WindowSizeCallback( LOWORD(lParam), HIWORD(lParam) ); } return 0; // Was the window contents damaged? case WM_PAINT: // Call user callback function if( winPtr->WindowRefreshCallback ) { winPtr->WindowRefreshCallback(); } break; default: break; }
/* * Create - displays the dialog box */ HWND RemoteWnd_Create(HWND parentWnd) { HWND remoteWnd; if (Prog_remoteWnd) { if (IsIconic(Prog_remoteWnd)) { OpenIcon(Prog_remoteWnd); } BringWindowToTop(Prog_remoteWnd); remoteWnd = Prog_remoteWnd; } else { RECT wndRect = { 60, 60, 685, 120 }; DWORD wndExStyles = WS_EX_LEFT; DWORD wndStyles = WS_POPUPWINDOW | WS_CAPTION | WS_SYSMENU; int i; if (!AdjustWindowRectEx(&wndRect, wndStyles, FALSE, wndExStyles)) { MsgBox_LastErrorF(parentWnd, _T("Error adjusting window rect")); } remoteWnd = CreateWindowEx( wndExStyles /* extended styles */ , RemoteWnd_className /* window class */ , _T("Remote") /* caption text */ , wndStyles /* styles */ , wndRect.left, wndRect.top /* left, top */ , RECT_W(wndRect), RECT_H(wndRect) /* width, height */ , NULL /* parent window */ , (HMENU) NULL /* menu */ , Prog_instance /* program instance */ , NULL /* creation data */ ); if (!remoteWnd) { MsgBox_LastErrorF(parentWnd , _T("Error creating remote control window")); return NULL; } /* * Add "Stay On Top" system menu item. */ Window_AddSysMenuItem(remoteWnd, _T("Stay On Top"), IDM_STAY_ON_TOP , TRUE); rw_StayOnTop(remoteWnd); /* * Initialize buttons. */ for (i = 0; i < btnInitCnt; i++) { HWND btn = CreateWindowEx( 0 /* extended styles */ , _T("BUTTON") /* window class */ , _T("TX81Z Remote") /* caption text */ , BS_OWNERDRAW | WS_CHILD | WS_VISIBLE /* styles */ , btnInits[i].x, btnInits[i].y /* left, top */ , btnInits[i].w, btnInits[i].h /* width, height */ , remoteWnd /* parent window */ , (HMENU) btnInits[i].btnID /* menu */ , Prog_instance /* program instance */ , NULL /* creation data */ ); if (!btn) { MsgBox_LastErrorF(parentWnd , _T("Error creating remote control button")); return NULL; } rw_origBtnProc = (WNDPROC) SetWindowLong(btn, GWL_WNDPROC , (long) rw_BtnProc); } ShowWindow(remoteWnd, SW_SHOW); } return remoteWnd; }
static VOID MAIN_MenuCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) { HLOCAL hActiveGroup = GROUP_ActiveGroup(); HLOCAL hActiveProgram = PROGRAM_ActiveProgram(hActiveGroup); HWND hActiveGroupWnd = GROUP_GroupWnd(hActiveGroup); switch(wParam) { /* Menu File */ case PM_NEW: switch (DIALOG_New((hActiveGroupWnd && !IsIconic(hActiveGroupWnd)) ? PM_NEW_PROGRAM : PM_NEW_GROUP)) { case PM_NEW_PROGRAM: if (hActiveGroup) PROGRAM_NewProgram(hActiveGroup); break; case PM_NEW_GROUP: GROUP_NewGroup(); break; } break; case PM_OPEN: if (hActiveProgram) PROGRAM_ExecuteProgram(hActiveProgram); else if (hActiveGroupWnd) OpenIcon(hActiveGroupWnd); break; case PM_MOVE: case PM_COPY: if (hActiveProgram) PROGRAM_CopyMoveProgram(hActiveProgram, wParam == PM_MOVE); break; case PM_DELETE: if (hActiveProgram) { if (DIALOG_Delete(IDS_DELETE_PROGRAM_s, PROGRAM_ProgramName(hActiveProgram))) PROGRAM_DeleteProgram(hActiveProgram, TRUE); } else if (hActiveGroup) { if (DIALOG_Delete(IDS_DELETE_GROUP_s, GROUP_GroupName(hActiveGroup))) GROUP_DeleteGroup(hActiveGroup); } break; case PM_ATTRIBUTES: if (hActiveProgram) PROGRAM_ModifyProgram(hActiveProgram); else if (hActiveGroup) GROUP_ModifyGroup(hActiveGroup); break; case PM_EXECUTE: DIALOG_Execute(); break; case PM_EXIT: PostQuitMessage(0); break; /* Menu Options */ case PM_AUTO_ARRANGE: Globals.bAutoArrange = !Globals.bAutoArrange; CheckMenuItem(Globals.hOptionMenu, PM_AUTO_ARRANGE, MF_BYCOMMAND | (Globals.bAutoArrange ? MF_CHECKED : MF_UNCHECKED)); WritePrivateProfileString("Settings", "AutoArrange", Globals.bAutoArrange ? "1" : "0", Globals.lpszIniFile); WritePrivateProfileString(NULL,NULL,NULL,Globals.lpszIniFile); /* flush it */ break; case PM_MIN_ON_RUN: Globals.bMinOnRun = !Globals.bMinOnRun; CheckMenuItem(Globals.hOptionMenu, PM_MIN_ON_RUN, MF_BYCOMMAND | (Globals.bMinOnRun ? MF_CHECKED : MF_UNCHECKED)); WritePrivateProfileString("Settings", "MinOnRun", Globals.bMinOnRun ? "1" : "0", Globals.lpszIniFile); WritePrivateProfileString(NULL,NULL,NULL,Globals.lpszIniFile); /* flush it */ break; case PM_SAVE_SETTINGS: Globals.bSaveSettings = !Globals.bSaveSettings; CheckMenuItem(Globals.hOptionMenu, PM_SAVE_SETTINGS, MF_BYCOMMAND | (Globals.bSaveSettings ? MF_CHECKED : MF_UNCHECKED)); WritePrivateProfileString("Settings", "SaveSettings", Globals.bSaveSettings ? "1" : "0", Globals.lpszIniFile); WritePrivateProfileString(NULL,NULL,NULL,Globals.lpszIniFile); /* flush it */ break; /* Menu Windows */ case PM_ARRANGE: if (hActiveGroupWnd && !IsIconic(hActiveGroupWnd)) ArrangeIconicWindows(hActiveGroupWnd); else SendMessage(Globals.hMDIWnd, WM_MDIICONARRANGE, 0, 0); break; /* Menu Help */ case PM_CONTENTS: if (!WinHelp(Globals.hMainWnd, "progman.hlp", HELP_INDEX, 0)) MAIN_MessageBoxIDS(IDS_WINHELP_ERROR, IDS_ERROR, MB_OK); break; case PM_HELPONHELP: if (!WinHelp(Globals.hMainWnd, "progman.hlp", HELP_HELPONHELP, 0)) MAIN_MessageBoxIDS(IDS_WINHELP_ERROR, IDS_ERROR, MB_OK); break; case PM_TUTORIAL: WinExec("wintutor.exe", SW_SHOWNORMAL); break; case PM_LICENSE: WineLicense(Globals.hMainWnd, Globals.lpszLanguage); break; case PM_NO_WARRANTY: WineWarranty(Globals.hMainWnd, Globals.lpszLanguage); break; case PM_ABOUT_WINE: ShellAbout(hWnd, "WINE", "Program Manager", 0); break; default: if (wParam >= PM_FIRST_LANGUAGE && wParam <= PM_LAST_LANGUAGE) STRING_SelectLanguageByNumber(wParam - PM_FIRST_LANGUAGE); else MAIN_MessageBoxIDS(IDS_NOT_IMPLEMENTED, IDS_ERROR, MB_OK); break; } }