Click here to Skip to main content
15,891,770 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Window has no title... conflicting window styles? Pin
Sauce!16-Dec-09 20:49
Sauce!16-Dec-09 20:49 
GeneralRe: Window has no title... conflicting window styles? Pin
Code-o-mat16-Dec-09 20:55
Code-o-mat16-Dec-09 20:55 
GeneralRe: Window has no title... conflicting window styles? Pin
Sauce!16-Dec-09 21:34
Sauce!16-Dec-09 21:34 
GeneralRe: Window has no title... conflicting window styles? Pin
Code-o-mat16-Dec-09 21:50
Code-o-mat16-Dec-09 21:50 
GeneralRe: Window has no title... conflicting window styles? Pin
Sauce!17-Dec-09 0:44
Sauce!17-Dec-09 0:44 
GeneralRe: Window has no title... conflicting window styles? Pin
David Crow17-Dec-09 2:30
David Crow17-Dec-09 2:30 
GeneralRe: Window has no title... conflicting window styles? Pin
Sauce!17-Dec-09 2:57
Sauce!17-Dec-09 2:57 
GeneralRe: Window has no title... conflicting window styles? Pin
Sauce!17-Dec-09 3:54
Sauce!17-Dec-09 3:54 
I'm facepalming over this.

I really am.

I was just digging through MSDN docs on designing a window procedure, just for the hell of it.

It said the following: "The WM_NCCREATE message is sent just after your window is created, but if an application responds to this message by returning FALSE, CreateWindowEx function fails. The WM_CREATE message is sent after your window is already created."

I thought to myself, "hmm - maybe setWindowLong() is failing or doing something funny if the window only half-exists at this point. I'll try WM_CREATE instead"

lo and behold the title shows up!

msgRouter, fixed version:

LRESULT CALLBACK Window::msgRouter(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	//NOTE: The following messages may need to be handled here explicitly as they are sent
	//before CreateWindow() returns - WM_NCCREATE, WM_GETMINMAXINFO, WM_CREATE.
	
	if(msg == WM_CREATE)
	{
		//A window was created. Set the user data of the handle to the pointer passed in the call to createWindow()
		Window *window = reinterpret_cast<Window*>(reinterpret_cast<LPCREATESTRUCT>(lParam)->lpCreateParams);
		SetWindowLongPtr(hWnd, GWLP_USERDATA, reinterpret_cast<long>(window));
		return TRUE;
	}
	else
	{
		Window *window = (Window*)GetWindowLongPtr(hWnd, GWLP_USERDATA);

		if(window)
		{
			return window->wndProc(msg, wParam, lParam);
		}
	}

	return DefWindowProc(hWnd, msg, wParam, lParam);
}

GeneralRe: Window has no title... conflicting window styles? Pin
Code-o-mat17-Dec-09 8:33
Code-o-mat17-Dec-09 8:33 
QuestionUdp broadcast failed in vista Pin
ganesh.dp16-Dec-09 20:04
ganesh.dp16-Dec-09 20:04 
AnswerRe: Udp broadcast failed in vista Pin
KarstenK16-Dec-09 21:09
mveKarstenK16-Dec-09 21:09 
GeneralRe: Udp broadcast failed in vista Pin
ganesh.dp16-Dec-09 22:31
ganesh.dp16-Dec-09 22:31 
GeneralRe: Udp broadcast failed in vista Pin
KarstenK16-Dec-09 22:35
mveKarstenK16-Dec-09 22:35 
Questionerror PRJ0019: A tool returned an error code from "Registering ActiveX Control..." Issue Pin
itkid16-Dec-09 18:27
itkid16-Dec-09 18:27 
AnswerRe: error PRJ0019: A tool returned an error code from "Registering ActiveX Control..." Issue [modified] Pin
22491716-Dec-09 18:33
22491716-Dec-09 18:33 
GeneralRe: error PRJ0019: A tool returned an error code from "Registering ActiveX Control..." Issue Pin
itkid16-Dec-09 19:02
itkid16-Dec-09 19:02 
GeneralRe: error PRJ0019: A tool returned an error code from "Registering ActiveX Control..." Issue Pin
22491716-Dec-09 19:13
22491716-Dec-09 19:13 
GeneralRe: error PRJ0019: A tool returned an error code from "Registering ActiveX Control..." Issue Pin
itkid16-Dec-09 19:31
itkid16-Dec-09 19:31 
GeneralRe: error PRJ0019: A tool returned an error code from "Registering ActiveX Control..." Issue Pin
itkid16-Dec-09 19:32
itkid16-Dec-09 19:32 
AnswerRe: error PRJ0019: A tool returned an error code from "Registering ActiveX Control..." Issue Pin
KarstenK16-Dec-09 22:38
mveKarstenK16-Dec-09 22:38 
Questionreading writing to a file system Pin
hrishiS16-Dec-09 17:44
hrishiS16-Dec-09 17:44 
AnswerRe: reading writing to a file system Pin
Adam Roderick J16-Dec-09 17:56
Adam Roderick J16-Dec-09 17:56 
GeneralRe: reading writing to a file system [modified] Pin
hrishiS16-Dec-09 18:23
hrishiS16-Dec-09 18:23 
GeneralRe: reading writing to a file system Pin
Adam Roderick J16-Dec-09 21:51
Adam Roderick J16-Dec-09 21:51 
AnswerRe: reading writing to a file system Pin
Rajesh R Subramanian16-Dec-09 17:59
professionalRajesh R Subramanian16-Dec-09 17:59 

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.