Skip to main content
GameDev.net gamedev.net
🔒 Locked

Unselectable window???

Started by Ademan555 Jan 11, 2004 at 11:39 PM 4 replies 350+ views
Original Post
Ademan555
Ademan555
Ok, i have two windows, one is created from the other's wndproc, but for some reason i cant select the second window.... they both have the styles WS_SYSMENU and nothing else, and yet, i can only selecte the first one... (click on it and bring it into focus) got any ideas? WndProc1
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
{
	static SockParams SP = {0};

	switch(uMessage)
	{
	case WM_CREATE:
	CreateWindow("EDIT", NULL, WS_CHILD|WS_VISIBLE|WS_BORDER|ES_MULTILINE, 0, 0, 512, 256, hWnd, (HMENU)ID_DISPLAYEDIT, NULL, NULL);
	CreateWindow("EDIT", NULL, WS_CHILD|WS_VISIBLE|WS_BORDER|ES_MULTILINE, 0, 256, 512-128, 256, hWnd, (HMENU)ID_SENDEDIT, NULL, NULL);
	CreateWindow("BUTTON", "Send", WS_CHILD|WS_VISIBLE|WS_BORDER, 512-128, 256, 128, 256, hWnd, (HMENU)ID_SENDBUTTON, NULL, NULL);
	break;
	case WM_DESTROY:
	case WM_CLOSE:
		PostQuitMessage(0);
		break;
	case WM_COMMAND:
		switch (LOWORD(wParam))
		{
		case ID_MENUSERVER:
			_beginthread(SERVERSTARTUP, 0, (void*)&SP);
			AddToEdit(GetDlgItem(hWnd, ID_DISPLAYEDIT), "\r\r\nNOTICE: Starting Up As Server", 32);
			break;
		case ID_MENUCLIENT:
			ClientConnect(&SP);
			break;
		case ID_SENDBUTTON:
			if (SP.bConnected)
			{
				send(SP.Sock, hWnd);
			}
			else
			{
				AppendWndText(hWnd);
				AddToEdit(GetDlgItem(hWnd, ID_DISPLAYEDIT), "\r\r\nERROR: Not Connected\r\r\n", 26);
			}
			break;
		case ID_DISPLAYEDIT:
		case ID_SENDEDIT:
			break;
		}
		break;
	case WM_KEYDOWN:
		if (wParam==VK_RETURN)
		{
			send(SP.Sock, hWnd);
		}
		break;
	default:
		return DefWindowProc(hWnd, uMessage, wParam, lParam);
	}
	return 0;
}
WndProc2
LRESULT CALLBACK IPProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
{
	switch(uMessage)
	{
	case WM_CREATE:
		CreateWindow("EDIT", NULL, WS_CHILD|WS_VISIBLE|ES_NUMBER, 4+2, 4, 32, 12, hWnd, (HMENU)ID_ED1, NULL, NULL);
		SendMessage(GetDlgItem(hWnd, ID_ED1), EM_SETLIMITTEXT, 2, NULL);
		CreateWindow("EDIT", NULL, WS_CHILD|WS_VISIBLE|ES_NUMBER, 8+32+2, 4, 32, 12, hWnd, (HMENU)ID_ED2, NULL, NULL);
		SendMessage(GetDlgItem(hWnd, ID_ED2), EM_SETLIMITTEXT, 2, NULL);
		CreateWindow("EDIT", NULL, WS_CHILD|WS_VISIBLE|ES_NUMBER, 12+64+2, 4, 32, 12, hWnd, (HMENU)ID_ED3, NULL, NULL);
		SendMessage(GetDlgItem(hWnd, ID_ED3), EM_SETLIMITTEXT, 2, NULL);
		CreateWindow("EDIT", NULL, WS_CHILD|WS_VISIBLE|ES_NUMBER, 16+96+2, 4, 32, 12, hWnd, (HMENU)ID_ED4, NULL, NULL);
		SendMessage(GetDlgItem(hWnd, ID_ED4), EM_SETLIMITTEXT, 2, NULL);
		CreateWindow("BUTTON", "&Accept", WS_CHILD|WS_VISIBLE, 16, 8+12+4, 128-8, 24, hWnd, (HMENU)ID_BOK, NULL, NULL);
		break;
	case WM_COMMAND:
		if (LOWORD(lParam)==ID_BOK)
		{
			//******//

			//GET IP//or not, thats an old comment

			//******//i dont wanna do it from here anymore

		}
		break;
	case WM_DESTROY:
	case WM_CLOSE:
		PostQuitMessage(0);
		break;
	default:
		return DefWindowProc(hWnd, uMessage, wParam, lParam);
	}
	return 0;
}
-Dan Yes I realize im a n00b... [edited by - Ademan555 on January 11, 2004 12:39:36 AM]
When General Patton died after World War 2 he went to the gates of Heaven to talk to St. Peter. The first thing he asked is if there were any Marines in heaven. St. Peter told him no, Marines are too rowdy for heaven. He then asked why Patton wanted to know. Patton told him he was sick of the Marines overshadowing the Army because they did more with less and were all hard-core sons of bitches. St. Peter reassured him there were no Marines so Patton went into Heaven. As he was checking out hi
Ademan555
Ademan555
No one has any clue?

