Sign in to follow this  

Again. Dialog Not showing.

This topic is 4599 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

This topic is 4599 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this