LoadBitmap(hinstance2, MAKEINTRESOURCE(IDB_BITMAP7));
🔒 Locked
LoadBitmap(.....)
Advertisement
Original Post
Hey, I want my splash screen to appear with the comapny logo on it. The only problem is is that when I use LoadBitmap, it doesn''t work. Thsi is the first time I''ve had a problem with this function. Can anyone tell me what I''m doing wrong?
What do you mean "doesn''t work"? It returns 0? If you are on Win2000 or XP have you called GetLastError()? What was it''s value? Is the hinstance2 parameter correct?
Colin Jeanne | Invader''s Realm
"I forgot I had the Scroll Lock key until a few weeks ago when some asshole program used it. It even used it right" - Conner McCloud
"I forgot I had the Scroll Lock key until a few weeks ago when some asshole program used it. It even used it right" - Conner McCloud
The bitmap just doesn''t show up. It just doesn''t appear/
I called GetLastError, it returned 0. Now how do I fix this problem
o geez, lol wel lthat would explain it. Thanks, what would I use to display it then? Thanks for your time
Use SendMessage to send a STM_SETIMAGE message to the static image control. Or, you can use the Static_SetImage() macro defined in the header windowsx.h.
Thanks for your help, but the only problem is (and don't take this wrong I really do appreciate your help), is that I'm trying to load a bitmap into a POPUP window. So can I still use this? I thought static properties were things like rich-edits and lists and stuff (please correct me if I'm wrong and I'm sorry for being such a noob). Thanks again for all your help everyone. At least I'm getting somewhere.
Sathenzar | Demon Realms Studios®
[edited by - demonrealms on April 20, 2004 9:31:20 PM]
Sathenzar | Demon Realms Studios®
[edited by - demonrealms on April 20, 2004 9:31:20 PM]
quote:
Original post by demonrealms
Thanks for your help, but the only problem is (and don''t take this wrong I really do appreciate your help), is that I''m trying to load a bitmap into a POPUP window. So can I still use this? I thought static properties were things like rich-edits and lists and stuff (please correct me if I''m wrong and I''m sorry for being such a noob). Thanks again for all your help everyone. At least I''m getting somewhere.
Sathenzar | Demon Realms Studios®
[edited by - demonrealms on April 20, 2004 9:31:20 PM]
Statics are their own controls.
You can also handle the WM_PAINT message for your window. Take a look here.
"I forgot I had the Scroll Lock key until a few weeks ago when some asshole program used it. It even used it right" - Conner McCloud
Ok, in that case, use the WM_PAINT message. During your program''s initialization, after you create the main window, call GetDC() to get an HDC, call CreateCompatibleDC() with the previous HDC as an argument to create a memory DC, and call SelectObject() on the new DC and the HBITMAP of your bitmap. Make sure you keep the HDC created from CreateCompatibleDC() - you need to call ReleaseDC during your program''s shutdown. Ok, now when you receive a WM_PAINT message, call BeginPaint() to get an HDC, then call BitBlt() using the HDC from BeginPaint() as the first HDC parameter and the HDC created earlier using CreateCompatibleDC as the second HDC parameter, and finally call EndPaint(). It''s a rather ugly process. I may have forgotton something, but I *think* this should work. It''s really much easier with a static control, since Windows takes care of all of the painting.
Thanks everyone. I''ll try that tomorrow (gtg to bed, big test tomorrow), I go to go to bed for now. Later and thakns for all the help!
Sathenzar Demon Realms Studios®
Sathenzar Demon Realms Studios®
The only problem isa that I get this error:
What''s wrong? What option do I pick?
CreateCompatibleDC(hdc2);
SelectObject(&hdc2, LoadBitmap(hinstance2, BITMAP);
----------------------------
Error(s) here
--------------------Configuration: project SIAD - Win32 Debug--------------------
Compiling...
project SIAD.cpp
C:\Projects for VC++\project SIAD\project SIAD.cpp(57) : warning C4060: switch statement contains no ''case'' or ''default'' labels
C:\Projects for VC++\project SIAD\project SIAD.cpp(72) : warning C4101: ''buffer'' : unreferenced local variable
C:\Projects for VC++\project SIAD\project SIAD.cpp(141) : error C2275: ''BITMAP'' : illegal use of this type as an expression
c:\program files\microsoft visual studio\vc98\include\wingdi.h(486) : see declaration of ''BITMAP''
C:\Projects for VC++\project SIAD\project SIAD.cpp(141) : error C2143: syntax error : missing '')'' before '';''
C:\Projects for VC++\project SIAD\project SIAD.cpp(141) : error C2664: ''SelectObject'' : cannot convert parameter 1 from ''struct HDC__ ** '' to ''struct HDC__ *''
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.
project SIAD.obj - 3 error(s), 2 warning(s)
The only problem isa that I get this error:
What''s wrong? What option do I pick?
CreateCompatibleDC(hdc2);
SelectObject(&hdc2, LoadBitmap(hinstance2, BITMAP);
----------------------------
Error(s) here
--------------------Configuration: project SIAD - Win32 Debug--------------------
Compiling...
project SIAD.cpp
C:\Projects for VC++\project SIAD\project SIAD.cpp(57) : warning C4060: switch statement contains no ''case'' or ''default'' labels
C:\Projects for VC++\project SIAD\project SIAD.cpp(72) : warning C4101: ''buffer'' : unreferenced local variable
C:\Projects for VC++\project SIAD\project SIAD.cpp(141) : error C2275: ''BITMAP'' : illegal use of this type as an expression
c:\program files\microsoft visual studio\vc98\include\wingdi.h(486) : see declaration of ''BITMAP''
C:\Projects for VC++\project SIAD\project SIAD.cpp(141) : error C2143: syntax error : missing '')'' before '';''
C:\Projects for VC++\project SIAD\project SIAD.cpp(141) : error C2664: ''SelectObject'' : cannot convert parameter 1 from ''struct HDC__ ** '' to ''struct HDC__ *''
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.
project SIAD.obj - 3 error(s), 2 warning(s)
You have errors elsewhere in your code than the two lines posted as well as in the two lines posted.
CreateCompatibleDC(hdc2);
SelectObject(&hdc2, LoadBitmap(hinstance2, BITMAP);
Remove the & operator from hdc2 in the SelectObject() call. I dont think your bitmap resource is named BITMAP. If it is, choose another name, if it is not use the correct name.
Colin Jeanne | Invader''s Realm
"I forgot I had the Scroll Lock key until a few weeks ago when some asshole program used it. It even used it right" - Conner McCloud
CreateCompatibleDC(hdc2);
SelectObject(&hdc2, LoadBitmap(hinstance2, BITMAP);
Remove the & operator from hdc2 in the SelectObject() call. I dont think your bitmap resource is named BITMAP. If it is, choose another name, if it is not use the correct name.
"I forgot I had the Scroll Lock key until a few weeks ago when some asshole program used it. It even used it right" - Conner McCloud
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement