I need some help with windows programming
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!
Favorite Quotes:Gandalf: You cannot pass!|Smeagol: We don't need you!|Sloth: Hey you guys!|
If I remember right their is a LoadBitmap() that should load it and you need a Display() for bitmaps. Search MSDN for them.
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;
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;
Matt
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
Minister of Propaganda : leighstringer.com : Nobody likes the man who brings bad news - Sophocles (496 BC - 406 BC), Antigone
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
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
gatekeeper_prodwww.gatekeeperproductions.com
January 23, 2003 06:02 AM
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?
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]
Minister of Propaganda : leighstringer.com : Nobody likes the man who brings bad news - Sophocles (496 BC - 406 BC), Antigone
January 23, 2003 06:19 AM
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement