Click here to Skip to main content
16,006,001 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Text Capture Problem. Pin
ThatsAlok28-Nov-05 20:58
ThatsAlok28-Nov-05 20:58 
Question<queue> queue threadsafe? Pin
Pixinger7723-Nov-05 2:02
Pixinger7723-Nov-05 2:02 
AnswerRe: <queue> queue threadsafe? Pin
Tim Smith23-Nov-05 3:56
Tim Smith23-Nov-05 3:56 
GeneralRe: <queue> queue threadsafe? Pin
Pixinger7723-Nov-05 20:00
Pixinger7723-Nov-05 20:00 
QuestionIncreasing of Header column of CList Control Pin
mikobi23-Nov-05 1:08
mikobi23-Nov-05 1:08 
AnswerRe: Increasing of Header column of CList Control Pin
Blake Miller23-Nov-05 9:40
Blake Miller23-Nov-05 9:40 
GeneralRe: Increasing of Header column of CList Control Pin
mikobi23-Nov-05 19:22
mikobi23-Nov-05 19:22 
QuestionAdd menu to dialog window Pin
Frank Reich23-Nov-05 0:48
Frank Reich23-Nov-05 0:48 
Dear ALL,

I would like to add a menu to my starting dialog window using WinAPI (I know how to do it with MFC). The code until now looks like I attached it at the end of the message.
But I dont know how to modify the "DialogBox(hInstance,MAKEINTRESOURCE
(IDD_MAIN), NULL, DlgProc);" - command to make it include my menu "IDR_MENU1" from the "resource.h"-file also.

Thanks for your comments.
FRANK REICH

<br />
#include <windows.h><br />
<br />
#include "resource.h" <br />
<br />
HBRUSH g_hbrBackground = NULL;<br />
<br />
BOOL CALLBACK DlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)<br />
{<br />
	switch(Message)<br />
	{<br />
		case WM_INITDIALOG:<br />
			g_hbrBackground = CreateSolidBrush(RGB(180, 180, 180));<br />
<br />
			SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(NULL, <br />
				MAKEINTRESOURCE(IDI_APPLICATION)));<br />
			SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon(NULL, <br />
				MAKEINTRESOURCE(IDI_APPLICATION)));<br />
		break;<br />
<br />
		case WM_CLOSE:<br />
			EndDialog(hwnd, 0);<br />
		break;<br />
<br />
		case WM_CTLCOLORDLG:	<br />
			return (LONG)g_hbrBackground;<br />
		<br />
		case WM_CTLCOLORSTATIC:<br />
		{<br />
			HDC hdcStatic = (HDC)wParam;<br />
			SetTextColor(hdcStatic, RGB(255, 255, 255));<br />
			SetBkMode(hdcStatic, TRANSPARENT);<br />
			return (LONG)g_hbrBackground;<br />
		}<br />
		break;<br />
		case WM_COMMAND:<br />
			switch(LOWORD(wParam))<br />
			{<br />
				case IDOK:<br />
					EndDialog(hwnd, 0);<br />
				break;<br />
				<br />
				case IDCANCEL:<br />
					EndDialog(hwnd, 0);<br />
				break;<br />
			}<br />
		break;<br />
		case WM_DESTROY:<br />
			DeleteObject(g_hbrBackground);<br />
		break;<br />
		default:<br />
			return FALSE;<br />
	}<br />
	return TRUE;<br />
}<br />
<br />
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,<br />
	LPSTR lpCmdLine, int nCmdShow)<br />
{<br />
	return DialogBox(hInstance, MAKEINTRESOURCE(IDD_MAIN), NULL, DlgProc);<br />
}<br />

AnswerRe: Add menu to dialog window Pin
ThatsAlok27-Nov-05 17:44
ThatsAlok27-Nov-05 17:44 
QuestionWM_QUERYENDSESSION message Pin
Chintoo72323-Nov-05 0:43
Chintoo72323-Nov-05 0:43 
AnswerRe: WM_QUERYENDSESSION message Pin
Chintoo72323-Nov-05 0:54
Chintoo72323-Nov-05 0:54 
AnswerRe: WM_QUERYENDSESSION message Pin
ThatsAlok23-Nov-05 2:46
ThatsAlok23-Nov-05 2:46 
Questionrecycle bin subfolders Pin
Chintoo72323-Nov-05 0:24
Chintoo72323-Nov-05 0:24 
AnswerRe: recycle bin subfolders Pin
Chintoo72323-Nov-05 0:58
Chintoo72323-Nov-05 0:58 
QuestionMem dc from nothing Pin
mintguy22-Nov-05 23:58
mintguy22-Nov-05 23:58 
AnswerRe: Mem dc from nothing Pin
basementman23-Nov-05 4:11
basementman23-Nov-05 4:11 
Question[Message Deleted] Pin
jayshml22-Nov-05 23:17
jayshml22-Nov-05 23:17 
AnswerRe: How to avoid flickering in OnCustomDraw() ? Pin
BlackDice23-Nov-05 11:13
BlackDice23-Nov-05 11:13 
Questioncoding a ActiveX control Pin
munawar196822-Nov-05 23:04
munawar196822-Nov-05 23:04 
AnswerRe: coding a ActiveX control Pin
sanket.patel25-Nov-05 23:35
sanket.patel25-Nov-05 23:35 
QuestionCompilation Error Pin
Identity Undisclosed22-Nov-05 22:50
Identity Undisclosed22-Nov-05 22:50 
AnswerRe: Compilation Error Pin
Cool Ju23-Nov-05 0:02
Cool Ju23-Nov-05 0:02 
QuestionA Dynamic CString array cannot be deleted? Pin
StarMeteor22-Nov-05 22:21
StarMeteor22-Nov-05 22:21 
AnswerRe: A Dynamic CString array cannot be deleted? Pin
StarMeteor22-Nov-05 22:48
StarMeteor22-Nov-05 22:48 
AnswerRe: A Dynamic CString array cannot be deleted? Pin
kakan22-Nov-05 22:57
professionalkakan22-Nov-05 22:57 

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.