A bit of trouble...

Started by
15 comments, last by ShadowOfVengeance 19 years, 10 months ago
quote:Original post by uber_n00b
Ah I see the problem is solved. Well my job is done


Hehe, yeah I guess it is

BUT...(There's always a but eh? )

I have a question regarding something totally different(About bitmaps), so Im wondering if I should post it here, or create a new thread about it(I don't want to annoy anyone by creating many threads)

Im going to go with the first choice and just post it here, and if you think it's more suitable for me to create a new thread I will

Well my question is:

I'm writing a program that has a picture.

I changed the picture's ID from IDC_STATIC to IDC_PICTURE because I want to be able to change the picture at run time. And I created a variable from it and called it m_Picture.

I imported two bitmaps(IDB_BITMAP1 and IDB_BITMAP2). I applied IDB_BITMAP1 to the picture, so when I run the program it's there by default. As for IDB_BITMAP2, I want to be able to apply it to the picture when I click a button during runtime.

Now the problem is here:
m_Picture.SetBitmap( );

What exactly am I supposed to be placing between the brackets? Im pretty sure it's a handle, but how can I know what the handle of the bitmap is if all I have it it's ID (IDB_BITMAP2). Thanks for the help (Btw, I only started learning MFC yesterday, so if this question is extremely easy(I bet it is) I apologize, but after all, Im still new so please bear with me)

Thanks again for reading this





[edited by - ShadowOfVengeance on June 6, 2004 7:53:46 PM]
_____________________________Fade to Black...
Advertisement
ShadowOfVengeance, if you're using C++, why not use C++ strings ?

your code would be like:
char tmppathholder[256];char *tmpfilename;GetFullPathName("Hi",256,tmppathholder,&tmpfilename); string pathholder(tmppathholder);string filename(tmpfilename);int pos=pathholder.rfind('\\'); // reverse find for '\'pathholder=pathholder.substr(0,pos);


about your 2nd question, i don't do MFC, but if all you need is a handle to a bitmap resource, you can get it with the win32 LoadBitmap.
eg. HBITMAP hbb=LoadBitmap(hinstance,MAKEINTRESOURCE(IDB_BITMAP2));

hope this helps,
VRAM Strider.

[edited by - VStrider on June 6, 2004 8:19:51 PM]

[edited by - VStrider on June 6, 2004 8:20:19 PM]
___________________________________________________VRAM_Strider."This is the same damn ship that blows panels everytime it is shot, gets stolen on numerous occasions, has next to no security on any of its computer systems, allows almost anyone into the heart of the ship, and places the bridge and all the exec offices on the top of the ship?That enterprise?"
Thanks alot VStrider

Oh btw, I tried using this:
HBITMAP hbb=LoadBitmap(hinstance,MAKEINTRESOURCE(IDB_BITMAP2));

but it says that hinstance is "Undeclared Identifier" I guess that is because Im using MFC. I started wanting to know what the handle to the bitmap is, now I need a handle to the application lol!

Can anyone good with MFC help me here?
_____________________________Fade to Black...
you usually get this handle in WinMain. hehe, MFC hides all that, only to find out that you need them later on. no wonder why i don''t like MFC.

try this:
HINSTANCE hinstance=GetModuleHandle(NULL);

VRAM Strider.
___________________________________________________VRAM_Strider."This is the same damn ship that blows panels everytime it is shot, gets stolen on numerous occasions, has next to no security on any of its computer systems, allows almost anyone into the heart of the ship, and places the bridge and all the exec offices on the top of the ship?That enterprise?"
Hehe it worked! Thanks VStrider, you said you didn''t know much MFC but you just keep giving me answers, lol thanks man!

Well know I finished my first MFC program, and I wanted to send it to my friend. So I saw him on MSN messenger, and I sent him the .exe(I navigated to the debug folder and just choose it)

After receiving the .exe, he double clicked it, and it said:
"the application has failed to run because mfcd4.dll was not found,re-installing the apllication may fix the problem"

So how exactly am I supposed to be distributing my program, apparently just taking the .exe from the debug folder doesn''t work lol! Any ideas anyone?
_____________________________Fade to Black...
your system has debug libraries on it. your friends doesn''t

build a release version. your friend will have those libraries on their system.
Thanks for the answer

Once again displaying my ignorance... How do I build a release version?


Edit:
Nevermind, I found out how(Set Active Configuration)

[edited by - ShadowOfVengeance on June 7, 2004 7:41:41 AM]
_____________________________Fade to Black...

This topic is closed to new replies.

Advertisement