View Full Version: Another problem

C++ Learning Community > win32 api C++ programming > Another problem


Title: Another problem
Description: Me again...


biggoron - December 28, 2006 05:12 PM (GMT)
I ditched Allegro and I'm having problems loading an image using LoadBitmap. If I use MAKEINTRESOURCE(IDB_IMAGE) it displays correctly. If I use the image's path to load the bitmap it crashes. If I use the latter method and try to close the window (even if I haven't loaded any image) it crashes.

I've attached a folder with all the stuff. Thanks in advance.

[edit]
Okay, it appears I need to read function definitions more carefully... >_> It appears this can only load compiled sprites from a program instance, so I need a function that opens one from the HDD. I've searched for quite a while around MSDN but I can't find the function I'm looking for.

adeyblue - December 29, 2006 12:54 AM (GMT)
Did you see LoadImage (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/Resources/IntroductiontoResources/ResourceReference/ResourceFunctions/LoadImage.asp) on your travels (I would have linkified it but the button ain't working). It's mentioned in the first line of the LoadBitmap page so I don't know how you didn't find it.

biggoron - December 29, 2006 01:39 AM (GMT)
Actually I did. I looked it up once but didn't know what to do with a "HANDLE". Then after failing with LoadBitmap I went to look it up but I guess I got caught up in something else and forgot about it >_> Then when you told me of it know I realised that I was supposed to typecast it (obviously) and now it works! :lol:

Thanks!




Hosted for free by InvisionFree