Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Ademan555

Unselectable window???

This topic is 5397 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
Advertisement
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?

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!