-
September 14th, 2010, 03:02 AM
#1
drawing a bitmap to the screen
hello,
im playing counter-strike 1.6 and the aiming cross hairs ( the X in the middle of the screen ) is not centered properly
so im trying to build a console application that would load a bitmap that i created and place it at the coordinates 512,384
here is what i have of the code untill now..
#include <windows.h>
#include <tchar.h>
int main()
{
HDC hdc = CreateCompatibleDC(NULL);
HBITMAP cross = (HBITMAP)LoadImage(NULL, _T("E:\\cross.bmp") ,IMAGE_BITMAP,0,0, LR_LOADFROMFILE | LR_CREATEDIBSECTION | LR_DEFAULTSIZE);
SelectObject(hdc, cross);
while (1)
{
HDC hdc_x = GetDC(HWND_DESKTOP);
BitBlt(hdc_x,488,359,48,48,hdc,0,0,LR_LOADFROMFILE);
ReleaseDC(HWND_DESKTOP,hdc_x);
}
return 0;
}
my problem with that, is that its not loading the image, and its showing me a black box and not the image
can somebody help me with this
-
September 14th, 2010, 03:50 AM
#2
Re: drawing a bitmap to the screen
BitBlt(hdc_x,488,359,48,48,hdc,0,0,LR_LOADFROMFILE);
The last argument is not correct. It should be SRCCOPY.
LR_LOADFROMFILE has a value of 16, which gives the same result as the BLACKNESS flag.
Besides, the error codes should be tested. See http://www.runicsoft.com/bmp.php
-
September 14th, 2010, 05:08 AM
#3
Re: drawing a bitmap to the screen
omg thank you very much !!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|