Jump to content
  • Advertisement
Sign in to follow this  
tdk_ratboy

UDM_SETRANGE problems.

This topic is 4996 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

I am trying to get an updown control working properly with it's buddy window. The relevant section of code is as follows:
LRESULT CALLBACK RemoteEditDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
	static HWND updownHwnd, portHwnd = NULL;
	NMUPDOWN *lpud = new NMUPDOWN;
	NMHDR *nmHdr = new NMHDR;
	TCHAR port[10];
	static int current = 0;
	int next = 0;
	switch(message)
	{
	case WM_INITDIALOG:
		CreateWindow(WC_IPADDRESS, NULL, WS_CHILD | WS_VISIBLE, 90, 37, 125, 25, hDlg,
			NULL, hInst, NULL);
		updownHwnd = CreateWindow(UPDOWN_CLASS, NULL, WS_CHILD | WS_VISIBLE | UDS_WRAP, 
			280, 37, 75, 25, hDlg, NULL, hInst, NULL);
		portHwnd = GetDlgItem(hDlg, IDC_PORT);
		SendMessage(updownHwnd, UDM_SETBUDDY, (WPARAM)portHwnd, 0);
		SendMessage(updownHwnd, UDM_SETRANGE, 0, (LPARAM) MAKELONG ((short)65535,(short)1));
		return TRUE;
		
	case WM_NOTIFY:
		nmHdr = (LPNMHDR)lParam;
		switch(nmHdr->code){
			case UDN_DELTAPOS:
				lpud = (LPNMUPDOWN)lParam;
				current = lpud->iPos;
				if(lpud->iDelta > lpud->iPos)
					current++;
				else
					current--;
				SendMessage(updownHwnd, UDM_SETPOS, 0, (LPARAM)current);
				wsprintf(port, "%d", current);
				SetDlgItemText(hDlg, IDC_PORT, (LPCTSTR)port);
				return 0;
		}
		break;

	case WM_COMMAND:
		if(LOWORD(wParam) == IDCANCEL)
			EndDialog(hDlg, LOWORD(wParam));
		break;
	}
	return FALSE;
}
[\source]

The up arrow is the only one that works and it changes from -1 to -2. The down arrow outputs a 0. If anyone can point out my mistake i'd appreciate it. Thanx!

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • 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!