-Dan

Yes I realize im a n00b...
When General Patton died after World War 2 he went to the gates of Heaven to talk to St. Peter. The first thing he asked is if there were any Marines in heaven. St. Peter told him no, Marines are too rowdy for heaven. He then asked why Patton wanted to know. Patton told him he was sick of the Marines overshadowing the Army because they did more with less and were all hard-core sons of bitches. St. Peter reassured him there were no Marines so Patton went into Heaven. As he was checking out hi
Mathematix
Mathematix
This is just a guess, but you appear to be spawning a load if child windows without a parent one.

Also, do you intend to have each of the windows running separate processes on individual threads?
Ademan555
Ademan555
Well i thought a WndProc on its own IS a thread... maybe im wrong though...

"you appear to be spawning a load if child windows without a parent one."

What do you mean by this? If your talking about the edit boxes or buttons, they all have parent windows, as for the other window, hte one created from the WndProc.... That one doesnt have the WS_CHILD style, and does not have a parent hWnd specified...
When General Patton died after World War 2 he went to the gates of Heaven to talk to St. Peter. The first thing he asked is if there were any Marines in heaven. St. Peter told him no, Marines are too rowdy for heaven. He then asked why Patton wanted to know. Patton told him he was sick of the Marines overshadowing the Army because they did more with less and were all hard-core sons of bitches. St. Peter reassured him there were no Marines so Patton went into Heaven. As he was checking out hi
Ademan555
Ademan555
hmmm??

-Dan

Yes I realize im a n00b...
When General Patton died after World War 2 he went to the gates of Heaven to talk to St. Peter. The first thing he asked is if there were any Marines in heaven. St. Peter told him no, Marines are too rowdy for heaven. He then asked why Patton wanted to know. Patton told him he was sick of the Marines overshadowing the Army because they did more with less and were all hard-core sons of bitches. St. Peter reassured him there were no Marines so Patton went into Heaven. As he was checking out hi
Ademan555
Ademan555
Ok, i seem to have found the problem on my own, but...
my solution was to GetNextWindow() from my WinMain in order to get a handle for both windows, and then processed both of their messages from the WinMain, which doesnt seem necessary, is there a way around this? or what?
thanx

-Dan

Yes I realize im a n00b...
When General Patton died after World War 2 he went to the gates of Heaven to talk to St. Peter. The first thing he asked is if there were any Marines in heaven. St. Peter told him no, Marines are too rowdy for heaven. He then asked why Patton wanted to know. Patton told him he was sick of the Marines overshadowing the Army because they did more with less and were all hard-core sons of bitches. St. Peter reassured him there were no Marines so Patton went into Heaven. As he was checking out hi

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.