Click here to Skip to main content
15,890,690 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: can any one help me to make context menu in win32 API Pin
Naveen6-Feb-07 1:45
Naveen6-Feb-07 1:45 
GeneralRe: can any one help me to make context menu in win32 API Pin
amitmistry_petlad 6-Feb-07 1:59
amitmistry_petlad 6-Feb-07 1:59 
GeneralRe: can any one help me to make context menu in win32 API Pin
amitmistry_petlad 6-Feb-07 2:19
amitmistry_petlad 6-Feb-07 2:19 
GeneralRe: can any one help me to make context menu in win32 API Pin
Hamid_RT6-Feb-07 6:08
Hamid_RT6-Feb-07 6:08 
GeneralRe: can any one help me to make context menu in win32 API Pin
Naveen6-Feb-07 16:12
Naveen6-Feb-07 16:12 
GeneralRe: can any one help me to make context menu in win32 API Pin
amitmistry_petlad 6-Feb-07 17:30
amitmistry_petlad 6-Feb-07 17:30 
GeneralRe: can any one help me to make context menu in win32 API Pin
Naveen6-Feb-07 18:03
Naveen6-Feb-07 18:03 
GeneralRe: can any one help me to make context menu in win32 API Pin
amitmistry_petlad 6-Feb-07 18:29
amitmistry_petlad 6-Feb-07 18:29 
When i debug at the break point of the WM_COMMAND.
the control does not go there. then where should it goes ?
is it come in listview command ?
if it is call in listview notify command then how could i write ?

LOOK AT CODE:

case WM_PAINT:
		//Fill the PAINTSTRUCT structure with information about painting and return the handle to the display device context.
			hdc = BeginPaint(hDlg, &ps);
		////Retrieves the coordinates of windows Client area.
		//GetClientRect(hDlg, &rc);
		////Create a logical brush with specified color to paint the window.
		//hBrush = CreateSolidBrush(RGB(69,13,24));
		////Fill the client area with above color.
		//FillRect(hdc, &rc, hBrush);
		////End of painting in this window.

		////Load the background image for Header window
		//hBmp = LoadBitmap(hInst,MAKEINTRESOURCE(IDB_BITMAP_HEADER_TEXT));
		////Create compatible device context to load the bmp file.
		//memDC = CreateCompatibleDC(hdc);
		////select the image object into the device context created in above step.
		//SelectObject(memDC,hBmp);
		////Copy the sample into header window(hdc) from created device context i.e. memDC.
		//BitBlt(hdc, 15, 50, 300, 200, memDC, 0, 0, SRCCOPY);
		////Delete the created device context.
		//DeleteDC(memDC);
		////Delete object.
	 //   DeleteObject(memDC);
		EndPaint(hDlg, &ps);
		//Delete the logical brush.
		//DeleteObject(hBrush);
		break;

////NOTIFY
	case WM_NOTIFY:
		{
			switch(LOWORD(wParam))
			{
			    case IDC_LIST4: 
				
				LPNMLISTVIEW pnm = (LPNMLISTVIEW)lParam;

                if(pnm->hdr.hwndFrom == hList &&pnm->hdr.code == NM_CUSTOMDRAW)
                {
                 //   SetWindowLong(hWnd, DWL_MSGRESULT, (LONG)ProcessCustomDraw(lParam));
                    return TRUE;
                }

				if(((LPNMHDR)lParam)->code == LVN_KEYDOWN)
				{		
				
					//if(((LPNMHDR)lParam)->code==VK_DELETE)

					{				
						int iSlected=0;
						iSlected=SendMessage(hList,LVM_GETNEXTITEM,-1,LVNI_FOCUSED);
						if(iSlected==-1)
						  {
							MessageBox(hList,_T("No Items in ListView"),_T("Error"),MB_OK|MB_ICONINFORMATION);
							break;
						}				
					 ListView_DeleteItem(hList,iSlected);		
					}
				}			
				
                if(((LPNMHDR)lParam)->code == NM_RCLICK)
				{					    
					//HMENU hmenuTrackPopup;  // shortcut menu 
					//POINT pt;
					//GetCursorPos(&pt); 
					////HMENU hMenu=LoadMenu(hInst,TEXT("IDR_MENU1"));
					//
					//HMENU hMenu=LoadMenu(hInst,IDR_MENU1)	;
					//hmenuTrackPopup= GetSubMenu(hMenu, 0);						
					//TrackPopupMenu(hmenuTrackPopup,TPM_LEFTALIGN | TPM_RIGHTBUTTON,pt.x,pt.y,0, hDlg, NULL);									
					HMENU hMenu = LoadMenu (NULL, MAKEINTRESOURCE (IDR_MENU1));
					HMENU hPopupMenu = GetSubMenu (hMenu, 0);
					POINT pt;
					SetMenuDefaultItem (hPopupMenu, -1, TRUE);
					GetCursorPos (&pt);
					//SetForegroundWindow (hWnd);
					TrackPopupMenu (hPopupMenu,TPM_LEFTALIGN, pt.x, pt.y, 0, hList, NULL);
					//SetForegroundWindow (hWnd);
					DestroyMenu (hPopupMenu);
					DestroyMenu (hMenu);
					
				}
							
				
				if(((LPNMHDR)lParam)->code == NM_CLICK)
				{
					iSelect=SendMessage(hList,LVM_GETNEXTITEM,-1,LVNI_FOCUSED);				    
					if(iSelect==-1)
					{                      
					  break;
					}					
					index=iSelect;		
					ShowWindow(hWndinoutfiledir,SW_HIDE);			
					ShowWindow(hwndEncrypt,SW_HIDE);					
					//Hide File Split window.
					ShowWindow(hwndSplit,SW_HIDE);
					//Hide encoder window.			
					ShowWindow(hwndUpload,SW_HIDE);
					ShowWindow(hwndTagEditorDlg ,SW_SHOW);
				}

				

              
                break;
			}
		}

		break;

