• Advertisement

Archived

This topic is now archived and is closed to further replies.

I need some help with windows programming

This topic is 5506 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have been programming c++ for about a year now and just took my first bite out of windows programming. I can create a window, but when I started getting into DC''s and bitmaps i got confussed. If I wanted to just display a .bmp I would have to use BitBlt() or something similar right? But I can never get the program to work when I try it. I don''t know if i''m doing things in the wrong order or not. You could say i''s confussed. Thanks in advance.
Favorite Quotes:Gandalf: You shall not pass!|Gollum: My Precious!|Smeagol: My little hobbitses.| My website!

Share this post


Link to post
Share on other sites
Advertisement
If I remember right their is a LoadBitmap() that should load it and you need a Display() for bitmaps. Search MSDN for them.

Share this post


Link to post
Share on other sites
HANDLE hImage = LoadImage(NULL, Path, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);

HDC hDC = GetDC(g_hWndMain); // Handle to a device context for drawing

// Create a device context that is compatible with the main DC
HDC hImageDC = CreateCompatibleDC(hDC);

BITMAP Bitmap; // Structure to hold info about the bmp
SIZE ImageSize; // Holds the dimensions of the bmp

// Get info about the bitmap that we loaded into memory
GetObject(hImage, sizeof(BITMAP), &Bitmap);

// Get the dimensions for the bimap
ImageSize.cx = Bitmap.bmWidth;
ImageSize.cy = Bitmap.bmHeight;

// Select the image into the device context
SelectObject(hImageDC, hImage);

// Copy the image to the main device context
BitBlt(hDC, 0, 0, ImageSize.cx, ImageSize.cy, hImageDC, 0, 0, SRCCOPY);

// Delete the DC for the bitmap
DeleteDC(hImageDC);

// Release the main DC
ReleaseDC(g_hWndMain, hDC);

return 0;

Share this post


Link to post
Share on other sites
quote:
Original post by SSJCORY


Favorite Quotes:Gandalf: You shall not pass!|Gollum: My Precious!|Smeagol: My little hobbitses.|
My website!



I don''t mind you blatantly ripping off my signature, but why have a link to "My Website" when you don''t seem to have a website??? That link leads to a GameDev.net -- Page not found error???


pan narrans | My Website | Study + Hard Work + Loud Profanity = Good Code

Share this post


Link to post
Share on other sites
pan narrans:
I just have to say, your sig speaks so much truth. Many of us have been there so many times.

Study + Hard Work + Loud Profanity = Good Code

gatekeeper_prod
www.gatekeeperproductions.com

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by SSJCORY
I don''t mind you blatantly ripping off my signature, but why have a link to "My Website" when you don''t seem to have a website??? That link leads to a GameDev.net -- Page not found error???



What makes you think it is a ripoff of your signature?

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
What makes you think it is a ripoff of your signature?

I posted in a thread he started a few days ago about his signature and I proposed he put it all on one line seperated by the | symbol.

Anyway, then his sig appears like that and the "My Website" link of his actually linked to my website!

I don't really mind, but I don't see why he needs the link to "My Website" when it doesn't actually link to anything.

*shrugs*

[EDIT: HIS ORIGINAL SIG]
Favorite Quotes:
Gandalf: You shall not pass.
Smeagol: My Precccious!
Smeagol: My little hobbitses
Can you tell i'm a lotr fan!!!
I hope so.
[/EDIT]

It's definately better now!


pan narrans | My Website | Study + Hard Work + Loud Profanity = Good Code

[edited by - pan narrans on January 23, 2003 7:18:05 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by pan narrans
I posted in a thread he started a few days ago about his signature and I proposed he put it all on one line seperated by the | symbol.

Anyway, then his sig appears like that and the "My Website" link of his actually linked to my website!

I don''t really mind, but I don''t see why he needs the link to "My Website" when it doesn''t actually link to anything.

*shrugs*

[EDIT: HIS ORIGINAL SIG]
Favorite Quotes:
Gandalf: You shall not pass.
Smeagol: My Precccious!
Smeagol: My little hobbitses
Can you tell i''m a lotr fan!!!
I hope so.
[/EDIT]

It''s definately better now!



I see, ;-) Well some simply don''t have the imagination I suppose.

Share this post


Link to post
Share on other sites

  • Advertisement