Jump to content
  • Advertisement
Sign in to follow this  
Ace826

Again. Dialog Not showing.

This topic is 4814 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Alright, well, I have a TrackPopupMenu(). But when I add my dialog, it doesn't show up unless I hit alt. Any ideas?
LRESULT CALLBACK MainProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
	switch(Message)
	{
	case WM_CREATE:
		/*g_hHost = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_HOST));
		if( g_hHost == NULL)
			MessageBox(NULL, "Host bitmap failed to load.", "Error!", MB_OK | MB_ICONEXCLAMATION);*/

		HMENU hMenu;
		HMENU hTrackMenu;
		break;

	case WM_COMMAND:
		switch(LOWORD(wParam))
		{
		case ID_ADD_HOST:
			DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_ADD_HOST), hwnd, AddHostProc);
			break;
		case ID_ADD_FIREWALL:
			break;
		case ID_ADD_SWITCH:
			break;
		case ID_ADD_HUB:
			break;
		case ID_ADD_ROUTER:
			break;
		case ID_UTILITIES_PING:
			break;
		case ID_UTILITIES_TRACEROUTE:
			break;
		case ID_UTILITIES_SSH:
			break;
		case ID_UTILITIES_TELNET:
			break;
		case ID_UTILITIES_FTP:
			break;
		}
		return 0;


	case WM_CONTEXTMENU:
		if(( hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_MENU1))) == NULL)
			return 0;

        hTrackMenu = GetSubMenu(hMenu, 0);
	
        TrackPopupMenu(hTrackMenu,
            TPM_LEFTALIGN | TPM_VERPOSANIMATION | TPM_RIGHTBUTTON,
            LOWORD(lParam), //x
			HIWORD(lParam), //y
			0,
			hwnd,
			NULL);
        break;

	case WM_PAINT:
		break;
	
	case WM_CLOSE:
		DestroyWindow(hwnd);
		break;
	case WM_DESTROY:
		//DeleteObject(g_hHost);
		PostQuitMessage(0);
		break;
	default:
		return DefWindowProc(hwnd, Message, wParam, lParam);
	}
	return 0;
}

BOOL CALLBACK AddHostProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
	switch(Msg)
	{
	case WM_INITDIALOG:

		return TRUE;
	case WM_COMMAND:
		switch(LOWORD(wParam))
		{
		case IDADD:
			EndDialog(hwnd, IDADD);
			break;
		case IDCANCEL:
			EndDialog(hwnd, IDCANCEL);
			break;
		}
		break;
	default:
		return FALSE;
	}
	return TRUE;
}

Thanks again.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!