////////////////////////////// when i  right click the button "delete" display and the code is following but its not debug or working where the control goes ?
<code>
	case WM_COMMAND:

		switch(LOWORD(wParam))
		{		
		case ID_DELETE_DELETE: 
			{
				int iSlected=0;
				iSlected=SendMessage(hList,LVM_GETNEXTITEM,-1,LVNI_SELECTED);

				if(iSlected==-1)
				  {
					MessageBox(hList,_T("No Items in ListView"),_T("Error"),MB_OK|MB_ICONINFORMATION);
					break;
				  }				
			 ListView_DeleteItem(hList,iSlected);
			}
			break;	
		}				
		break;
	}
	return FALSE;

}
</code>


Amit
GeneralRe: can any one help me to make context menu in win32 API Pin
Naveen6-Feb-07 18:36
Naveen6-Feb-07 18:36 
GeneralRe: can any one help me to make context menu in win32 API Pin
amitmistry_petlad 6-Feb-07 18:54
amitmistry_petlad 6-Feb-07 18:54 
GeneralRe: can any one help me to make context menu in win32 API Pin
Naveen6-Feb-07 19:03
Naveen6-Feb-07 19:03 
GeneralRe: can any one help me to make context menu in win32 API Pin
amitmistry_petlad 6-Feb-07 19:51
amitmistry_petlad 6-Feb-07 19:51 
QuestionTCHAR Pin
asdtry5-Feb-07 23:16
asdtry5-Feb-07 23:16 
AnswerRe: TCHAR Pin
Michael Dunn5-Feb-07 23:19
sitebuilderMichael Dunn5-Feb-07 23:19 
GeneralRe: TCHAR Pin
asdtry5-Feb-07 23:28
asdtry5-Feb-07 23:28 
GeneralRe: TCHAR Pin
toxcct5-Feb-07 23:38
toxcct5-Feb-07 23:38 
GeneralRe: TCHAR Pin
Waldermort6-Feb-07 0:07
Waldermort6-Feb-07 0:07 
AnswerRe: TCHAR Pin
Christian Graus5-Feb-07 23:49
protectorChristian Graus5-Feb-07 23:49 
AnswerRe: TCHAR Pin
ThatsAlok6-Feb-07 19:53
ThatsAlok6-Feb-07 19:53 
Questionprinter driver Pin
shanmugapriy5-Feb-07 23:10
shanmugapriy5-Feb-07 23:10 
QuestionRe: printer driver Pin
Mark Salsbery6-Feb-07 7:56
Mark Salsbery6-Feb-07 7:56 
QuestionFind memory leaks Pin
Kiran Pinjala5-Feb-07 22:28
Kiran Pinjala5-Feb-07 22:28 
AnswerRe: Find memory leaks Pin
Waldermort5-Feb-07 23:01
Waldermort5-Feb-07 23:01 
AnswerRe: Find memory leaks Pin
Roger Stoltz5-Feb-07 23:13
Roger Stoltz5-Feb-07 23:13 
GeneralRe: Find memory leaks Pin
Waldermort5-Feb-07 23:49
Waldermort5-Feb-07 23:49 

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.