HWND, HDC parameters

I have been trying to learn win32. All of the examples I look at are not complete. Is it ok to pass in HWND and HDC from WinMain, as parameters to a function I want to use in WinMain?
Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

int resourceYNMessageBox(HWND hWnd,HDC hdc)
{

	int messageBox = MessageBox(hWnd, _T("continue?"), _T("CHOOSE ANYTHING!"), MB_YESNO);

	TCHAR YesText[] =_T("You have chosen to continue!");
	TCHAR NoText[] =_T("You have chosen To fail");

	switch(messageBox)
	{
	case IDYES:
		
		::TextOut(hdc, 0, 0, YesText, ARRAYSIZE(YesText));
		break;
	case IDNO:
		
		::TextOut(hdc, 0,100, NoText, ARRAYSIZE(NoText));
		break;
	
	}
	return messageBox;
}
Last edited on
Topic archived. No new replies allowed.