void CPpcMainWnd::OnActivate(int nActive, BOOL fMinimized, HWND hwndPrevious) { m_fActive = nActive == WA_INACTIVE ? FALSE : TRUE; if (!m_pOptions) return; if (((CPpcOptions*)m_pOptions)->m_fReleaseKeyMap && !m_fHold) { if (nActive == WA_INACTIVE) UnregisterHotKeys(); else RegisterHotKeys(); } SHHandleWMActivate(m_hWnd, MAKELONG(nActive, fMinimized), (LONG)hwndPrevious, &m_sai, FALSE); }
LRESULT TopWindow::on_message(HWND _hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_ACTIVATE: #ifdef HAVE_ACTIVATE_INFO SHHandleWMActivate(_hWnd, wParam, lParam, &s_sai, FALSE); #endif if (wParam == WA_INACTIVE ? on_deactivate() : on_activate()) return true; break; case WM_SETTINGCHANGE: #ifdef HAVE_ACTIVATE_INFO SHHandleWMSettingChange(_hWnd, wParam, lParam, &s_sai); #endif break; }; return ContainerWindow::on_message(_hWnd, message, wParam, lParam); }
// // FUNCTION: WndProc(HWND, unsigned, WORD, LONG) // // PURPOSE: Processes messages for the main window. // // WM_COMMAND - process the application menu // WM_PAINT - Paint the main window // WM_DESTROY - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC hdc; int wmId, wmEvent; PAINTSTRUCT ps; wchar_t* str; wchar_t* s; HBRUSH brush; COLORREF color; switch (message) { case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { case IDM_HELP_ABOUT: DialogBox(g_hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About); break; case IDOK: case IDM_EXIT: SendMessage(hWnd, WM_CLOSE, 0, 0); break; case ID_FILE_TOGGLESWITCH: SwitchPower = !SwitchPower; InvalidateRect(hWndMainWindow,NULL,false); UPnPSetState_SwitchPower_Status(UPnPmicroStack,SwitchPower); break; case ID_FILE_DIMMERUP: DimmingService += 20; if (DimmingService > 100) DimmingService = 100; InvalidateRect(hWndMainWindow,NULL,false); UPnPSetState_DimmingService_LoadLevelStatus(UPnPmicroStack,DimmingService); break; case ID_FILE_DIMMERDOWN: DimmingService -= 20; if (DimmingService < 0) DimmingService = 0; InvalidateRect(hWndMainWindow,NULL,false); UPnPSetState_DimmingService_LoadLevelStatus(UPnPmicroStack,DimmingService); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_CLOSE: ILibStopChain(UPnPmicroStackChain); break; case WM_CREATE: g_hwndCB = CreateRpCommandBar(hWnd); // Initialize the shell activate info structure memset (&s_sai, 0, sizeof (s_sai)); s_sai.cbSize = sizeof (s_sai); UPnPThread = CreateThread(NULL, 0, &UPnPMain, 0, 0, NULL ); break; case WM_PAINT: RECT rt; hdc = BeginPaint(hWnd, &ps); color = RGB(128,128,128); if (SwitchPower == true) { color = RGB(128+DimmingService,128+DimmingService,128-DimmingService); } GetClientRect(hWnd, &rt); brush = CreateSolidBrush(color); SetBkColor(hdc,color); FillRect(hdc,&rt,brush); DeleteObject(brush); if (SwitchPower == true) s = TEXT("ON"); else s = TEXT("OFF"); str = (unsigned short*)malloc(400); swprintf(str,TEXT("Power %s, Dimmer %d"),s,DimmingService); DrawText(hdc, str, -1, &rt, DT_SINGLELINE | DT_VCENTER | DT_CENTER); free(str); EndPaint(hWnd, &ps); break; case WM_DESTROY: CommandBar_Destroy(g_hwndCB); PostQuitMessage(0); break; case WM_ACTIVATE: // Notify shell of our activate message SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE); break; case WM_SETTINGCHANGE: SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
// // FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) // // PURPOSE: Processes messages for the main window. // // WM_COMMAND - process the application menu // WM_PAINT - Paint the main window // WM_DESTROY - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { //PAINTSTRUCT ps; //HDC hdc; static SHACTIVATEINFO s_sai; switch (message) { case WM_CREATE: Add2Log(L"WM_CREATE\r\nReadReg()\r\n", FALSE); if (g_HookActivate(g_hInstance)) { Add2Log(L"g_HookActivate loaded OK\r\n", FALSE); MessageBeep(MB_OK); //system bar icon //ShowIcon(hwnd, g_hInstance); DEBUGMSG(1, (L"Hook loaded OK")); } else { MessageBeep(MB_ICONEXCLAMATION); Add2Log(L"g_HookActivate FAILED. EXIT!\r\n", FALSE); MessageBox(hWnd, L"Could not hook. Already running a copy of iHook3? Will exit now.", L"iHook3", MB_OK | MB_ICONEXCLAMATION); PostQuitMessage(-1); } break; case WM_PAINT: PAINTSTRUCT ps; RECT rect; HDC hdc; // Adjust the size of the client rectangle to take into account // the command bar height. GetClientRect (hWnd, &rect); hdc = BeginPaint (hWnd, &ps); DrawText (hdc, TEXT ("keyLoggerCE loaded"), -1, &rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE); EndPaint (hWnd, &ps); return 0; break; case MYMSG_TASKBARNOTIFY: switch (lParam) { case WM_LBUTTONUP: //ShowWindow(hwnd, SW_SHOWNORMAL); SetWindowPos(hWnd, HWND_TOPMOST, 0,0,0,0, SWP_NOSIZE | SWP_NOREPOSITION | SWP_SHOWWINDOW); if (MessageBox(hWnd, L"Hook is loaded. End hooking?", szAppName, MB_YESNO | MB_ICONQUESTION | MB_APPLMODAL | MB_SETFOREGROUND | MB_TOPMOST)==IDYES) { g_HookDeactivate(); Shell_NotifyIcon(NIM_DELETE, &nid); PostQuitMessage (0) ; } ShowWindow(hWnd, SW_HIDE); } return 0; break; case WM_DESTROY: //taskbar system icon RemoveIcon(hWnd); MessageBeep(MB_OK); g_HookDeactivate(); PostQuitMessage(0); return 0; break; case WM_ACTIVATE: // Notify shell of our activate message SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE); break; case WM_SETTINGCHANGE: SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
/************************************* * WinceDlgProc *************************************/ INT_PTR CALLBACK SHVMainThreadEventDispatcherConsole::WinceDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { SHVMainThreadEventDispatcherConsole* self = evDispatcherConsole; INT_PTR retVal = 0; switch (message) { case WM_INITDIALOG: // Create a Done button and size it. { SHINITDLGINFO shidi; shidi.dwMask = SHIDIM_FLAGS; shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN | SHIDIF_SIZEDLGFULLSCREEN; shidi.hDlg = hWnd; SHInitDialog(&shidi); } return TRUE; case WM_COMMAND: if (LOWORD(wParam) == IDOK) { self->ModuleList->CloseApp(); return TRUE; } break; // normal message types case WM_SHV_DISPATCHMESSAGES: self->DispatchEvents(); break; case WM_SHV_PRINT: InvalidateRect(hWnd,NULL,TRUE); break; case WM_CLOSE: self->ModuleList->CloseApp(); break; case WM_ERASEBKGND: retVal = DefWindowProc(hWnd, message, wParam, lParam); #ifdef __SHIVA_POCKETPC case WM_SETTINGCHANGE: if (evDispatcherConsole) SHHandleWMSettingChange(hWnd, wParam, lParam, &evDispatcherConsole->s_sai); break; case WM_ACTIVATE: // Notify shell of our activate message if (self) { SHHandleWMActivate(hWnd, wParam, lParam, &evDispatcherConsole->s_sai, FALSE); ::SetFocus(self->edtConsole); } break; #else case WM_ACTIVATE: if (self) ::SetFocus(self->edtConsole); break; #endif case WM_PAINT: { PAINTSTRUCT ps; HDC hdc; hdc = BeginPaint(hWnd, &ps); if (evDispatcherConsole) { RECT rect; SHVListIterator<SHVString16,SHVStringBuffer16> itr(evDispatcherConsole->StringBuffers); bool first = true; int dcBackup = ::SaveDC(hdc); ::SelectObject(hdc,self->Font); // obtain boundaries ::GetClientRect(hWnd,&rect); if (evDispatcherConsole->edtConsole) { RECT wndRect, edtRect; ::GetWindowRect(hWnd,&wndRect); ::GetWindowRect(evDispatcherConsole->edtConsole,&edtRect); rect.bottom = edtRect.top - wndRect.top; } // print the text rect.top = rect.bottom - evDispatcherConsole->fontHeight; for (;rect.bottom > 0 && evDispatcherConsole->StringBuffers.MovePrev(itr.Pos()); rect.bottom -= evDispatcherConsole->fontHeight, rect.top -= evDispatcherConsole->fontHeight) { if (first && itr.Get().IsEmpty()) { if (!evDispatcherConsole->StringBuffers.MovePrev(itr.Pos())) break; } ::DrawTextW(hdc,itr.Get().GetSafeBufferWin32(),(int)itr.Get().GetLength(),&rect,DT_TOP|DT_SINGLELINE); first = false; } while (itr.Pos() && evDispatcherConsole->StringBuffers.GetHeadPosition() != itr.Pos() && evDispatcherConsole->StringBuffers.GetCount()) { evDispatcherConsole->StringBuffers.RemoveHead(); } ::RestoreDC(hdc,dcBackup); } EndPaint(hWnd, &ps); } break; case WM_WINDOWPOSCHANGED: if (self) { WINDOWPOS* wpos = (WINDOWPOS*)lParam; if (self->edtConsole && !(wpos->flags&SWP_FRAMECHANGED) && (!(wpos->flags&SWP_NOMOVE) || !(wpos->flags&SWP_NOSIZE))) { self->Resize(); } InvalidateRect(hWnd,NULL,TRUE); } retVal = DefWindowProc(hWnd, message, wParam, lParam); break; default: retVal = DefWindowProc(hWnd, message, wParam, lParam); } return retVal; }
// // FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) // // PURPOSE: Processes messages for the main window. // // WM_COMMAND - process the application menu // WM_PAINT - Paint the main window // WM_DESTROY - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; RECT rect; static SHACTIVATEINFO s_sai; switch (message) { case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { case IDM_HELP_ABOUT: DialogBox(g_hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, About); break; case IDM_OK: SendMessage (hWnd, WM_CLOSE, 0, 0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_SIZE: GetClientRect(hWnd, &rect); SetWindowPos(g_hWndTrace, NULL, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, SWP_NOZORDER); break; case WM_CREATE: SHMENUBARINFO mbi; memset(&mbi, 0, sizeof(SHMENUBARINFO)); mbi.cbSize = sizeof(SHMENUBARINFO); mbi.hwndParent = hWnd; mbi.nToolBarId = IDR_MENU; mbi.hInstRes = g_hInst; if (!SHCreateMenuBar(&mbi)) { g_hWndMenuBar = NULL; } else { g_hWndMenuBar = mbi.hwndMB; } // Initialize the shell activate info structure memset(&s_sai, 0, sizeof (s_sai)); s_sai.cbSize = sizeof (s_sai); GetClientRect(hWnd, &rect); g_hWndTrace = CreateWindowEx(WS_EX_CLIENTEDGE, L"EDIT", L"BT Monitor 1.0", //WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | ES_WANTRETURN | ES_LEFT, WS_CHILD | WS_VISIBLE | WS_VSCROLL| ES_MULTILINE | ES_READONLY | ES_WANTRETURN, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, hWnd, (HMENU)NULL, g_hInst, NULL); if(g_hWndTrace==NULL) DEBUGMSG(1, (L"Trace win cannot create: %i\n",GetLastError())); else{ DEBUGMSG(1, (L"Starting msgQueue with hwnd=%i\n", g_hWndTrace)); startMsgQueue(g_hWndTrace); } break; case WM_SETTEXT: DEBUGMSG(1, (L"WM_SETTEXT with '%s'\n", (TCHAR*)lParam)); break; case WM_PAINT: hdc = BeginPaint(hWnd, &ps); // TODO: Add any drawing code here... EndPaint(hWnd, &ps); break; case WM_DESTROY: CommandBar_Destroy(g_hWndMenuBar); stopMsgQueue(); PostQuitMessage(0); break; case WM_ACTIVATE: // Notify shell of our activate message SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE); break; case WM_SETTINGCHANGE: SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
// // FUNCTION: WndProc(HWND, unsigned, WORD, LONG) // // PURPOSE: Processes messages for the main window. // // WM_COMMAND - process the application menu // WM_PAINT - Paint the main window // WM_DESTROY - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC hdc; int wmId, wmEvent; PAINTSTRUCT ps; unsigned short* str[100]; RECT rt; int i; switch (message) { case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { case IDM_HELP_ABOUT: DialogBox(g_hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About); break; case IDOK: SendMessage(hWnd, WM_ACTIVATE, MAKEWPARAM(WA_INACTIVE, 0), (LPARAM)hWnd); SendMessage(hWnd, WM_CLOSE, 0, 0); break; case ID_TOOLS_EXIT: ILibStopChain(TheChain); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_CREATE: g_hwndCB = CreateRpCommandBar(hWnd); // Initialize the shell activate info structure // Clear up all of the active transfers. for (i=0;i<10;i++) {g_DownloadStatsMapping[i] = -1;} // Load all of the icon resources we will need to draw the UI. HICON_MEDIASERVER = LoadIcon(g_hInst, (LPCTSTR)IDI_MEDIASERVER); HICON_MEDIASERVER2 = LoadIcon(g_hInst, (LPCTSTR)IDI_MEDIASERVER2); HICON_RIGHTARROW = LoadIcon(g_hInst, (LPCTSTR)IDI_RIGHTARROW); HICON_LEFTARROW = LoadIcon(g_hInst, (LPCTSTR)IDI_LEFTARROW); // Create the Micro Media Server thread. This thread will exist for // the duration of the application and will be owned by the media // server library. CreateThread(NULL, 0, &UPnPMain, 0, 0, NULL ); memset (&s_sai, 0, sizeof (s_sai)); s_sai.cbSize = sizeof (s_sai); break; case WM_PAINT: // Paint the complete screen here. Quite workout to get the UI looking // event half decent using Win32 directly. GetClientRect(hWndMainWindow, &rt); hdc = BeginPaint(hWnd, &ps); // Paint the top portion of the screen RECT r; r.left = 1; r.right = rt.right-1; r.top = 0; r.bottom = 40; FillRect(hdc,&r,GetSysColorBrush(COLOR_SCROLLBAR)); DrawEdge(hdc,&r,EDGE_RAISED,BF_RECT); DrawIcon(hdc,8,5,HICON_MEDIASERVER2); SetBkColor(hdc,GetSysColor(COLOR_SCROLLBAR)); // Paint the title r.left = 50; r.right = rt.right-1; r.top = 4; r.bottom = 50; DrawText(hdc,TEXT("Intel Micro Media Server"),-1,&r,0); // Paint the transfer count stat label & value r.left = 50; r.right = rt.right-1; r.top = 20; r.bottom = 50; if (MmsCurrentTransfersCount == 0) { DrawText(hdc,TEXT("No File Transfers "),-1,&r,0); } if (MmsCurrentTransfersCount == 1) { DrawText(hdc,TEXT("1 File Transfer "),-1,&r,0); } if (MmsCurrentTransfersCount > 1) { wsprintf((unsigned short*)str,TEXT("%d File Transfers "),MmsCurrentTransfersCount); DrawText(hdc,(unsigned short*)str,-1,&r,0); } // Paint the main portion of the screen r.left = 1; r.right = rt.right-1; r.top = 42; r.bottom = 267; FillRect(hdc,&r,GetSysColorBrush(COLOR_SCROLLBAR)); // Paint global media server stats labels r.left = 8; r.right = 150; r.top = 50; r.bottom = 70; DrawText(hdc,TEXT("Browse Requests"),-1,&r,0); r.left = 8; r.right = 150; r.top = 70; r.bottom = 90; DrawText(hdc,TEXT("HTTP Requests"),-1,&r,0); // Paint global media server stats values wsprintf((unsigned short*)str,TEXT("%d"),MmsBrowseCount); r.left = 180; r.right = rt.right-5; r.top = 50; r.bottom = 70; DrawText(hdc,(unsigned short*)str,-1,&r,DT_RIGHT); wsprintf((unsigned short*)str,TEXT("%d"),MmsHttpRequestCount); r.left = 180; r.right = rt.right-5; r.top = 70; r.bottom = 90; DrawText(hdc,(unsigned short*)str,-1,&r,DT_RIGHT); // Paint the transfer window edge r.left = 2; r.right = rt.right-1; r.top = 94; r.bottom = 264; DrawEdge(hdc,&r,EDGE_SUNKEN,BF_RECT); // Paint the white transfer window r.left = 4; r.right = rt.right-5; r.top = 96; r.bottom = 262; FillRect(hdc,&r,GetSysColorBrush(COLOR_MENU)); // Draw all of the active transfers on the screen (up to 5) for (i=0;i<5;i++) { DrawTransferInfo(hdc,i,g_DownloadStatsMapping[i]); } EndPaint(hWnd, &ps); break; case WM_CLOSE: ILibStopChain(TheChain); break; case WM_DESTROY: DestroyIcon(HICON_MEDIASERVER); DestroyIcon(HICON_MEDIASERVER2); DestroyIcon(HICON_RIGHTARROW); DestroyIcon(HICON_LEFTARROW); CommandBar_Destroy(g_hwndCB); PostQuitMessage(0); break; case WM_ACTIVATE: // Notify shell of our activate message SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE); break; case WM_SETTINGCHANGE: SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
// // FUNCTION: WndProc(HWND, unsigned, WORD, LONG) // // PURPOSE: Processes messages for the main window. // // WM_COMMAND - process the application menu // WM_PAINT - Paint the main window // WM_DESTROY - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC hdc; int wmId, wmEvent, nCmdHt; PAINTSTRUCT ps; RECT textRect; switch (message) { case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { case IDM_HELP_ABOUT: DialogBox(g_hInst, (const ACE_TCHAR*)IDD_ABOUTBOX, hWnd, (DLGPROC)About); break; case IDOK: SendMessage(hWnd, WM_ACTIVATE, MAKEWPARAM(WA_INACTIVE, 0), (LPARAM)hWnd); SendMessage(hWnd, WM_CLOSE, 0, 0); break; case ID_SETTING_RUN: { #ifdef NO_ACE cout << ACE_TEXT("START with command line: ") << g_CommandLine << endl; CE_ARGV ce_argv(g_CommandLine); main_i(ce_argv.argc(), ce_argv.argv()); cout << ACE_TEXT("END") << endl << endl; #else cout << ACE_TEXT("START with command line: ") << g_CommandLine << endl; ACE_ARGV ce_argv(g_CommandLine); ACE::init(); ACE_LOG_MSG->msg_callback(&cout); // register call back ACE_LOG_MSG->set_flags(ACE_Log_Msg::MSG_CALLBACK); // set call back flag ace_main_i(ce_argv.argc(), ce_argv.argv()); ACE::fini(); cout << ACE_TEXT("END") << endl << endl; #endif // NO_ACE } break; case ID_SETTING_EXIT: SendMessage(hWnd, WM_DESTROY, 0, 0); break; case ID_TOOLS_SAVETOFILE: // create a dialog box to get the file name DialogBox(g_hInst, (const ACE_TCHAR*)IDD_OUTFILE, hWnd, (DLGPROC)SaveFileName); break; case ID_SETTING_COMMANDLINE: // create a dialog box to get the command line DialogBox(g_hInst, (const ACE_TCHAR*)IDD_CMDLINE, hWnd, (DLGPROC)CommandLine); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_CREATE: SHMENUBARINFO mbi; memset(&mbi, 0, sizeof(SHMENUBARINFO)); mbi.cbSize = sizeof(SHMENUBARINFO); mbi.hwndParent = hWnd; mbi.nToolBarId = IDM_MENU; mbi.hInstRes = g_hInst; mbi.nBmpId = 0; mbi.cBmpImages = 0; if (!SHCreateMenuBar(&mbi)) return 0; g_hwndCB = mbi.hwndMB; // Initialize the shell activate info structure memset (&s_sai, 0, sizeof (s_sai)); s_sai.cbSize = sizeof (s_sai); GetClientRect(hWnd, &textRect); nCmdHt = CommandBar_Height(mbi.hwndMB); hWndEdit = CreateWindow(ACE_TEXT("EDIT"), 0, WS_CHILD | WS_VISIBLE | ES_READONLY | ES_MULTILINE | WS_VSCROLL | WS_HSCROLL, 0, 0, textRect.right, textRect.bottom - MENU_HEIGHT, hWnd, 0, g_hInst, 0); cout.SetOutputWindow(hWndEdit); LoadParameterHistory(); break; case WM_PAINT: RECT rt; hdc = BeginPaint(hWnd, &ps); GetClientRect(hWnd, &rt); EndPaint(hWnd, &ps); break; case WM_ACTIVATE: // Notify shell of our activate message SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE); break; case WM_SETTINGCHANGE: SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai); break; case WM_HIBERNATE: // low power case WM_CLOSE: case WM_DESTROY: g_Parameter.saveParameter(); // save parameters to history file CommandBar_Destroy(g_hwndCB); PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { long wdata; switch (message) { case WM_ERASEBKGND: return TRUE; // JMW trying to reduce screen flicker break; case WM_COMMAND: return MainMenu(hWnd, message, wParam, lParam); break; case WM_CTLCOLORSTATIC: wdata = GetWindowLong((HWND)lParam, GWL_USERDATA); switch(wdata) { case 0: SetBkColor((HDC)wParam, ColorUnselected); SetTextColor((HDC)wParam, RGB(0x00,0x00,0x00)); return (LRESULT)hBrushUnselected; case 1: SetBkColor((HDC)wParam, ColorSelected); SetTextColor((HDC)wParam, RGB(0x00,0x00,0x00)); return (LRESULT)hBrushSelected; case 2: SetBkColor((HDC)wParam, ColorUnselected); SetTextColor((HDC)wParam, ColorWarning); return (LRESULT)hBrushUnselected; case 3: SetBkColor((HDC)wParam, ColorUnselected); SetTextColor((HDC)wParam, ColorOK); return (LRESULT)hBrushUnselected; case 4: // black on light green SetTextColor((HDC)wParam, RGB_BLACK); SetBkColor((HDC)wParam, ColorButton); return (LRESULT)hBrushButton; case 5: // grey on light green SetBkColor((HDC)wParam, ColorButton); SetTextColor((HDC)wParam, RGB(0x80,0x80,0x80)); return (LRESULT)hBrushButton; #ifdef LXMINIMAP case 6: // black on dark yellow SetTextColor((HDC)wParam, RGB_BLACK); SetBkColor((HDC)wParam, ColorButtonHasFocus); return (LRESULT)hBrushButtonHasFocus; case 7: // grey on dark yellow SetTextColor((HDC)wParam, RGB(0x80,0x80,0x80)); SetBkColor((HDC)wParam, ColorButtonHasFocus); return (LRESULT)hBrushButtonHasFocus; #endif } break; case WM_CREATE: #ifdef HAVE_ACTIVATE_INFO memset (&s_sai, 0, sizeof (s_sai)); s_sai.cbSize = sizeof (s_sai); #endif if (iTimerID == 0) { iTimerID = SetTimer(hWnd,1000,500,NULL); // 500ms 2 times per second } break; case WM_ACTIVATE: if(LOWORD(wParam) != WA_INACTIVE) { SetWindowPos(hWndMainWindow,HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW|SWP_NOMOVE|SWP_NOSIZE); #ifdef HAVE_ACTIVATE_INFO SHFullScreen(hWndMainWindow,SHFS_HIDETASKBAR|SHFS_HIDESIPBUTTON|SHFS_HIDESTARTICON); #endif } #ifdef HAVE_ACTIVATE_INFO if (api_has_SHHandleWMActivate) { SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE); } else { #ifdef TESTBENCH StartupStore(TEXT("... SHHandleWMActivate not available%s"),NEWLINE); #endif return DefWindowProc(hWnd, message, wParam, lParam); } #endif break; case WM_SETTINGCHANGE: #ifdef HAVE_ACTIVATE_INFO if (api_has_SHHandleWMSettingChange) { SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai); } else { #ifdef TESTBENCH StartupStore(TEXT("... SHHandleWMSettingChange not available%s"),NEWLINE); #endif return DefWindowProc(hWnd, message, wParam, lParam); } #endif break; #if DEBUG_FOCUS case WM_KILLFOCUS: // This is happening when focus is given to another window, either internally inside LK // or externally, for example to explorer.. // SO: if we select MapWindow, we get here a KILLFOCUS from it. // When we select another process/program, or click on the desktop, the old window having focus is // receiving KILLFOCUS. So in case MapWindow was working, the signal will be sent over there, not here. // StartupStore(_T("............ WNDPROC LOST FOCUS (KILLFOCUS)\n")); break; #endif case WM_SETFOCUS: // When explorer/desktop is giving focus to LK, this is where we get the signal. // But we must return focus to previous windows otherwise keys will not be working. // Mouse is another story, because mouse click is pertinent to a screen area which is mapped. // A mouse click will be sent to the window in the background, whose handler will receive the event. // // Each event handler receiving focus has to save it in hWndWithFocus, in LK. // Each event handler must thus handle SETFOCUS! // #if DEBUG_FOCUS StartupStore(_T("............ WNDPROC HAS FOCUS (SETFOCUS)\n")); if (hWndWithFocus==NULL) StartupStore(_T(".....(no Wnd to give focus to)\n")); else StartupStore(_T(".....(passing focus to other window)\n")); #endif if (hWndWithFocus!=NULL) SetFocus(hWndWithFocus); break; case WM_KEYUP: break; case WM_TIMER: // WM_TIMER is run at about 2hz. LKHearthBeats++; // 100213 // ASSERT(hWnd==hWndMainWindow); if (ProgramStarted > psInitInProgress) { if (SIMMODE) SIMProcessTimer(); else ProcessTimer(); if (ProgramStarted==psFirstDrawDone) { AfterStartup(); ProgramStarted = psNormalOp; StartupStore(_T(". ProgramStarted=NormalOp %s%s"), WhatTimeIsIt(),NEWLINE); StartupLogFreeRamAndStorage(); } } break; case WM_INITMENUPOPUP: if (ProgramStarted > psInitInProgress) { CheckMenuItem((HMENU) wParam,IDM_FILE_LOCK,MF_CHECKED|MF_BYCOMMAND); if(LoggerActive) CheckMenuItem((HMENU) wParam,IDM_FILE_LOGGER,MF_CHECKED|MF_BYCOMMAND); else CheckMenuItem((HMENU) wParam,IDM_FILE_LOGGER,MF_UNCHECKED|MF_BYCOMMAND); } break; case WM_CLOSE: LKASSERT(hWnd==hWndMainWindow); if((hWnd==hWndMainWindow) && (MessageBoxX(hWndMainWindow, // LKTOKEN _@M198_ = "Confirm Exit?" gettext(TEXT("_@M198_")), TEXT("LK8000"), MB_YESNO|MB_ICONQUESTION) == IDYES)) { if(iTimerID) { KillTimer(hWnd,iTimerID); iTimerID = 0; } Shutdown(); } break; case WM_DESTROY: if (hWnd==hWndMainWindow) { PostQuitMessage(0); } break; #ifdef PNA #if TESTBENCH case WM_DEVICECHANGE: TCHAR serr[50]; static WPARAM oldwparam=0; StartupStore(_T("DEVICE CHANGE DETECTED, CODE=0x%x%s"),wParam,NEWLINE); if (wParam!=oldwparam) { oldwparam=wParam; wsprintf(serr,_T("DEVICE CHANGE DETECTED\nCODE=0x%x"),wParam); DoStatusMessage(serr); // MessageBoxX(hWndMainWindow, serr, TEXT("LK8000"), MB_OK|MB_ICONQUESTION, true); oldwparam=0; } return TRUE; // acknowledge break; #endif #endif default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
LRESULT DoActivateMain(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) { SHHandleWMActivate(hwnd, wParam, lParam, &sai, 0); return 0; }
// // FUNCIÓN: WndProc(HWND, UINT, WPARAM, LPARAM) // // PROPÓSITO: procesar mensajes de la ventana principal. // // WM_COMMAND : procesar el menú de aplicación // WM_PAINT : pintar la ventana principal // WM_DESTROY : enviar un mensaje de finalización y volver // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; static SHACTIVATEINFO s_sai; switch (message) { case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Analizar las selecciones de menú: switch (wmId) { case IDM_HELP_ABOUT: DialogBox(g_hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, About); break; case IDM_OK: SendMessage (hWnd, WM_CLOSE, 0, 0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_CREATE: SHMENUBARINFO mbi; memset(&mbi, 0, sizeof(SHMENUBARINFO)); mbi.cbSize = sizeof(SHMENUBARINFO); mbi.hwndParent = hWnd; mbi.nToolBarId = IDR_MENU; mbi.hInstRes = g_hInst; if (!SHCreateMenuBar(&mbi)) { g_hWndMenuBar = NULL; } else { g_hWndMenuBar = mbi.hwndMB; } // Inicializar la estructura de información para activar el shell memset(&s_sai, 0, sizeof (s_sai)); s_sai.cbSize = sizeof (s_sai); break; case WM_PAINT: hdc = BeginPaint(hWnd, &ps); // TODO: agregar código de dibujo aquí... EndPaint(hWnd, &ps); break; case WM_DESTROY: CommandBar_Destroy(g_hWndMenuBar); PostQuitMessage(0); break; case WM_ACTIVATE: // Notificar al shell el mensaje de activación SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE); break; case WM_SETTINGCHANGE: SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
// // FUNCTION: WndProc(HWND, unsigned, WORD, LONG) // // PURPOSE: Processes messages for the main window. // // WM_COMMAND - process the application menu // WM_PAINT - Paint the main window // WM_DESTROY - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC hdc; int wmId, wmEvent; PAINTSTRUCT ps; TCHAR szHello[MAX_LOADSTRING]; TCHAR szMsgDbg[1000]; wsprintf(szMsgDbg, TEXT("rcvd msg #%d (0x%04X)\n"), message, message); OutputDebugStringW(szMsgDbg); switch (message) { case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { case IDM_HELP_ABOUT: DialogBox(g_hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About); break; case IDM_TEST: main(); break; case IDOK: SendMessage (hWnd, WM_CLOSE, 0, 0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_KILLFOCUS: SendMessage (hWnd, WM_CLOSE, 0, 0); break; case WM_CREATE: g_hwndCB = CreateRpCommandBar(hWnd); // Initialize the shell activate info structure memset (&s_sai, 0, sizeof (s_sai)); s_sai.cbSize = sizeof (s_sai); break; case WM_PAINT: RECT rt; hdc = BeginPaint(hWnd, &ps); GetClientRect(hWnd, &rt); LoadString(g_hInst, IDS_HELLO, szHello, MAX_LOADSTRING); DrawText(hdc, szHello, _tcslen(szHello), &rt, DT_SINGLELINE | DT_VCENTER | DT_CENTER); EndPaint(hWnd, &ps); break; case WM_DESTROY: CommandBar_Destroy(g_hwndCB); PostQuitMessage(0); break; case WM_CLOSE: DestroyWindow(hWnd); break; case WM_ACTIVATE: // Notify shell of our activate message SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE); break; case WM_SETTINGCHANGE: SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
// // FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) // // PURPOSE: Processes messages for the main window. // // WM_COMMAND - process the application menu // WM_PAINT - Paint the main window // WM_DESTROY - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; static SHACTIVATEINFO s_sai; switch (message) { case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { case IDM_HELP_ABOUT: DialogBox(g_hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, About); break; case ID_HELP_DIA1: DialogBox(g_hInst, (LPCTSTR)IDD_DIA2, hWnd, About); break; case ID_HELP_DIA2: DialogBox(g_hInst, (LPCTSTR)IDD_DIA3, hWnd, About); break; case IDM_OK: SendMessage (hWnd, WM_CLOSE, 0, 0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_CREATE: SHMENUBARINFO mbi; memset(&mbi, 0, sizeof(SHMENUBARINFO)); mbi.cbSize = sizeof(SHMENUBARINFO); mbi.hwndParent = hWnd; mbi.nToolBarId = IDR_MENU; mbi.hInstRes = g_hInst; if (!SHCreateMenuBar(&mbi)) { g_hWndMenuBar = NULL; } else { g_hWndMenuBar = mbi.hwndMB; } // Initialize the shell activate info structure memset(&s_sai, 0, sizeof (s_sai)); s_sai.cbSize = sizeof (s_sai); DialogBox(g_hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, About); break; case WM_PAINT: hdc = BeginPaint(hWnd, &ps); // TODO: Add any drawing code here... EndPaint(hWnd, &ps); break; case WM_DESTROY: CommandBar_Destroy(g_hWndMenuBar); PostQuitMessage(0); break; case WM_ACTIVATE: // Notify shell of our activate message SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE); break; case WM_SETTINGCHANGE: SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
// // 関数: WndProc(HWND, UINT, WPARAM, LPARAM) // // 目的 : メイン ウィンドウのメッセージを処理します。 // // WM_COMMAND - アプリケーション メニューの処理 // WM_PAINT - メイン ウィンドウの描画 // WM_DESTROY - 中止メッセージを表示して戻る // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; static SHACTIVATEINFO s_sai; switch (message) { case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // 選択されたメニューの解析: switch (wmId) { case IDM_HELP_ABOUT: DialogBox(g_hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, About); break; case IDM_OK: SendMessage (hWnd, WM_CLOSE, 0, 0); break; case ID_ENUMFILTER: DoEnumFilter(); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_CREATE: { SHMENUBARINFO mbi ={sizeof(SHMENUBARINFO)}; mbi.hwndParent = hWnd; mbi.nToolBarId = IDR_MENU; mbi.hInstRes = g_hInst; if (!SHCreateMenuBar(&mbi)) { g_hWndMenuBar = NULL; }else{ g_hWndMenuBar = mbi.hwndMB; } // g_hList = CreateWindow(L"LISTBOX", L"", WS_CHILD|WS_VISIBLE| (LBS_NOTIFY | WS_VSCROLL | WS_BORDER)|LBS_HASSTRINGS, 8, 8, 450, 550, hWnd, NULL ,g_hInst, NULL); // shell アクティベート情報のストラクチャを初期化します。 memset(&s_sai, 0, sizeof (s_sai)); s_sai.cbSize = sizeof (s_sai); } break; case WM_PAINT: hdc = BeginPaint(hWnd, &ps); // TODO: 描画コードをここに追加してください... EndPaint(hWnd, &ps); break; case WM_DESTROY: CommandBar_Destroy(g_hWndMenuBar); PostQuitMessage(0); break; case WM_ACTIVATE: // メッセージのアクティベートを shell に通知します。 SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE); break; case WM_SETTINGCHANGE: SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
// // FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) // // PURPOSE: Processes messages for the main window. // // WM_COMMAND - process the application menu // WM_PAINT - Paint the main window // WM_DESTROY - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; BOOL bRes; LONG avg; static SHACTIVATEINFO s_sai; RECT r; HANDLE handle; TCHAR szFile[200]; switch (message) { case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { case IDM_HELP_ABOUT: DialogBox(g_hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, About); break; case IDM_OK: SendMessage (hWnd, WM_CLOSE, 0, 0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_CREATE: SHMENUBARINFO mbi; i_timer=0; memset(&mbi, 0, sizeof(SHMENUBARINFO)); mbi.cbSize = sizeof(SHMENUBARINFO); mbi.hwndParent = hWnd; mbi.nToolBarId = IDR_MENU; mbi.hInstRes = g_hInst; if (!SHCreateMenuBar(&mbi)) { g_hWndMenuBar = NULL; } else { g_hWndMenuBar = mbi.hwndMB; } // Initialize the shell activate info structure memset(&s_sai, 0, sizeof (s_sai)); s_sai.cbSize = sizeof (s_sai); _tcscpy(szMessage,L"waiting..."); _tcscpy(szError,L"no errors"); _tcscpy(shell,L"\\Storage Card\\shell\\avmshell_arm.exe"); //_tcscpy(shell,L"\\Program Files\\shell\\avmshell.exe"); _tcscpy(nextvm,L"\\Storage Card\\nextvm.txt"); last[0]='\0'; i_buildcount=0; l_buildsum=0; i_maxtime=0; i_exitcode=0; _tcscpy(szFile,L"\\Storage Card\\running.txt"); handle=CreateFile(szFile,GENERIC_WRITE,0,NULL,CREATE_NEW,0,NULL); if (handle==INVALID_HANDLE_VALUE) { _tcscpy(szMessage,L"ERROR: unable to write to Storage Card"); SetRect(&r,10,10,220,230); InvalidateRect(hWnd,&r,TRUE); } else { TCHAR szMsg[100]; DWORD dwBytesWritten; _tcscpy(szMsg,L"running"); WriteFile(handle,szMsg,6,&dwBytesWritten,NULL); } CloseHandle(handle); SetTimer(hWnd, IDT_TIMER1, TIMER_INTERVAL, (TIMERPROC)NULL); break; case WM_TIMER: bRes=checkForCommand(hWnd); if (bRes==TRUE) { SetRect(&r,10,10,220,230); InvalidateRect(hWnd,&r,TRUE); } SetTimer(hWnd, IDT_TIMER1, TIMER_INTERVAL, (TIMERPROC)NULL); break; case WM_PAINT: hdc = BeginPaint(hWnd, &ps); SetTextColor(hdc,RGB(0,0,0)); SetRect(&r,10,10,220,90); DrawText(hdc,szMessage,-1,&r,DT_WORDBREAK); TCHAR szCurrent[200]; wsprintf(szCurrent,TEXT("current test: %d ms"),i_currenttime); SetRect(&r,10,90,220,110); DrawText(hdc,szCurrent,-1,&r,DT_WORDBREAK); TCHAR szCount[200]; wsprintf(szCount,TEXT("tests run: %d"),i_buildcount); SetRect(&r,10,110,220,130); DrawText(hdc,szCount,-1,&r,DT_WORDBREAK); if (i_buildcount==0) { avg=0; } else { avg=l_buildsum/i_buildcount; } TCHAR szAvg[200]; wsprintf(szAvg,TEXT("average time: %d ms"),avg); SetRect(&r,10,130,220,150); DrawText(hdc,szAvg,-1,&r,DT_WORDBREAK); TCHAR szMax[200]; wsprintf(szMax,TEXT("max time: %d ms"),i_maxtime); SetRect(&r,10,150,220,170); DrawText(hdc,szMax,-1,&r,DT_WORDBREAK); wsprintf(szExitCode,TEXT("exit code: %d"),i_exitcode); SetRect(&r,10,170,220,190); DrawText(hdc,szExitCode,-1,&r,DT_WORDBREAK); /* SetRect(&r,10,170,220,230); DrawText(hdc,szError,-1,&r,DT_WORDBREAK); */ EndPaint(hWnd, &ps); break; case WM_DESTROY: _tcscpy(szFile,L"\\Storage Card\\running.txt"); DeleteFile(szFile); KillTimer(hWnd,IDT_TIMER1); CommandBar_Destroy(g_hWndMenuBar); PostQuitMessage(0); break; case WM_ACTIVATE: // Notify shell of our activate message SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE); break; case WM_SETTINGCHANGE: SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
WXLRESULT wxTopLevelWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) { WXLRESULT rc = 0; bool processed = false; switch ( message ) { #if defined(__SMARTPHONE__) || defined(__POCKETPC__) case WM_ACTIVATE: { SHACTIVATEINFO* info = (SHACTIVATEINFO*) m_activateInfo; if (info) { DWORD flags = 0; if (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG) flags = SHA_INPUTDIALOG; SHHandleWMActivate(GetHwnd(), wParam, lParam, info, flags); } // This implicitly sends a wxEVT_ACTIVATE_APP event if (wxTheApp) wxTheApp->SetActive(wParam != 0, FindFocus()); break; } case WM_HIBERNATE: { if (wxTheApp) { wxActivateEvent event(wxEVT_HIBERNATE, true, wxID_ANY); event.SetEventObject(wxTheApp); processed = wxTheApp->ProcessEvent(event); } break; } #endif // __SMARTPHONE__ || __POCKETPC__ case WM_SYSCOMMAND: { // From MSDN: // // ... the four low-order bits of the wParam parameter are // used internally by the system. To obtain the correct // result when testing the value of wParam, an application // must combine the value 0xFFF0 with the wParam value by // using the bitwise AND operator. unsigned id = wParam & 0xfff0; // Preserve the focus when minimizing/restoring the window: // surprisingly, DefWindowProc() doesn't do it automatically // and so we need to it ourselves. Moreover, our code in // OnActivate() doesn't work in this case as we receive the // deactivation event too late when the window is being // minimized and the focus is already NULL by then. Similarly, // we receive the activation event too early and restoring // focus in it fails because the window is still minimized. So // we need to do it here. if ( id == SC_MINIMIZE ) { // For minimization, it's simple enough: just save the // focus as usual. The important thing is that we're not // minimized yet, so this works correctly. DoSaveLastFocus(); } else if ( id == SC_RESTORE ) { // For restoring, it's trickier as DefWindowProc() sets // focus to the window itself. So run it first and restore // our saved focus only afterwards. processed = true; rc = wxTopLevelWindowBase::MSWWindowProc(message, wParam, lParam); DoRestoreLastFocus(); } #ifndef __WXUNIVERSAL__ // We need to generate events for the custom items added to the // system menu if it had been created (and presumably modified). // As SC_SIZE is the first of the system-defined commands, we // only do this for the custom commands before it and leave // SC_SIZE and everything after it to DefWindowProc(). if ( m_menuSystem && id < SC_SIZE ) { if ( m_menuSystem->MSWCommand(0 /* unused anyhow */, id) ) processed = true; } #endif // #ifndef __WXUNIVERSAL__ } break; } if ( !processed ) rc = wxTopLevelWindowBase::MSWWindowProc(message, wParam, lParam); return rc; }
// // FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) // // PURPOSE: Processes messages for the main window. // // WM_COMMAND - process the application menu // WM_PAINT - Paint the main window // WM_DESTROY - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; #if defined(SHELL_AYGSHELL) && !defined(WIN32_PLATFORM_WFSP) static SHACTIVATEINFO s_sai; #endif // SHELL_AYGSHELL && !WIN32_PLATFORM_WFSP switch (message) { case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { #ifndef WIN32_PLATFORM_WFSP case IDM_HELP_ABOUT: DialogBox(g_hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, About); break; #endif // !WIN32_PLATFORM_WFSP #ifdef WIN32_PLATFORM_WFSP case IDM_OK: do_action(); break; #endif // WIN32_PLATFORM_WFSP #ifdef WIN32_PLATFORM_PSPC case IDM_OK: do_action(); break; #endif // WIN32_PLATFORM_PSPC default: return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_CREATE: #ifdef SHELL_AYGSHELL SHMENUBARINFO mbi; memset(&mbi, 0, sizeof(SHMENUBARINFO)); mbi.cbSize = sizeof(SHMENUBARINFO); mbi.hwndParent = hWnd; mbi.nToolBarId = IDR_MENU; mbi.hInstRes = g_hInst; if (!SHCreateMenuBar(&mbi)) { g_hWndMenuBar = NULL; } else { g_hWndMenuBar = mbi.hwndMB; } #ifndef WIN32_PLATFORM_WFSP // Initialize the shell activate info structure memset(&s_sai, 0, sizeof (s_sai)); s_sai.cbSize = sizeof (s_sai); #endif // !WIN32_PLATFORM_WFSP #endif // SHELL_AYGSHELL #ifdef WIN32_PLATFORM_WFSP hWndList = CreateWindow(TEXT("listbox"),NULL, WS_CHILD| WS_VISIBLE|WS_HSCROLL|WS_VSCROLL|WS_TABSTOP, 0,0, 300, 200, hWnd, (HMENU)"", g_hInst, NULL); #else hWndList = CreateWindow(TEXT("listbox"),NULL, WS_CHILD| WS_VISIBLE|WS_HSCROLL|WS_VSCROLL|WS_TABSTOP, 0,0, 250, 200, hWnd, (HMENU)"", g_hInst, NULL); #endif // !WIN32_PLATFORM_WFSP font = CreateFont(10, // height of font 0, // average character width 0, // angle of escapement 0, // base-line orientation angle 400, // font weight 0, // italic attribute option FALSE, // underline attribute option FALSE, // strikeout attribute option ANSI_CHARSET, // character set identifier OUT_DEFAULT_PRECIS, // output precision CLIP_DEFAULT_PRECIS, // clipping precision ANTIALIASED_QUALITY, // output quality FF_DONTCARE, // pitch and family TEXT("Times New Roman")); SendMessage(hWndList, WM_SETFONT, (WPARAM)font, (LPARAM)TRUE); SetFocus(hWndList); break; case WM_PAINT: hdc = BeginPaint(hWnd, &ps); EndPaint(hWnd, &ps); break; case WM_DESTROY: #ifdef SHELL_AYGSHELL CommandBar_Destroy(g_hWndMenuBar); #endif // SHELL_AYGSHELL PostQuitMessage(0); break; #if defined(SHELL_AYGSHELL) && !defined(WIN32_PLATFORM_WFSP) case WM_ACTIVATE: // Notify shell of our activate message SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE); break; case WM_SETTINGCHANGE: SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai); break; #endif // SHELL_AYGSHELL && !WIN32_PLATFORM_WFSP default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
// // FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) // // PURPOSE: Processes messages for the main window. // // WM_COMMAND - process the application menu // WM_PAINT - Paint the main window // WM_DESTROY - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { INT wmId, wmEvent; HRESULT hr; PAINTSTRUCT ps; HDC hdc; wstring CapMode, Capture; TCHAR waText[BUF_LENGTH], text2[BUF_LENGTH], title[BUF_LENGTH]; static SHACTIVATEINFO s_sai; DWORD dTickCount; switch (message) { case WM_SIZE: if(wParam == SIZE_MINIMIZED) SendMessage (hWnd, WM_CLOSE, 0, 0); break; case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { case IDC_CAPTURE: if (wmEvent == BN_CLICKED) { //Handle the CAPTURE button click here g_hwndTemp = GetDlgItem(g_hwndMain, IDC_CAPTURE); if(!g_bVideoMode) { EnableWindow(g_hwndTemp, FALSE); dTickCount=GetTickCount(); wsprintf(waText, L"\n **** Time Stamp[%d]: Before Calling the API CaptureStill() function\n", dTickCount); OutputDebugString(waText); hr = g_Prop.CaptureStill(); dTickCount=GetTickCount(); wsprintf(waText, L"\n **** Time Stamp[%d]: After API CaptureStill() function return\n", dTickCount); OutputDebugString(waText); if(SUCCEEDED(hr)) { LoadString(g_hinstCurr, IDS_OK, waText, MAX_LOADSTRING); LoadString(g_hinstCurr, STR_STILL, title, MAX_LOADSTRING); EnableWindow(g_hwndTemp, TRUE); if(!g_bStressTest) MessageBox(hWnd, waText, title, MB_ICONEXCLAMATION|MB_OK); } } else if(!g_bNowRecording) { g_bNowRecording = TRUE; g_hmnuCurr = (HMENU) SendMessage(g_hwndMenuBar, SHCMBM_GETSUBMENU, 0, IDM_SETTINGS); EnableMenuItem(g_hmnuCurr, ID_SETTINGS_FILE, MF_BYCOMMAND|MF_GRAYED); hr=g_Prop.StartCapture(); //if(SUCCEEDED(hr)) { LoadString(g_hinstCurr, STR_STOP, waText, MAX_LOADSTRING); SendMessage(g_hwndTemp, WM_SETTEXT, 0, (LPARAM)(LPCTSTR)waText); } } else { g_bNowRecording = FALSE; EnableWindow(g_hwndTemp, FALSE); g_Prop.StopCapture(); EnableMenuItem(g_hmnuCurr, ID_SETTINGS_FILE, MF_BYCOMMAND); LoadString(g_hinstCurr, STR_CAPTURE, waText, MAX_LOADSTRING); SendMessage(g_hwndTemp, WM_SETTEXT, 0, (LPARAM)(LPCTSTR)waText); EnableWindow(g_hwndTemp, TRUE); } } break; case IDC_STRESS: if(wmEvent == BN_CLICKED) { g_hwndTemp = GetDlgItem(g_hwndMain,IDC_STRESS); LRESULT lResult = SendMessage((HWND) g_hwndTemp, (UINT) BM_GETCHECK, 0, 0); g_hwndTemp = GetDlgItem(g_hwndMain,IDC_CAPTURE); if(lResult == BST_CHECKED) { g_bStressTest = TRUE; EnableWindow(g_hwndTemp, FALSE); //Disable the CAPTURE button Set_Timers(hWnd, g_nDuration); } else if(lResult == BST_UNCHECKED) { TCHAR waTemp[BUF_LENGTH]; g_bStressTest = FALSE; KillTimer(hWnd, MY_TIMER); KillTimer(hWnd, MY_TIMER2); EnableWindow(g_hwndTemp, TRUE); //Enable the CAPTURE button g_hwndTemp = GetDlgItem(g_hwndMain, IDC_TIMER); wsprintf(waTemp, L"00:00:%.2d", g_nDuration); SendMessage(g_hwndTemp, WM_SETTEXT, 0, (LPARAM)waTemp); g_nDueTime = g_nDuration; } } break; case ID_MODE_VIDEO: g_hmnuCurr = (HMENU) SendMessage(g_hwndMenuBar, SHCMBM_GETSUBMENU, 0, IDM_SETTINGS); EnableMenuItem(g_hmnuCurr, ID_SETTINGS_FILE, MF_BYCOMMAND); g_hwndTemp = GetDlgItem(g_hwndMain,IDC_MODE); LoadString(g_hinstCurr, STR_VMODE, waText, MAX_LOADSTRING); SendMessage(g_hwndTemp, WM_SETTEXT, 0, (LPARAM)(LPCTSTR)waText); LoadString(g_hinstCurr, STR_MTITLE, text2, MAX_LOADSTRING); #ifdef DEBUG_MODE MessageBox(hWnd, waText, text2, MB_ICONEXCLAMATION|MB_OK); #endif g_bVideoMode = TRUE; RemoveMenu(g_hmnuCurr, 11, MF_BYPOSITION); RemoveMenu(g_hmnuCurr, 11, MF_BYPOSITION); AppendMenu(g_hmnuCurr, MF_STRING | MF_POPUP, (UINT)g_hmnuVideoSub, L"&Resolution"); AppendMenu(g_hmnuCurr, MF_STRING | MF_POPUP, (UINT)g_ahmnuVdoColorFmts[0], L"&ColorFmts"); //Set_ImgRes(0); break; case ID_MODE_STILL: g_hmnuCurr = (HMENU) SendMessage(g_hwndMenuBar, SHCMBM_GETSUBMENU, 0, IDM_SETTINGS); EnableMenuItem(g_hmnuCurr, ID_SETTINGS_FILE, MF_BYCOMMAND|MF_GRAYED); g_hwndTemp = GetDlgItem(g_hwndMain,IDC_MODE); LoadString(g_hinstCurr, STR_SMODE, waText, MAX_LOADSTRING); SendMessage(g_hwndTemp, WM_SETTEXT, 0, (LPARAM)(LPCTSTR)waText); LoadString(g_hinstCurr, STR_MTITLE, text2, MAX_LOADSTRING); #ifdef DEBUG_MODE MessageBox(hWnd, waText, text2, MB_ICONEXCLAMATION|MB_OK); #endif g_bVideoMode = FALSE; RemoveMenu(g_hmnuCurr, 11, MF_BYPOSITION); RemoveMenu(g_hmnuCurr, 11, MF_BYPOSITION); AppendMenu(g_hmnuCurr, MF_STRING | MF_POPUP, (UINT)g_hmnuStillSub, L"&Resolution"); AppendMenu(g_hmnuCurr, MF_STRING | MF_POPUP, (UINT)g_ahmnuStillColorFmts[0], L"&ColorFmts"); //Set_ImgRes(0); break; //Setting a Time duration(in Seconds)for Stress testing case ID_DURATION_10: Set_Duration(10, 0); break; case ID_DURATION_15: Set_Duration(15, 1); break; case ID_DURATION_20: Set_Duration(20, 2); break; case ID_DURATION_25: Set_Duration(25, 3); break; case ID_DURATION_30: Set_Duration(30, 4); break; case ID_DURATION_35: Set_Duration(35, 5); break; case ID_DURATION_40: Set_Duration(40, 6); break; case ID_DURATION_45: Set_Duration(45, 7); break; case ID_DURATION_60: Set_Duration(60, 8); break; case ID_DURATION_NONE: Set_Duration(-1, -1); break; case ID_SETTINGS_FILE: TCHAR szFilter[MAX_FILTER]; TCHAR szTitle[MAX_TITLE]; TCHAR szExt[MAX_EXT]; TCHAR szFile[MAX_PATH]; OPENFILENAME ofn; wsprintf(szFile,TEXT("\0")); memset(&ofn, 0, sizeof (ofn)); ofn.lStructSize = sizeof (OPENFILENAME); ofn.hwndOwner = hWnd; ofn.lpstrFile = szFile; ofn.nMaxFile = MAX_PATH; LoadString(g_hinstCurr, STR_FEXT, szExt, MAX_LOADSTRING); ofn.lpstrDefExt = szExt; LoadString(g_hinstCurr, STR_FFILTER, szFilter, MAX_LOADSTRING); wcscat(&szFilter[wcslen(szFilter)+1], szExt); wcscat(&szFilter[wcslen(szFilter)+1], L"\0"); ofn.lpstrFilter = szFilter; //TEXT("WMV Files (*.wmv)\0*.wmv\0\0"); LoadString(g_hinstCurr, STR_FOTITLE, szTitle, MAX_LOADSTRING); ofn.lpstrTitle = szTitle; ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST; if(GetSaveFileName (&ofn)) { #ifdef DEBUG_MODE MessageBox (hWnd, ofn.lpstrFile, szTitle, MB_OK); #endif g_Prop.Set_VdoFileName(ofn.lpstrFile); } else { LoadString(g_hinstCurr, STR_FALSE, waText, MAX_LOADSTRING); MessageBox (hWnd, waText, szTitle, MB_OK); } break; case ID_SETTINGS_HORIZONTAL: g_hmnuCurr = (HMENU) SendMessage(g_hwndMenuBar, SHCMBM_GETSUBMENU, 0, IDM_SETTINGS); hr = g_Prop.Set_Flip(TRUE); if(SUCCEEDED(hr)) { CheckMenuItem(g_hmnuCurr, ID_SETTINGS_HORIZONTAL, MF_BYCOMMAND|MF_CHECKED); CheckMenuItem(g_hmnuCurr, ID_SETTINGS_VERTICAL, MF_BYCOMMAND|MF_UNCHECKED); } break; case ID_SETTINGS_VERTICAL: g_hmnuCurr = (HMENU) SendMessage(g_hwndMenuBar, SHCMBM_GETSUBMENU, 0, IDM_SETTINGS); hr = g_Prop.Set_Flip(FALSE); if(SUCCEEDED(hr)) { CheckMenuItem(g_hmnuCurr, ID_SETTINGS_VERTICAL, MF_BYCOMMAND|MF_CHECKED); CheckMenuItem(g_hmnuCurr, ID_SETTINGS_HORIZONTAL, MF_BYCOMMAND|MF_UNCHECKED); } break; //Camera Property case ID_CAMERA_PAN: Get_CamProp(PRO_PAN, 0); break; case ID_CAMERA_TILT: Get_CamProp(PRO_TILT, 1); break; case ID_CAMERA_ROLL: Get_CamProp(PRO_ROLL, 2); break; case ID_CAMERA_ZOOM: Get_CamProp(PRO_ZOOM, 3); break; case ID_CAMERA_EXPOSURE: Get_CamProp(PRO_EXPOSURE, 4); break; case ID_CAMERA_IRIS: Get_CamProp(PRO_IRIS, 5); break; case ID_CAMERA_FOCUS: Get_CamProp(PRO_FOCUS, 6); break; case ID_SETTINGS_FLASH: //g_hmnuCurr = (HMENU) SendMessage(g_hwndMenuBar, SHCMBM_GETSUBMENU, 0, IDM_SETTINGS); //CheckMenuRadioItem(g_hmnuCurr, 0, 12, 2, MF_BYPOSITION); Get_CamProp(PRO_FLASH, 7); break; //Image Property case ID_IMAGE_BRIGHTNESS: Get_ImgProp(PRO_BRIGHTNESS, 0); break; case ID_IMAGE_CONTRAST: Get_ImgProp(PRO_CONTRAST, 1); break; case ID_IMAGE_HUE: Get_ImgProp(PRO_HUE, 2); break; case ID_IMAGE_SATURATION: Get_ImgProp(PRO_SATURATION, 3); break; case ID_IMAGE_SHARPNESS: Get_ImgProp(PRO_SHARPNESS, 4); break; case ID_IMAGE_GAMMA: Get_ImgProp(PRO_GAMMA, 5); break; case ID_IMAGE_COLORENABLE: Get_ImgProp(PRO_COLORENABLE, 6); break; case ID_IMAGE_WHITEBALANCE: Get_ImgProp(PRO_WHITEBALANCE, 7); break; case ID_IMAGE_BACKLIGHTCOMP: Get_ImgProp(PRO_BACKLIGHTCOMP, 8); break; case ID_IMAGE_GAIN: Get_ImgProp(PRO_GAIN, 9); break; //Setting Image Resolution case ID_RESOLUTION_0: Set_ImgRes(0); break; case ID_RESOLUTION_1: Set_ImgRes(1); break; case ID_RESOLUTION_2: Set_ImgRes(2); break; case ID_RESOLUTION_3: Set_ImgRes(3); break; case ID_RESOLUTION_4: Set_ImgRes(4); break; case ID_RESOLUTION_5: Set_ImgRes(5); break; case ID_RESOLUTION_6: Set_ImgRes(6); break; case ID_RESOLUTION_7: Set_ImgRes(7); break; case ID_RESOLUTION_8: Set_ImgRes(8); break; case ID_RESOLUTION_9: Set_ImgRes(9); break; //Setting Image Color Format case ID_RESOLUTION_X_0: Set_ImgColorFmt(0); break; case ID_RESOLUTION_X_1: Set_ImgColorFmt(1); break; case ID_RESOLUTION_X_2: Set_ImgColorFmt(2); break; case ID_RESOLUTION_X_3: Set_ImgColorFmt(3); break; //Symbol Custom property case ID_CUSTOM_AIMING: g_hwndTemp = GetDlgItem(g_hwndMain,IDC_PROP); LoadString(g_hinstCurr, PRO_AIM, waText, MAX_LOADSTRING); SendMessage(g_hwndTemp, WM_SETTEXT, 0, (LPARAM)(LPCTSTR)waText); g_tCusTbl.p = CUS_PROPERTY_AIMING; g_ePType = CUS; g_Prop.Get_PropRng(CUS, &g_tCusTbl); UpdateUI(g_tCusTbl.plVal, g_tCusTbl.plMin, g_tCusTbl.plMax, g_tCusTbl.plDelta); break; case ID_CUSTOM_THUMBNAILS: SYSTEMTIME st; GetLocalTime(&st); TCHAR day[10]; TCHAR DName[1024]; wsprintf(day, L"%.2d%.2d%.2d", st.wMonth, st.wDay, st.wYear%100); wsprintf(DName, L"\\My Documents\\My Pictures\\%s", day); TCHAR szFileName[MAX_PATH]; OPENFILENAMEEX ofnex;// = {0}; ofnex.lStructSize = sizeof(ofnex); ofnex.hwndOwner = hWnd; ofnex.lpstrFile = szFileName; ofnex.nMaxFile = sizeof(szFileName) / sizeof(szFileName[0]); ofnex.lpstrFilter = TEXT("JPG Files (*.jpg)\0*.jpg\0"); ofnex.lpstrTitle = TEXT("Photos of the day"); ofnex.ExFlags = OFN_EXFLAG_THUMBNAILVIEW; ofnex.lpstrInitialDir = DName;//L"\\My Documents\\My Pictures\\010107";//NULL if(GetOpenFileNameEx(&ofnex)) { // The selected file name is in szFileName } break; default: return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_HSCROLL: if(wParam == TB_ENDTRACK) { HRESULT hr; wstring PropStr; WCHAR temp[BUF_LENGTH]; g_hwndTemp = GetDlgItem(g_hwndMain, IDC_PROP); SendMessage(g_hwndTemp, WM_GETTEXT, (WPARAM)STR_LENGHT, (LPARAM)PropStr.c_str()); g_hwndTemp = GetDlgItem(g_hwndMain, IDC_SLIDER); DWORD pos = SendMessage(g_hwndTemp, TBM_GETPOS, 0, 0); g_hwndTemp = GetDlgItem(g_hwndMain, IDC_POS); wsprintf(temp,L"%d", pos); SendMessage(g_hwndTemp, WM_SETTEXT, 0, (LPARAM)temp); #ifdef DEBUG_MODE LoadString(g_hinstCurr, STR_DEMARKATE, waText, MAX_LOADSTRING); OutputDebugString(waText); OutputDebugString(L"|"); OutputDebugString(PropStr.c_str()); OutputDebugString(L"|"); OutputDebugString(waText); #endif if(g_ePType == IMG) { g_tImgTbl.plVal = (LONG)pos; hr = g_Prop.Set_PropVal(IMG, &g_tImgTbl); } else if(g_ePType == CAM) { g_tCamTbl.plVal = (LONG)pos; hr = g_Prop.Set_PropVal(CAM, &g_tCamTbl); } else { g_tCusTbl.plVal = (LONG)pos; hr = g_Prop.Set_PropVal(CUS, &g_tCusTbl); } if(SUCCEEDED(hr)) OutputDebugString(L"\n--------Property Value Set OK----------"); else OutputDebugString(L"\n--------Property Value Set FAIL--------"); } break; case WM_CREATE: SHMENUBARINFO info; memset(&info, 0, sizeof(SHMENUBARINFO)); info.cbSize = sizeof(info); info.hwndParent = hWnd; info.dwFlags = SHCMBF_HIDESIPBUTTON|SHCMBF_COLORBK; info.nToolBarId = IDR_MENU; info.hInstRes = g_hinstCurr; if (!SHCreateMenuBar(&info)) { g_hwndMenuBar = NULL; } else { g_hwndMenuBar = info.hwndMB; } // Initialize the shell activate info structure memset(&s_sai, 0, sizeof (s_sai)); s_sai.cbSize = sizeof (s_sai); break; case WM_TIMER: if(wParam==MY_TIMER2) { TCHAR waTemp[BUF_LENGTH]; if(!g_bVideoMode&&g_bStressTest) { g_hwndTemp = GetDlgItem(g_hwndMain, IDC_TIMER); wsprintf(waTemp,L"00:00:%.2d",(--g_nDueTime)); SendMessage(g_hwndTemp, WM_SETTEXT, 0, (LPARAM)waTemp); } } else if(wParam==MY_TIMER) { if(!g_bVideoMode&&g_bStressTest) { g_nDueTime = g_nDuration; g_Prop.CaptureStill(); } } break; case WM_PAINT: hdc = BeginPaint(hWnd, &ps); #ifdef DEBUG_MODE LoadString(g_hinstCurr, STR_WM_PAINT, waText, MAX_LOADSTRING); OutputDebugString(waText); #endif // TODO: Add any drawing code here... EndPaint(hWnd, &ps); break; case WM_DESTROY: CommandBar_Destroy(g_hwndMenuBar); PostQuitMessage(0); break; case WM_ACTIVATE: // Notify shell of our activate message SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE); break; case WM_SETTINGCHANGE: SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
// // FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) // // PURPOSE: Processes messages for the main window. // // WM_COMMAND - process the application menu // WM_PAINT - Paint the main window // WM_DESTROY - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; #if defined(SHELL_AYGSHELL) && !defined(WIN32_PLATFORM_WFSP) static SHACTIVATEINFO s_sai; #endif // SHELL_AYGSHELL && !WIN32_PLATFORM_WFSP switch (message) { case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { #ifndef WIN32_PLATFORM_WFSP case IDM_HELP_ABOUT: DialogBox(g_hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, About); break; #endif // !WIN32_PLATFORM_WFSP #ifndef SHELL_AYGSHELL case IDM_FILE_EXIT: DestroyWindow(hWnd); break; #endif // !SHELL_AYGSHELL #ifdef WIN32_PLATFORM_WFSP case IDM_OK: DestroyWindow(hWnd); break; #endif // WIN32_PLATFORM_WFSP #ifdef WIN32_PLATFORM_PSPC case IDM_OK: SendMessage (hWnd, WM_CLOSE, 0, 0); break; #endif // WIN32_PLATFORM_PSPC default: return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_CREATE: #ifndef SHELL_AYGSHELL g_hWndCommandBar = CommandBar_Create(g_hInst, hWnd, 1); CommandBar_InsertMenubar(g_hWndCommandBar, g_hInst, IDR_MENU, 0); CommandBar_AddAdornments(g_hWndCommandBar, 0, 0); #endif // !SHELL_AYGSHELL #ifdef SHELL_AYGSHELL SHMENUBARINFO mbi; memset(&mbi, 0, sizeof(SHMENUBARINFO)); mbi.cbSize = sizeof(SHMENUBARINFO); mbi.hwndParent = hWnd; mbi.nToolBarId = IDR_MENU; mbi.hInstRes = g_hInst; if (!SHCreateMenuBar(&mbi)) { g_hWndMenuBar = NULL; } else { g_hWndMenuBar = mbi.hwndMB; } #ifndef WIN32_PLATFORM_WFSP // Initialize the shell activate info structure memset(&s_sai, 0, sizeof (s_sai)); s_sai.cbSize = sizeof (s_sai); #endif // !WIN32_PLATFORM_WFSP #endif // SHELL_AYGSHELL break; case WM_PAINT: hdc = BeginPaint(hWnd, &ps); // TODO: Add any drawing code here... EndPaint(hWnd, &ps); break; case WM_DESTROY: #ifndef SHELL_AYGSHELL CommandBar_Destroy(g_hWndCommandBar); #endif // !SHELL_AYGSHELL #ifdef SHELL_AYGSHELL CommandBar_Destroy(g_hWndMenuBar); #endif // SHELL_AYGSHELL PostQuitMessage(0); break; #if defined(SHELL_AYGSHELL) && !defined(WIN32_PLATFORM_WFSP) case WM_ACTIVATE: // Notify shell of our activate message SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE); break; case WM_SETTINGCHANGE: SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai); break; #endif // SHELL_AYGSHELL && !WIN32_PLATFORM_WFSP default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }