Click here to Skip to main content
15,895,256 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: which design is better to wrap another class instance Pin
George_George16-Apr-08 0:52
George_George16-Apr-08 0:52 
Generalre-entrancy pattern issue setbacks Pin
George_George11-Apr-08 22:24
George_George11-Apr-08 22:24 
QuestionHow can remove button of Property Sheet? Pin
Le@rner11-Apr-08 21:44
Le@rner11-Apr-08 21:44 
AnswerRe: How can remove button of Property Sheet? Pin
Blake Miller14-Apr-08 5:58
Blake Miller14-Apr-08 5:58 
Generalcall one dialog box from another in sdk Pin
Pankaj Kothawade11-Apr-08 21:00
Pankaj Kothawade11-Apr-08 21:00 
AnswerRe: call one dialog box from another in sdk Pin
Hamid_RT12-Apr-08 7:19
Hamid_RT12-Apr-08 7:19 
GeneralMenu On RButtonDown of Mouse. Pin
Le@rner11-Apr-08 20:39
Le@rner11-Apr-08 20:39 
GeneralRe: Menu On RButtonDown of Mouse. Pin
enhzflep12-Apr-08 7:14
enhzflep12-Apr-08 7:14 
Yeah, sure. The 1, 2 & 3 (3rd parameter) are used as the commandIDs.
When a particular menu option is chosen, this commandID will be sent to your windowProcedure in LOWORD of wParam.

So, what you need to do with the above code is look for 1, 2 or 3 as being the ID of the control that generated a WM_COMMAND message. An rough example may be seen in this code I just ripped out of a class, just pay attention to the way the messages are created and caught.

LRESULT WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
     switch (uMsg)
     {
            case WM_COMMAND:
                 switch LOWORD(wParam)
                 {
                        case <code>IDM_LargeIcons</code>:
                             SetIconStyle(LARGE);
                             break;
                        case <code>IDM_SmallIcons</code>:
                             SetIconStyle(SMALL);
                             break;
                        case <code>IDM_Details</code>:
                             SetIconStyle(DETAIL);
                             break;
                        case <code>IDM_List</code>:
                             SetIconStyle(LIST);
                             break;
                     }
                     break;

                case WM_RBUTTONDOWN:

                     POINT CurPos;
                     GetCursorPos(&CurPos);
		     HMENU hPopupMenu = CreatePopupMenu();

		     //Add pop-up menu to allow user to choose between Icon, LargeIcon, List & Details views
                     InsertMenu(hPopupMenu, 0, MF_BYPOSITION | MF_STRING, <code>IDM_LargeIcons</code>, "Large Icons");
		     InsertMenu(hPopupMenu, 1, MF_BYPOSITION | MF_STRING, <code>IDM_SmallIcons</code>, "Small Icons");
		     InsertMenu(hPopupMenu, 2, MF_BYPOSITION | MF_STRING, <code>IDM_List</code>, "List");
		     InsertMenu(hPopupMenu, 3, MF_BYPOSITION | MF_STRING, <code>IDM_Details</code>, "Details");
		     SetForegroundWindow(GetHwnd());
		     TrackPopupMenu(hPopupMenu, TPM_TOPALIGN | TPM_LEFTALIGN, CurPos.x, CurPos.y, 0, GetHwnd(), NULL);//m_hWndParent, NULL);
		     DestroyMenu(hPopupMenu);
                     return 0;
		 }
		// Always pass unhandled messages on to WndProcDefault
		return WndProcDefault(hWnd, uMsg, wParam, lParam);
	}


The easiest way to make the world a better place is to refuse to help those that wreck it....

GeneralRe: Menu On RButtonDown of Mouse. Pin
Hamid_RT12-Apr-08 7:19
Hamid_RT12-Apr-08 7:19 
Generalfiles present in folder Pin
neha.agarwal2711-Apr-08 19:41
neha.agarwal2711-Apr-08 19:41 
GeneralRe: files present in folder Pin
CPallini11-Apr-08 21:34
mveCPallini11-Apr-08 21:34 
GeneralUnlock Process Pin
john563211-Apr-08 17:58
john563211-Apr-08 17:58 
GeneralRe: Unlock Process Pin
Schehaider_Aymen11-Apr-08 23:11
Schehaider_Aymen11-Apr-08 23:11 
GeneralMIME Spec Pin
Bram van Kampen11-Apr-08 11:46
Bram van Kampen11-Apr-08 11:46 
GeneralPrevent active controls under child window to overwhelm it Pin
428811-Apr-08 8:02
428811-Apr-08 8:02 
GeneralRe: Prevent active controls under child window to overwhelm it Pin
Mark Salsbery11-Apr-08 8:20
Mark Salsbery11-Apr-08 8:20 
GeneralRe: Prevent active controls under child window to overwhelm it Pin
428811-Apr-08 9:22
428811-Apr-08 9:22 
GeneralRe: Prevent active controls under child window to overwhelm it Pin
Moak12-Apr-08 1:34
Moak12-Apr-08 1:34 
GeneralRe: Prevent active controls under child window to overwhelm it Pin
Mark Salsbery12-Apr-08 4:41
Mark Salsbery12-Apr-08 4:41 
GeneralRe: Prevent active controls under child window to overwhelm it Pin
428812-Apr-08 10:47
428812-Apr-08 10:47 
GeneralRe: Prevent active controls under child window to overwhelm it Pin
Moak12-Apr-08 16:30
Moak12-Apr-08 16:30 
GeneralRe: Prevent active controls under child window to overwhelm it Pin
428813-Apr-08 10:48
428813-Apr-08 10:48 
GeneralRe: Prevent active controls under child window to overwhelm it Pin
Moak13-Apr-08 13:22
Moak13-Apr-08 13:22 
GeneralRe: Prevent active controls under child window to overwhelm it Pin
428814-Apr-08 0:46
428814-Apr-08 0:46 
JokeRe: Prevent active controls under child window to overwhelm it Pin
Moak14-Apr-08 11:58
Moak14-Apr-08 11:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.