M
matt
I use the following code in OnInitDialog for a secondary window opened
in the main window by hitting DoModal():
P_Icons[0] = IDI_BACK;
HICON hIcon1 = (HICON)
::LoadImage(GetModuleHandle(NULL),MAKEINTRESOURCE(P_Icons[0]),IMAGE_ICON,38,41,LR_DEFAULTCOLOR);
m_hole_1.SetIcon(hIcon1);
UpdateData(FALSE);
This works the first time through, and the picture control's icon is
change periodically. However, when the window is destroyed (hitting
the OnOk button), and the window is re-created again from the main
window with DoModal again, the picture control shows the icon that was
last assigned before the window was last deleted, even though every
time this window is created, in its OnInitDialog, I specifically
assign it the same starting icon! How can this code be essentially
ignored in OnInitDialog?
To make things stranger, if I use the following line to load the icon
(instead of the one above), things work:
HICON hIcon1 = (HICON)
::LoadImage(NULL,P_Icons[0],IMAGE_ICON,38,41,LR_LOADFROMFILE);
m_hole_1.SetIcon(hIcon1);
UpdateData(FALSE);
Anyone have a clue what's going on? Is the first parameter in
LoadImage correct?
Thanks,
JM
in the main window by hitting DoModal():
P_Icons[0] = IDI_BACK;
HICON hIcon1 = (HICON)
::LoadImage(GetModuleHandle(NULL),MAKEINTRESOURCE(P_Icons[0]),IMAGE_ICON,38,41,LR_DEFAULTCOLOR);
m_hole_1.SetIcon(hIcon1);
UpdateData(FALSE);
This works the first time through, and the picture control's icon is
change periodically. However, when the window is destroyed (hitting
the OnOk button), and the window is re-created again from the main
window with DoModal again, the picture control shows the icon that was
last assigned before the window was last deleted, even though every
time this window is created, in its OnInitDialog, I specifically
assign it the same starting icon! How can this code be essentially
ignored in OnInitDialog?
To make things stranger, if I use the following line to load the icon
(instead of the one above), things work:
HICON hIcon1 = (HICON)
::LoadImage(NULL,P_Icons[0],IMAGE_ICON,38,41,LR_LOADFROMFILE);
m_hole_1.SetIcon(hIcon1);
UpdateData(FALSE);
Anyone have a clue what's going on? Is the first parameter in
LoadImage correct?
Thanks,
JM