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 1 1610
I'll answer the C++ related parts, the windowing stuff is off-topic here.
* bo*******@cs.com (matt) schriebt: 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)
This is a C cast.
Do you know which of the following,
static_cast
const_cast
reinterpret_cast
it corresponds to in this case?
If not then you're in trouble.
As a newbie, never use C casts.
::LoadImage(GetModuleHandle(NULL),MAKEINTRESOURCE( P_Icons[0]),IMAGE_ICON,38,41,LR_DEFAULTCOLOR);
Here you're using "magic numbers", 38 and 41.
Those will always get you into trouble.
Anyone have a clue what's going on? Is the first parameter in LoadImage correct?
This is a FAQ:
<url: http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.9>
By the nature of the question the FAQ isn't and cannot be complete, so
after _studying_ what the FAQ has to say on this question, also look around.
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: jeff |
last post by:
Hiya,
Im currently in the process of developing a picture browser, I want it
to run off a CD, basically I have 2 questions for the group.
The first is how do I get the program to only view the...
|
by: Sandra Setz |
last post by:
Hi,
Is it possible to assign the Picture property of a picturebox to the
Picture property of an image control?
I use an invisble picturebox to make some changes to a picture, but I
want to...
|
by: Lyn |
last post by:
I am trying to embed a picture into a Bound Object Frame (Me!Photograph)
with the following code which is based on MS article
http://support.microsoft.com/?id=158941:
strPathname =...
|
by: Regnab |
last post by:
I've got a YES/NO section of a report I'm making. Depending on certain
values, I want to circle either YES or NO. I've got the code working so
it'll show or hide the circle, but I can't seem to get...
|
by: Jerry S |
last post by:
Hi
I wonder if someone can help with this, because there's something I'm
not understanding right.
I've got a List Array of PictureBoxes.
If I call PictureBoxListArray.Clear(), and then...
|
by: Z D |
last post by:
Hello,
BACKGROUND:
==============
I've created a Windows User Control that contains an Image Control (among
other controls).
The user control handles the picture resize event. Whenever the...
|
by: MLH |
last post by:
Setting form's Picture property to another file from within
VBA doesn't repaint the form with new bitmap - for instance...
Me.Picture = "c:\pics\MyNewPic.jpg"
I tried
Me.Repaint
afterward,...
|
by: Jeff |
last post by:
Hey
(and thank you for reading my post)
In visual web developer 2005 express edition I've created a simple website
project..
At this website I want users who register to be able to upload a...
|
by: ziamughal |
last post by:
sir i have made a picture viewer application and i have a dirlistbox ,filelistbox ,drivelistbox and image list control on it .now when i select the drive where i have pictures and select the folder...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |