static void status_OnCommand( HWND hwnd, int id, HWND hctl, UINT codeNotify) { char buffer[255]; struct statusWindowData *theData; theData = (struct statusWindowData *) GetWindowLongPtr(hwnd,GWLP_USERDATA); if (theData == NULL) { return; } switch (id) { case ID_FILE_PRINT: sprintf(buffer,"%s Window",theData->baseName); PrintWindowDriver(GetWindowInstance(hMainFrame),hwnd,buffer); return; case ID_FILE_SAVE: case ID_FILE_SAVE_AS: SaveStatusWindow(hwnd); return; } FORWARD_WM_COMMAND(hwnd,id,hctl,codeNotify,DefMDIChildProc); }
LOCAL void Slider_OnTimer(HWND hWindow, UINT id) /***********************************************************************/ { POINT ptPosition; int Value; BOOL bPaint; LPSLIDERINFO lpInfo = Slider_GetInfo (hWindow); if (lpInfo) { bPaint = FALSE; GetCursorPos (&ptPosition); ScreenToClient (hWindow,&ptPosition); Value = Slider_ValueFromPoint (hWindow,ptPosition,lpInfo); if (Value < lpInfo->Value) bPaint = Slider_DecrementValue (lpInfo); else if (Value > lpInfo->Value) bPaint = Slider_IncrementValue (lpInfo); Slider_PointFromValue (hWindow,lpInfo->Value,&lpInfo->ptPosition,lpInfo); if (bPaint) { FORWARD_WM_COMMAND(GetParent(hWindow), GetDlgCtrlID(hWindow), hWindow, SN_VALUECHANGING, SendMessage); InvalidateRect (hWindow,NULL,FALSE); UpdateWindow (hWindow); } } }
void MixTest_OnCommand(HWND hWnd, int id, HWND hwndCtl, UINT codeNotify) { ODSN("MixTest_OnCommand"); switch (id) { case IDM_AUTO: gfAuto = !gfAuto; if (gfAuto) { SetMenu(hWnd,ghMenu2); SetTimer(hWnd,1,100,NULL); } else { KillTimer(hWnd,1); SetMenu(hWnd,ghMenu1); } break; case IDM_ABOUT: DialogBox(ghInst,"AboutBox",hWnd,AboutDlgProc); break; default: FORWARD_WM_COMMAND(hWnd, id, hwndCtl, codeNotify, DefWindowProc); } }
static void Video_OnLButtonDown(HWND hWindow, BOOL fDoubleClick, int x, int y, UINT keyFlags) /***********************************************************************/ { LPVIDEO lpVideo; RECT rWindow; if ( SHIFT ) return; if ( bTrack ) return; SetCapture( hWindow ); bTrack = TRUE; #ifdef _DEBUG if ( GetFocus() != hWindow ) SetFocus( hWindow ); #endif if ( !(lpVideo = (LPVIDEO)GetWindowLong( hWindow, GWL_DATAPTR )) ) return; if ( !lpVideo->lpAllShots ) // if no jump table... { FORWARD_WM_COMMAND( GetParent(hWindow), GET_WINDOW_ID(hWindow), 0, 0, SendMessage ); return; } // Process the proper event based on the "hotspot" that was clicked GetClientRect( hWindow, &rWindow ); x = (x * 10) / RectWidth( &rWindow ); y = (y * 10) / RectHeight( &rWindow ); int iEventCode = PtInHotspot( lpVideo, x, y, YES ); if ( iEventCode ) Video_ProcessEvent( hWindow, lpVideo, iEventCode ); }
//*************************************************************************** UINT Story_OnMCINotify( HWND hWindow, UINT codeNotify, HMCI hDevice ) //*************************************************************************** { PSTORY pStory = GetStory(hWindow); switch( codeNotify ) { case MCI_NOTIFY_SUCCESSFUL: { if (pStory && pStory->m_fPlaying) { pStory->Reset(); FORWARD_WM_COMMAND(GetParent(hWindow), GET_WINDOW_ID(hWindow), hWindow, 2, SendMessage); } return FALSE; } case MCI_NOTIFY_ABORTED: // wParam == 4 { // aborted msg sent during playback, if we get a // seek, step, stop, or full screen playback escape command. // continue playing after a seek or step, unless // escaping from a full screen playback return( FALSE ); } case MCI_NOTIFY_SUPERSEDED: // wParam == 2 case MCI_NOTIFY_FAILURE: // wParam == 8 { // superseded msg sent during playback if we get a new play command return( FALSE ); } } return( FALSE ); }
//************************************************************************ void CNutDropScene::OnLButtonDown (HWND hWnd, BOOL fDoubleClick, int x, int y, UINT keyFlags) //************************************************************************ { if (m_SoundPlaying == IntroPlaying) { m_SoundPlaying = NotPlaying; m_pSound->StopChannel (NORMAL_CHANNEL); StartGame(); } else if (m_SoundPlaying == SuccessPlaying) { m_SoundPlaying = NotPlaying; GetSound()->StopChannel(NORMAL_CHANNEL); // Start the looping soundtrack if one is defined FNAME szFileName; if (GetSound() && m_szSoundTrack[0] != '\0') GetSound()->StartFile (GetPathName (szFileName, m_szSoundTrack), YES/*bLoop*/, MUSIC_CHANNEL, FALSE); // If Play mode, go to the next scene if (m_nSceneNo == IDD_NUTDROPI) FORWARD_WM_COMMAND (m_hWnd, IDC_NEXT, NULL, m_nNextSceneNo, PostMessage); else StartGame(); } }
LOCAL void Slider_OnLButtonDown(HWND hWindow, BOOL fDoubleClick, int x, int y, UINT keyFlags) /***********************************************************************/ { POINT ptPosition; int Value; LPSLIDERINFO lpInfo = Slider_GetInfo (hWindow); ptPosition.x = x; ptPosition.y = y; if (lpInfo) { BOOL bPaint = FALSE; SetCapture (hWindow); lpInfo->bCaptured = TRUE; if (!(lpInfo->lStyle & SS_NOMOUSEFOCUS)) SetFocus (hWindow); if (!Slider_IsOnThumb (ptPosition,lpInfo) && (lpInfo->lStyle & SS_CLICKSTEP)) { Value = Slider_ValueFromPoint (hWindow,ptPosition,lpInfo); lpInfo->bStepping = TRUE; if (Value < lpInfo->Value) bPaint = Slider_DecrementValue (lpInfo); else if (Value > lpInfo->Value) bPaint = Slider_IncrementValue (lpInfo); Slider_PointFromValue (hWindow,lpInfo->Value,&lpInfo->ptPosition,lpInfo); SetTimer (hWindow,1,150,NULL); } else { Value = lpInfo->Value; bPaint = TRUE; Slider_ClipPoint (&ptPosition,lpInfo); lpInfo->Value = Slider_ValueFromPoint (hWindow,ptPosition,lpInfo); if (lpInfo->lStyle & SS_SNAPDRAG) { Slider_PointFromValue (hWindow,lpInfo->Value,&lpInfo->ptPosition,lpInfo); bPaint = lpInfo->Value != Value; } else if (lpInfo->lStyle & SS_HORZSLIDER && ptPosition.x != lpInfo->ptPosition.x) lpInfo->ptPosition.x = ptPosition.x; else if (ptPosition.y != lpInfo->ptPosition.y) lpInfo->ptPosition.y = ptPosition.y; else bPaint = FALSE; } if (bPaint) { FORWARD_WM_COMMAND(GetParent(hWindow), GetDlgCtrlID(hWindow), hWindow, SN_VALUECHANGING, SendMessage); InvalidateRect (hWindow,NULL,FALSE); UpdateWindow (hWindow); } } }
static void Cls_OnSysCommand(HWND hwnd, UINT cmd, int x, int y) { switch (cmd) { case SC_CLOSE: FORWARD_WM_COMMAND(hwnd, IDOK, GetDlgItem(hwnd, IDOK), BN_CLICKED, SendMessage); break; } }
LOCAL void DragEnd(HWND hWindow) /***********************************************************************/ { // get the listbox data pointer, if we don't have one, get out LPLISTBOXDATA lpData = ListBox_GetData(hWindow); if (!lpData) return; // see if we ever started dragging if (lpData->fDragging) { // if we had a cursor, reset it if (lpData->hCursor) SetCursor(lpData->hOldCursor); // do the move if we successfully dragged if (lpData->fSuccess) { int nItem, iTopItem; TCHAR szString[256]; // save the top index, so we can reset it iTopItem = ListBox_GetTopIndex(hWindow); // turn of painting while working with list SetWindowRedraw(hWindow, FALSE); // save text of item ListBox_GetText(hWindow, lpData->iOldPos, szString); // delete the item ListBox_DeleteString(hWindow, lpData->iOldPos); // adjust index because of DeleteString int iNewPos = lpData->iNewPos; if (iNewPos > lpData->iOldPos) iNewPos--; // add the new string at the right spot nItem = ListBox_InsertString(hWindow, iNewPos, szString); // select the item we moved DWORD dwStyle = GetWindowLong(hWindow, GWL_STYLE); if (dwStyle & (LBS_MULTIPLESEL, LBS_EXTENDEDSEL)) ListBox_SetSel(hWindow, TRUE, nItem); else ListBox_SetCurSel(hWindow, nItem); // reset the top index ListBox_SetTopIndex(hWindow, iTopItem); // turn drawing back on SetWindowRedraw(hWindow, TRUE); // inform the dialog of the move FORWARD_WM_COMMAND(GetParent(hWindow), GetDlgCtrlID(hWindow), hWindow, LBN_MOVEITEM, SendMessage); } } // turn off dragging lpData->fDragging = FALSE; KillTimer(hWindow, lpData->idTimer); }
LOCAL void Palette_OnLButtonDblClk(HWND hWindow, BOOL fDoubleClick, int x, int y, UINT keyFlags) /***********************************************************************/ { LPPALETTE lpPalette; lpPalette = (LPPALETTE)GetWindowLong(hWindow, GWL_PALETTE); if (!lpPalette || !lpPalette->iColors) return; FORWARD_WM_COMMAND(GetParent(hWindow), IDC_PALETTE, hWindow, 1, SendMessage); }
//************************************************************************ void CBelongsScene::OnTimer(HWND hWnd, UINT id) //************************************************************************ { CGBScene::OnTimer(hWnd, id); if (id == EDIT_TIMER) { KillTimer( hWnd, id ); PlayBelongsTo(NO); FORWARD_WM_COMMAND(m_hWnd, IDC_NEXT, m_hWnd, 0, PostMessage); } }
/*! マウスのボタンがうっpされたとき @param[in] hWnd ウインドウハンドル @param[in] x 発生したX座標値 @param[in] y 発生したY座標値 @param[in] keyFlags 他に押されてるキーについて @param[in] message うpされたボタンタイプ WM_LBUTTONUP WM_MBUTTONUP */ VOID DraughtButtonUp( HWND hWnd, INT x, INT y, UINT keyFlags, UINT message ) { POINT stPos; INT id; UINT dMode, dSubMode, dStyle; stPos.x = x; stPos.y = y; giTarget = DraughtTargetItemSet( &stPos ); TRACE( TEXT("TARGET %d"), giTarget ); // サムネ側でクルックしたなら、MAAのデフォ動作に従う if( gbThumb ) { dMode = ViewMaaItemsModeGet( &dSubMode ); // 中クルックの場合 if( WM_MBUTTONUP == message ) dMode = dSubMode; switch( dMode ) { #ifndef _ORRVW case 0: id = IDM_DRAUGHT_INSERTEDIT; break; case 1: id = IDM_DRAUGHT_INTERRUPTEDIT; break; case 2: id = IDM_DRAUGHT_LAYERBOX; break; #endif case 3: id = IDM_DRAUGHT_UNICLIP; break; default: // とりあえずコピー case 4: id = IDM_DRAUGHT_SJISCLIP; break; case 5: id = IDM_THUMB_DRAUGHT_ADD; break; } } else { if( WM_MBUTTONUP == message ){ dStyle = gdSubClickDrt; } else{ dStyle = gdClickDrt; } switch( dStyle ) { #ifndef _ORRVW case 0: id = IDM_DRAUGHT_INSERTEDIT; break; case 1: id = IDM_DRAUGHT_INTERRUPTEDIT; break; case 2: id = IDM_DRAUGHT_LAYERBOX; break; #endif case 3: id = IDM_DRAUGHT_UNICLIP; break; default: // ドラフト側なら、とりあえずコピー case 4: id = IDM_DRAUGHT_SJISCLIP; break; } } FORWARD_WM_COMMAND( hWnd, id, ghDraughtWnd, 0, SendMessage ); return; }
LOCAL void SelectEnd(HWND hWindow) /***********************************************************************/ { // get the listbox data pointer, if we don't have one, get out LPLISTBOXDATA lpData = ListBox_GetData(hWindow); if (!lpData) return; FORWARD_WM_COMMAND(GetParent(hWindow), GetDlgCtrlID(hWindow), hWindow, LBN_SELCHANGE, SendMessage); KillTimer(hWindow, lpData->idTimer); }
LOCAL void Hotspot_OnTimer(HWND hWindow, UINT id) /***********************************************************************/ { // Timer went off, so execute the same as in WM_LBUTTONDOWN STRING szScene; KillTimer( hWindow, id ); GetWindowText( hWindow, szScene, sizeof(szScene)-1 ); if ( !(*szScene) ) FORWARD_WM_COMMAND(GetParent(hWindow), GET_WINDOW_ID(hWindow), hWindow, 0, SendMessage); else GetApp()->GotoScene( GetParent(hWindow), latoi(szScene) ); }
void CZoomCombo::NotifyChanged(int code) { int nIndex; int iPercentages[NUM_PERCENTAGES] = {1600, 800, 400, 200, 100, 75, 50, 25}; int idCommands[NUM_COMMANDS] = {IDC_CUSTOMVIEW, IDC_VIEWLAST, IDC_VIEW1TO1, IDC_VIEWALL, IDC_VIEWFULL}; int iPercentage = 0; CServerView *pView = PictPubApp.GetActiveView(); if (pView == NULL) return; if (code == CBN_KILLFOCUS) { BOOL bTranslated; iPercentage = GetDlgItemInt(GetParent(m_hWnd), GetDlgCtrlID(m_hWnd), &bTranslated, FALSE); if (!iPercentage) return; } else { if ( code != CBN_SELCHANGE ) return; nIndex = ComboBox_GetCurSel(m_hWnd); } if (iPercentage || nIndex < NUM_PERCENTAGES) { if (!iPercentage) iPercentage = iPercentages[nIndex]; if (iPercentage != ZoomForum.GetViewPercentage()) { if (!ZoomEnable( pView->GetSafeHwnd(), iPercentage, FALSE)) { Message( IDS_BADZOOM ); SetFocus(m_hWnd); return; } int x = ( pView->m_lpDisplay->FileRect.left + pView->m_lpDisplay->FileRect.right ) / 2; int y = ( pView->m_lpDisplay->FileRect.top + pView->m_lpDisplay->FileRect.bottom ) / 2; SaveLastView(pView->GetSafeHwnd()); Zoom(pView->GetSafeHwnd(), x, y, iPercentage, NO, CONTROL ); } } else { nIndex -= NUM_PERCENTAGES; int idCommand = idCommands[nIndex]; HWND hWnd = PictPubApp.m_pMainWnd->GetSafeHwnd(); FORWARD_WM_COMMAND(hWnd, idCommand, m_hWnd, 0, SendMessage); } }
//************************************************************************ void CBelongsScene::OnCommand(HWND hWnd, int id, HWND hControl, UINT codeNotify) //************************************************************************ { switch (id) { case IDC_EDIT: { if (codeNotify == EN_CHANGE) { } break; } #ifdef _DEBUG case VK_SPACE: { PlayBelongsTo(YES); SetDlgItemText(hWnd, IDC_EDIT, ""); break; } #endif case IDC_PLAYBELONGS: { EnableWindow(GetDlgItem(hWnd, IDC_EDIT), FALSE); PlayBelongsTo(NO); FORWARD_WM_COMMAND(m_hWnd, IDC_NEXT, m_hWnd, 0, PostMessage); break; } case IDC_NEXT: { if (m_hSound) { MCIStop(m_hSound,YES); MCIClose(m_hSound); m_hSound = NULL; } ShowDlgItem(hWnd, IDC_EDIT, FALSE); UpdateWindow(hWnd); } default: { CGBScene::OnCommand(hWnd, id, hControl, codeNotify); break; } } }
LOCAL void Slider_OnLButtonUp(HWND hWindow, int x, int y, UINT keyFlags) /***********************************************************************/ { LPHSLIDERINFO lpInfo; if (! (lpInfo = (LPHSLIDERINFO)GetWindowLong (hWindow, GWL_DATAPTR) ) ) return; if (! lpInfo->bTrack) return; ReleaseCapture (); lpInfo->bTrack = FALSE; // Send the new setting back to the parent FORWARD_WM_COMMAND( GetParent(hWindow), GET_WINDOW_ID(hWindow), 1, lpInfo->Position, SendMessage ); }
LOCAL void PalPicker_OnLButtonDown(HWND hWindow, BOOL fDoubleClick, int x, int y, UINT keyFlags) /***********************************************************************/ { RECT ClientRect; int iSelect, iOldSelect; if ( GetFocus() != hWindow ) SetFocus( hWindow ); iSelect = PalPicker_GetSelect(hWindow, x, y); if (iSelect < 0) return; if (fDoubleClick) { FORWARD_WM_COMMAND( GetParent(hWindow), GetDlgCtrlID(hWindow), hWindow, fDoubleClick, SendMessage ); return; } if ( PalPicker_bTrack ) return; SetCapture( hWindow ); PalPicker_bTrack = TRUE; GetWindowRect( hWindow, &ClientRect ); ClipCursor( &ClientRect ); iOldSelect = GetWindowWord(hWindow, GWW_PALINDEX); if (iSelect != iOldSelect) { PalPicker_NewSelect(hWindow, iOldSelect, iSelect); FORWARD_WM_COMMAND( GetParent(hWindow), GetDlgCtrlID(hWindow), hWindow, fDoubleClick, SendMessage ); } }
void OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) { switch (id) { case ID_FILE_OPEN: { IFileDialog *pFileDialog = NULL; HRESULT hr = CoCreateInstance(CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pFileDialog)); if (SUCCEEDED(hr)) { COMDLG_FILTERSPEC filter[3]; filter[0].pszName = L"位图文件(*.bmp)"; filter[0].pszSpec = L"*.bmp"; filter[1].pszName = L"JPEG(*.jpg;*.jpeg)"; filter[1].pszSpec = L"*.jpg;*.jpeg"; filter[2].pszName = L"所有支持的文件(*.jpg;*.jpeg;*.bmp;*.png)"; filter[2].pszSpec = L"*.jpg;*.jpeg;*.bmp;*.png"; hr = pFileDialog->SetFileTypes(3, filter); hr = pFileDialog->SetFileTypeIndex(3); hr = pFileDialog->Show(hwnd); if (SUCCEEDED(hr)) { IShellItem *psi = NULL; hr = pFileDialog->GetResult(&psi); if (SUCCEEDED(hr)) { PWSTR pwszFilePath = NULL; hr = psi->GetDisplayName(SIGDN_FILESYSPATH, &pwszFilePath); if (SUCCEEDED(hr)) { wchar_t * pext = wcsrchr(pwszFilePath, L'.'); if(pext != NULL && _wcsicmp(pext, L".bmp") == 0) SendMessage(hwnd, WM_USER_IMG, 0, (LPARAM)pwszFilePath); else SendMessage(hwnd, WM_USER_IMG, 1, (LPARAM)pwszFilePath); CoTaskMemFree(pwszFilePath); } psi->Release(); } } } pFileDialog->Release(); break; } case ID_FILE_EXIT: PostQuitMessage(0); break; default: FORWARD_WM_COMMAND(hwnd, id, hwndCtl, codeNotify, DefWindowProc); } }
LOCAL void Slider_OnKeyUp(HWND hWindow, UINT vk, BOOL fDown, int cRepeat, UINT flags) /***********************************************************************/ { LPSLIDERINFO lpInfo = Slider_GetInfo (hWindow); if (lpInfo) { if (((lpInfo->lStyle & SS_HORZSLIDER) ? (vk == VK_LEFT || vk == VK_RIGHT) : (vk == VK_UP || vk == VK_DOWN)) || vk == VK_NEXT || vk == VK_PRIOR || vk == VK_END || vk == VK_HOME) FORWARD_WM_COMMAND(GetParent(hWindow), GetDlgCtrlID(hWindow), hWindow, SN_VALUESELECTED, SendMessage); } }
//************************************************************************ void CNutDropScene::PlayLevelSuccessWave() //************************************************************************ { // Get the sound to play based on the level int iCount = 0; for (int i = 0 ; i < MAX_SUCCESSWAVES ; i++) { if (m_szSuccessLevel[i][0] != '\0') iCount++; } LPSTR lpWave; if (iCount <= 0) { lpWave = m_szSuccessLevel[0]; } else { i = GetRandomNumber (iCount); lpWave = m_szSuccessLevel[i]; } if (*lpWave != '\0') { FNAME szFileName; if (GetSound() ) { m_SoundPlaying = SuccessPlaying; GetSound()->StopChannel(NORMAL_CHANNEL); if (m_nSceneNo == IDD_NUTDROPI) { // Play this wave without wavemix LPSOUND lpSound = new CSound; if ( lpSound ) { GetSound()->Activate (FALSE); lpSound->StartFile( GetPathName(szFileName, lpWave), NO/*bLoop*/, NORMAL_CHANNEL/*iChannel*/, TRUE/*bWait*/, m_hWnd); delete lpSound; GetSound()->Activate (TRUE); FORWARD_WM_COMMAND (m_hWnd, IDC_NEXT, NULL, m_nNextSceneNo, PostMessage); } } else GetSound()->StartFile(GetPathName (szFileName, lpWave), NO/*bLoop*/, NORMAL_CHANNEL/*iChannel*/, FALSE/*bWait*/, m_hWnd); } } }
LOCAL void Slider_OnKeyDown(HWND hWindow, UINT vk, BOOL fDown, int cRepeat, UINT flags) /***********************************************************************/ { LPSLIDERINFO lpInfo = Slider_GetInfo (hWindow); if (lpInfo) { int OldValue = lpInfo->Value; if (lpInfo->lStyle & SS_HORZSLIDER) { if ((vk == VK_LEFT && !(lpInfo->lStyle & SS_RIGHTTOLEFT)) || (vk == VK_RIGHT && lpInfo->lStyle & SS_RIGHTTOLEFT)) Slider_DecrementValue (lpInfo); else if ((vk == VK_RIGHT && !(lpInfo->lStyle & SS_RIGHTTOLEFT)) || (vk == VK_LEFT && lpInfo->lStyle & SS_RIGHTTOLEFT)) Slider_IncrementValue (lpInfo); } else { if ((vk == VK_UP && !(lpInfo->lStyle & SS_RIGHTTOLEFT)) || (vk == VK_DOWN && lpInfo->lStyle & SS_BOTTOMTOTOP)) Slider_DecrementValue (lpInfo); else if ((vk == VK_DOWN && !(lpInfo->lStyle & SS_RIGHTTOLEFT)) || (vk == VK_UP && lpInfo->lStyle & SS_BOTTOMTOTOP)) Slider_IncrementValue (lpInfo); } if (vk == VK_NEXT) Slider_DecrementValue (lpInfo); else if (vk == VK_PRIOR) Slider_IncrementValue (lpInfo); else if (vk == VK_END) lpInfo->Value = lpInfo->Max; else if (vk == VK_HOME) lpInfo->Value = lpInfo->Min; Slider_PointFromValue (hWindow,lpInfo->Value,&lpInfo->ptPosition,lpInfo); if (OldValue != lpInfo->Value) { FORWARD_WM_COMMAND(GetParent(hWindow), GetDlgCtrlID(hWindow), hWindow, SN_VALUECHANGING, SendMessage); InvalidateRect (hWindow,NULL,FALSE); UpdateWindow (hWindow); } } }
LOCAL void Hotspot_OnLButtonUp(HWND hWindow, int x, int y, UINT keyFlags) /***********************************************************************/ { if ( !bTrack ) return; ReleaseCapture(); bTrack = FALSE; if ( bInRect ) { STRING szScene; GetWindowText( hWindow, szScene, sizeof(szScene)-1 ); if ( !(*szScene) ) FORWARD_WM_COMMAND(GetParent(hWindow), GET_WINDOW_ID(hWindow), hWindow, 0, SendMessage); else GetApp()->GotoScene( GetParent(hWindow), latoi(szScene) ); } }
VOID Dlg_PopulateModuleList(HWND hwnd) { HWND hwndModuleHelp = GetDlgItem(hwnd, IDC_MODULEHELP); ListBox_ResetContent(hwndModuleHelp); CToolhelp thProcesses(TH32CS_SNAPPROCESS); PROCESSENTRY32 pe = { sizeof(pe) }; BOOL fOk = thProcesses.ProcessFirst(&pe); for (; fOk; fOk = thProcesses.ProcessNext(&pe)) { CToolhelp thModules(TH32CS_SNAPMODULE, pe.th32ProcessID); MODULEENTRY32 me = { sizeof(me) }; BOOL fOk = thModules.ModuleFirst(&me); for (; fOk; fOk = thModules.ModuleNext(&me)) { int n = ListBox_FindStringExact(hwndModuleHelp, -1, me.szExePath); if (n == LB_ERR) { // This module hasn't been added before ListBox_AddString(hwndModuleHelp, me.szExePath); } } } HWND hwndList = GetDlgItem(hwnd, IDC_PROCESSMODULELIST); SetWindowRedraw(hwndList, FALSE); ComboBox_ResetContent(hwndList); int nNumModules = ListBox_GetCount(hwndModuleHelp); for (int i = 0; i < nNumModules; i++) { TCHAR sz[1024]; ListBox_GetText(hwndModuleHelp, i, sz); // Place module name (without its path) in the list int nIndex = ComboBox_AddString(hwndList, _tcsrchr(sz, TEXT('\\')) + 1); // Associate the index of the full path with the added item ComboBox_SetItemData(hwndList, nIndex, i); } ComboBox_SetCurSel(hwndList, 0); // Select the first entry // Simulate the user selecting this first item so that the // results pane shows something interesting FORWARD_WM_COMMAND(hwnd, IDC_PROCESSMODULELIST, hwndList, CBN_SELCHANGE, SendMessage); SetWindowRedraw(hwndList, TRUE); InvalidateRect(hwndList, NULL, FALSE); }
LOCAL void Slider_OnLButtonUp(HWND hWindow, int x, int y, UINT keyFlags) /***********************************************************************/ { POINT ptPosition; BOOL bPaint; LPSLIDERINFO lpInfo = Slider_GetInfo (hWindow); ptPosition.x = x; ptPosition.y = y; if (lpInfo && lpInfo->bCaptured) { ReleaseCapture (); lpInfo->bCaptured = FALSE; if (lpInfo->bStepping) { lpInfo->bStepping = FALSE; KillTimer (hWindow,1); } else { bPaint = TRUE; Slider_ClipPoint (&ptPosition,lpInfo); lpInfo->Value = Slider_ValueFromPoint (hWindow,ptPosition,lpInfo); if (lpInfo->lStyle & SS_SNAP || lpInfo->lStyle & SS_SNAPDRAG) Slider_PointFromValue (hWindow,lpInfo->Value,&lpInfo->ptPosition,lpInfo); else if (lpInfo->lStyle & SS_HORZSLIDER && ptPosition.x != lpInfo->ptPosition.x) lpInfo->ptPosition.x = ptPosition.x; else if (ptPosition.y != lpInfo->ptPosition.y) lpInfo->ptPosition.y = ptPosition.y; else bPaint = FALSE; if (bPaint) { InvalidateRect (hWindow,NULL,FALSE); UpdateWindow (hWindow); } } FORWARD_WM_COMMAND(GetParent(hWindow), GetDlgCtrlID(hWindow), hWindow, SN_VALUESELECTED, SendMessage); } }
void CHyperLink::DoAction(void) const { if (*m_szLinkURL) { if (g_pResManager->m_hAppStartingCursor) SetCursor(g_pResManager->m_hAppStartingCursor); ShellExecute(NULL, _T("open"), m_szLinkURL, NULL, NULL, SW_SHOWDEFAULT); } else { HWND hwndParent = GetParent(m_hwnd); if (hwndParent) { int nCtrlID = GetDlgCtrlID(m_hwnd); FORWARD_WM_COMMAND(hwndParent, nCtrlID, m_hwnd, BN_CLICKED, PostMessage); } } }
LOCAL void Bmulti_OnLButtonUp(HWND hWindow, int x, int y, UINT keyFlags) /***********************************************************************/ { DWORD dwStyle; LPBMULTICONTINFO lpInfo; if (! (lpInfo = (LPBMULTICONTINFO)GetWindowLong (hWindow, GWL_DATAPTR) ) ) return; if (! lpInfo->bTrack) return; ReleaseCapture(); lpInfo->bTrack = FALSE; dwStyle = GetWindowLong(hWindow, GWL_STYLE); InvalidateRect(hWindow, NULL, FALSE); if (lpInfo->bInRect) FORWARD_WM_COMMAND(GetParent(hWindow), GET_WINDOW_ID(hWindow), hWindow, 0, SendMessage); }
LOCAL void Slider_OnMouseMove(HWND hWindow, int x, int y, UINT keyFlags) /***********************************************************************/ { POINT ptPosition; int Value; BOOL bPaint; LPSLIDERINFO lpInfo = Slider_GetInfo (hWindow); ptPosition.x = x; ptPosition.y = y; if (lpInfo && lpInfo->bCaptured) { bPaint = FALSE; if (!lpInfo->bStepping) { Value = lpInfo->Value; bPaint = TRUE; Slider_ClipPoint (&ptPosition,lpInfo); lpInfo->Value = Slider_ValueFromPoint (hWindow,ptPosition,lpInfo); if (lpInfo->lStyle & SS_SNAPDRAG) { Slider_PointFromValue (hWindow,lpInfo->Value,&lpInfo->ptPosition,lpInfo); bPaint = lpInfo->Value != Value; } else if (lpInfo->lStyle & SS_HORZSLIDER && ptPosition.x != lpInfo->ptPosition.x) lpInfo->ptPosition.x = ptPosition.x; else if (ptPosition.y != lpInfo->ptPosition.y) lpInfo->ptPosition.y = ptPosition.y; else bPaint = FALSE; } if (bPaint) { FORWARD_WM_COMMAND(GetParent(hWindow), GetDlgCtrlID(hWindow), hWindow, SN_VALUECHANGING, SendMessage); InvalidateRect (hWindow,NULL,FALSE); UpdateWindow (hWindow); } } }
LOCAL void PalPicker_OnMouseMove(HWND hWindow, int x, int y, UINT keyFlags) /***********************************************************************/ { int iSelect, iOldSelect; if ( !PalPicker_bTrack ) return; iSelect = PalPicker_GetSelect(hWindow, x, y); if (iSelect < 0) return; iOldSelect = GetWindowWord(hWindow, GWW_PALINDEX); if (iSelect != iOldSelect) { PalPicker_NewSelect(hWindow, iOldSelect, iSelect); FORWARD_WM_COMMAND( GetParent(hWindow), GetDlgCtrlID(hWindow), hWindow, 0, SendMessage ); } }
LOCAL void Slider_OnLButtonDown(HWND hWindow, BOOL fDoubleClick, int x, int y, UINT keyFlags) /***********************************************************************/ { LPHSLIDERINFO lpInfo; if ( !(lpInfo = (LPHSLIDERINFO)GetWindowLong( hWindow, GWL_DATAPTR )) ) return; if ( SHIFT ) return; if ( lpInfo->bTrack ) return; SetCapture( hWindow ); lpInfo->bTrack = TRUE; if ( GetFocus() != hWindow ) SetFocus( hWindow ); lpInfo->bInRect = YES; RECT ClientRect; GetClientRect (hWindow, & ClientRect); x -= ClientRect.left; int iBmpWidth = lpInfo->rBitmap.right - lpInfo->rBitmap.left; x -= (iBmpWidth/2); if ( x < 0 ) x = 0; int iWidth = ClientRect.right - ClientRect.left - iBmpWidth; if ( x > iWidth ) x = iWidth; lpInfo->Position = lpInfo->Min + (int)(((long)x * (lpInfo->Max - lpInfo->Min)) / iWidth); // Send the new setting back to the parent FORWARD_WM_COMMAND( GetParent(hWindow), GET_WINDOW_ID(hWindow), 0, lpInfo->Position, SendMessage ); InvalidateRect (hWindow, & ClientRect, TRUE); }