|
-
February 23rd, 2006, 05:33 PM
#1
Icon in Dialog..
I am trying to add my dialog icon as part of the dialog also.
I am trying to do this with the dialog editor and using the "Picture Control" option..
Anyway, when I go to view the dialog the icon does not appear?
Anyone know how to do this?
*EDIT* When I test the dialog the icon is displayed in the dialog, however when it is brought up from the menu the icon is not there? Is it a possibility I am calling the dialog incorrectly?
-
February 23rd, 2006, 05:37 PM
#2
Re: Icon in Dialog..
We need code to see if you did something wrong
-
February 23rd, 2006, 05:50 PM
#3
Re: Icon in Dialog..
Code:
case WM_COMMAND:
switch(HIWORD(wparam))
{
if(LOWORD(wparam) == IDM_ABOUT)
{
DialogBox(0,MAKEINTRESOURCE(IDD_ABOUTBOX),0,AboutDlgProc);
}
}
That is a snippet where the dialog is selected..
Code:
INT_PTR CALLBACK AboutDlgProc( HWND hwnd , UINT msg , WPARAM wparam , LPARAM lparam)
{
switch(msg)
{
case WM_INITDIALOG:
{
SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(GetModuleHandle(0), MAKEINTRESOURCE(IDI_ADD)));
}
case WM_COMMAND:
switch(HIWORD(wparam))
{
case BN_CLICKED:
{
if(LOWORD(wparam) == IDOK)
EndDialog(hwnd,LOWORD(wparam));
}
if(LOWORD(wparam) == IDCANCEL)
EndDialog(hwnd,LOWORD(wparam));
break;
}
}
return false;
}
That is the Dialog Procedure..
Thanks for your help...
-
February 23rd, 2006, 06:08 PM
#4
Re: Icon in Dialog..
I think WM_INITDIALOG should return TRUE;
-
February 23rd, 2006, 06:18 PM
#5
Re: Icon in Dialog..
No sorry the dialog does not display at all then?
-
February 23rd, 2006, 11:36 PM
#6
Re: Icon in Dialog..
Sorted now..
-
February 25th, 2006, 12:44 AM
#7
Re: Icon in Dialog..
you should add message WM_PAINT in you AboutDlgProc as this:
Code:
case WM_PAINT:
{
HDC hdc;
PAINTSTRUCT ps;
hdc = BeginPaint(hwnd, &ps);
HANDLE hIcon = LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR);
DrawIconEx(hdc, 25, 40, (HICON)hIcon, 32, 32, 0, NULL, DI_IMAGE | DI_MASK);
DestroyIcon((HICON)hIcon);
EndPaint(hwnd, &ps);
}
break;
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|