Click here to Skip to main content
15,920,110 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Winsock Problems Pin
Ken Mazaika22-Apr-03 13:28
Ken Mazaika22-Apr-03 13:28 
GeneralRe: Winsock Problems Pin
valikac22-Apr-03 14:29
valikac22-Apr-03 14:29 
GeneralRe: Winsock Problems Pin
basementman24-Apr-03 8:10
basementman24-Apr-03 8:10 
GeneralXP Style dialogs Pin
conetti22-Apr-03 10:39
conetti22-Apr-03 10:39 
GeneralRe: XP Style dialogs Pin
Neville Franks22-Apr-03 11:40
Neville Franks22-Apr-03 11:40 
GeneralDouble Click Pin
Anthony988722-Apr-03 10:16
Anthony988722-Apr-03 10:16 
GeneralRe: Double Click Pin
David Crow22-Apr-03 10:22
David Crow22-Apr-03 10:22 
GeneralCreateCompatibleBitmap Pin
georgiek5022-Apr-03 10:13
georgiek5022-Apr-03 10:13 
Hi, I am trying to get a handle to part of a loaded bitmap using CreateCompatibleBitmap but after I select this bitmap into a DC and BitBlt it always comes out as a black square. Maybe I don't understand exactly how the function is supposed to work. Here is my code:

HBITMAP LoadPartialBitmap(HWND hwnd)
{
	HDC hdc, hdcMem;

	HBITMAP hBitmapMain;
	HBITMAP hBitmap;

	hBitmapMain    = (HBITMAP) LoadImage(NULL, "button.bmp", IMAGE_BITMAP,  0, 0, LR_LOADFROMFILE);
	
	hdc = GetDC(hwnd);
	hdcMem = CreateCompatibleDC(hdc);

	SelectObject(hdcMem, hBitmapMain);

	BitBlt(hdc, 0, 0, 30, 30, hdcMem, 20, 20, SRCCOPY);

	hBitmap = CreateCompatibleBitmap(hdc, 30, 30);

	ReleaseDC(hwnd, hdc);

	DeleteDC(hdcMem);

	return hBitmap;
}


Am I using this function completely wrong?
GeneralRe: CreateCompatibleBitmap Pin
Chris Losinger22-Apr-03 10:40
professionalChris Losinger22-Apr-03 10:40 
GeneralRe: CreateCompatibleBitmap Pin
georgiek5022-Apr-03 14:35
georgiek5022-Apr-03 14:35 
Generalvc++ 6 enviroment question Pin
tasoss22-Apr-03 9:55
tasoss22-Apr-03 9:55 
Question.net and windows forms and why use them? Pin
ns22-Apr-03 8:35
ns22-Apr-03 8:35 
AnswerRe: .net and windows forms and why use them? Pin
Maximilien22-Apr-03 9:10
Maximilien22-Apr-03 9:10 
GeneralRe: .net and windows forms and why use them? Pin
ns22-Apr-03 9:15
ns22-Apr-03 9:15 
AnswerRe: .net and windows forms and why use them? Pin
Ravi Bhavnani22-Apr-03 12:46
professionalRavi Bhavnani22-Apr-03 12:46 
Generaleasy question about convertion Pin
Martin_Viet22-Apr-03 8:17
Martin_Viet22-Apr-03 8:17 
GeneralRe: easy question about convertion Pin
Emiliano22-Apr-03 12:15
Emiliano22-Apr-03 12:15 
GeneralRe: easy question about convertion Pin
anju22-Apr-03 17:38
anju22-Apr-03 17:38 
GeneralWrite array to file Pin
Dominik Reichl22-Apr-03 7:53
Dominik Reichl22-Apr-03 7:53 
GeneralRe: Write array to file Pin
David Crow22-Apr-03 8:00
David Crow22-Apr-03 8:00 
GeneralRe: Write array to file Pin
Ryan_Roberts22-Apr-03 8:07
Ryan_Roberts22-Apr-03 8:07 
GeneralRe: Write array to file Pin
Dominik Reichl22-Apr-03 8:14
Dominik Reichl22-Apr-03 8:14 
GeneralRe: Write array to file Pin
Dominik Reichl22-Apr-03 8:11
Dominik Reichl22-Apr-03 8:11 
GeneralBasic Question. Pin
73Zeppelin22-Apr-03 7:48
73Zeppelin22-Apr-03 7:48 
GeneralRe: Basic Question. Pin
David Crow22-Apr-03 7:54
David Crow22-Apr-03 7:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.