Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

c++, MFC!?


  • Please log in to reply

#1
t3ch

t3ch

    New Member

  • Member
  • Pip
  • 2 posts
Hi..
Im trying to make popup menu, i recv msg WM_RBUTTONDOWN in PreTranslatedMessage() then create that popup but when open new Dialog with DoModal() or Create() it crash it crash when Cancel it.. when destroy it...

BOOL CMFCTestDlg::PreTranslateMessage(MSG * pMsg)
{
	switch(pMsg->message)
	{
	case WM_RBUTTONDOWN:
  {
 	 POINT p;
 	 GetCursorPos(&p);
 	 
 	 HMENU hMenu = ::CreatePopupMenu();
 	 if (NULL != hMenu)
 	 {
    // add a few test items
    ::AppendMenu(hMenu, MF_STRING, 1, "Start Sniff");
    
    int sel = ::TrackPopupMenuEx(hMenu, 
   	 TPM_CENTERALIGN | TPM_RETURNCMD,
   	 p.x,
   	 p.y,
   	 m_hWnd,
   	 NULL);
    ::DestroyMenu(hMenu);
    
    if(sel == 1)
    {
                                        //
                                        //CSniff.DoModal();
                                        // OR 
   	 //CSniff.Create(IDD_SNIF);
   	 //CSniff.ShowWindow(1);
    }
 	 }
  }
	}

	return 0;//CDialog::PreTranslateMessage(pMsg);
}

So when im destroyng that dialog when is opened with popup it crash program... any help please :tazz:

Edited by t3ch, 11 July 2005 - 06:19 AM.

  • 0

Advertisements


#2
t3ch

t3ch

    New Member

  • Topic Starter
  • Member
  • Pip
  • 2 posts
U PEOPLE HERE ARE GeeKs '\0' :tazz::) lool
  • 0

#3
ratmilk

ratmilk

    Member

  • Member
  • PipPipPip
  • 151 posts
Lol dude, i don't think anyone around here knows :tazz:

How are you calling PreTranslateMessage??
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP