Click here to Skip to main content
15,914,111 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: How can I verify the data when the focus leaves Pin
David Crow25-May-06 6:51
David Crow25-May-06 6:51 
AnswerRe: How can I verify the data when the focus leaves Pin
willbin25-May-06 15:18
willbin25-May-06 15:18 
GeneralRe: How can I verify the data when the focus leaves Pin
Ryan Binns25-May-06 18:52
Ryan Binns25-May-06 18:52 
GeneralRe: How can I verify the data when the focus leaves Pin
willbin25-May-06 22:16
willbin25-May-06 22:16 
GeneralRe: How can I verify the data when the focus leaves Pin
David Crow26-May-06 2:32
David Crow26-May-06 2:32 
QuestionInsert Button into Another App's Window Pin
tuckmeng25-May-06 5:48
tuckmeng25-May-06 5:48 
QuestionHow to create a vitual driver ? Pin
bengoan25-May-06 5:47
bengoan25-May-06 5:47 
QuestionText color in Win32 program Pin
LiYS25-May-06 4:35
LiYS25-May-06 4:35 
I just can't see why the following code doesn't change the text color to red.
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	HDC hdc = ::GetDC(hwnd);
	HPEN pen = ::CreatePen(PS_SOLID, 3, RGB(255, 0, 0));
	HGDIOBJ old;
	old = ::SelectObject(&hdc, pen);

	switch (message)
	{
	case WM_DESTROY:

		PostQuitMessage (0) ;
		return 0 ;
	case WM_LBUTTONDOWN:
		::TextOut(hdc, 100, 100, TEXT("Hello Windows"), 13);
		::SelectObject(hdc, old);
		return 0;

	}
	ReleaseDC (hwnd, hdc) ;

	return ::DefWindowProc (hwnd, message, wParam, lParam) ;
}


//////////////////////////////////////////////////////////////////////

LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
					PSTR szCmdLine, int iCmdShow)
{

	static TCHAR szAppName[] = TEXT ("HelloWin") ;		

	WNDCLASS     wndclass ;
	wndclass.style         = CS_HREDRAW | CS_VREDRAW ;
	wndclass.lpfnWndProc   = WndProc ;				 
	wndclass.cbClsExtra    = 0 ;
	wndclass.cbWndExtra    = 0 ;
	wndclass.hInstance     = hInstance ;			
	wndclass.hIcon         = LoadIcon (NULL, IDI_APPLICATION) ;	
	wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;		
	wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);	
	wndclass.lpszMenuName  = NULL ;
	wndclass.lpszClassName = szAppName;				

	if (!RegisterClass (&wndclass))
	{
		MessageBox (NULL, TEXT ("RegisterClass Fail!"), 
			szAppName, MB_ICONERROR) ;
		return 0 ;
	}


	HWND hwnd ;
	hwnd = CreateWindow (szAppName,		
		TEXT ("The Hello Program"),		
		WS_OVERLAPPEDWINDOW,		
		CW_USEDEFAULT,
		CW_USEDEFAULT,
		CW_USEDEFAULT,
		CW_USEDEFAULT,
		NULL,
		NULL,
		hInstance,			
		NULL);

	ShowWindow (hwnd, iCmdShow) ;
	UpdateWindow (hwnd) ;


	MSG          msg ;
	while (GetMessage (&msg, NULL, 0, 0))	
	{
		TranslateMessage (&msg) ;		
		DispatchMessage (&msg) ;		
	}
	return msg.wParam ;
} 




AnswerRe: Text color in Win32 program Pin
Hamid_RT25-May-06 5:06
Hamid_RT25-May-06 5:06 
AnswerRe: Text color in Win32 program Pin
Ryan Binns25-May-06 18:53
Ryan Binns25-May-06 18:53 
QuestionSetButtonInfo parameter Pin
Abhi Lahare25-May-06 4:33
Abhi Lahare25-May-06 4:33 
Questionstrange compiler's error Pin
NoName II25-May-06 3:59
NoName II25-May-06 3:59 
AnswerRe: strange compiler's error Pin
Chris Losinger25-May-06 4:01
professionalChris Losinger25-May-06 4:01 
AnswerRe: strange compiler's error Pin
Zac Howland25-May-06 6:31
Zac Howland25-May-06 6:31 
GeneralRe: strange compiler's error Pin
Steve S25-May-06 22:12
Steve S25-May-06 22:12 
GeneralRe: strange compiler's error Pin
Zac Howland26-May-06 4:32
Zac Howland26-May-06 4:32 
QuestionHelp Needed on DirectShow (very urgent) Pin
atimpoo25-May-06 3:29
atimpoo25-May-06 3:29 
QuestionError accessing CWinApp object in Win32 application Pin
Cyber Friend25-May-06 2:34
Cyber Friend25-May-06 2:34 
AnswerRe: Error accessing CWinApp object in Win32 application Pin
Chris Meech25-May-06 3:09
Chris Meech25-May-06 3:09 
AnswerRe: Error accessing CWinApp object in Win32 application Pin
NiceNaidu25-May-06 3:09
NiceNaidu25-May-06 3:09 
AnswerRe: Error accessing CWinApp object in Win32 application Pin
Hamid_RT25-May-06 3:30
Hamid_RT25-May-06 3:30 
AnswerRe: Error accessing CWinApp object in Win32 application Pin
Hans Ruck25-May-06 4:49
Hans Ruck25-May-06 4:49 
AnswerRe: Error accessing CWinApp object in Win32 application Pin
Zac Howland25-May-06 5:23
Zac Howland25-May-06 5:23 
AnswerRe: Error accessing CWinApp object in Win32 application Pin
Cyber Friend28-May-06 23:20
Cyber Friend28-May-06 23:20 
QuestionRegrading HTTP Digest Authentication Pin
mohsin_m25-May-06 2:31
mohsin_m25-May-06 2:31 

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.