Beispiel #1
0
/*
 * We need a sub-callback to read the content of the edit box on exit and update
 * our path, else if what the user typed does match the selection, it is discarded.
 * Talk about a convoluted way of producing an intuitive folder selection dialog
 */
INT CALLBACK BrowseDlgCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch(message) {
	case WM_DESTROY:
		GetWindowTextU(hBrowseEdit, szFolderPath, sizeof(szFolderPath));
		break;
	}
	return (INT)CallWindowProc(pOrgBrowseWndproc, hDlg, message, wParam, lParam);
}
Beispiel #2
0
BOOL CALLBACK dialog_proc_2(HWND dialog, UINT message,
							WPARAM wParam, LPARAM lParam)
{
	static device_context_t *device = NULL;
	static HWND hToolTip;
	char tmp[MAX_TEXT_LENGTH];
	int val;

	switch (message)
	{

	case WM_INITDIALOG:
		SendMessage(dialog,WM_SETICON,ICON_SMALL, (LPARAM)mIcon);
		SendMessage(dialog,WM_SETICON,ICON_BIG,   (LPARAM)mIcon);

		device = (device_context_t *)lParam;

		if (device)
		{
			wdi_is_driver_supported(WDI_LIBUSB0, &device->driver_info);

			//g_hwndTrackingTT = CreateTrackingToolTip(dialog,TEXT(" "));
			hToolTip = create_tooltip(dialog, g_hInst, 300, tooltips_dlg2);

			memset(tmp, 0, sizeof(tmp));
			safe_sprintf(tmp,sizeof(tmp) - 1, "0x%04X", device->wdi->vid);
			SetWindowText(GetDlgItem(dialog, ID_TEXT_VID), tmp);

			memset(tmp, 0, sizeof(tmp));
			safe_sprintf(tmp,sizeof(tmp) - 1, "0x%04X", device->wdi->pid);
			SetWindowText(GetDlgItem(dialog, ID_TEXT_PID), tmp);


			memset(tmp, 0, sizeof(tmp));
			if (device->wdi->is_composite)
				safe_sprintf(tmp,sizeof(tmp) - 1, "0x%02X", device->wdi->mi);
			SetWindowText(GetDlgItem(dialog, ID_TEXT_MI), tmp);

			SetWindowTextU(GetDlgItem(dialog, ID_TEXT_MANUFACTURER),
				device->manufacturer);

			SetWindowTextU(GetDlgItem(dialog, ID_TEXT_DEV_NAME),
				device->description);
		}
		return TRUE;

	case WM_COMMAND:
		switch (LOWORD(wParam))
		{
		case ID_BUTTON_NEXT:
			//memset(device, 0, sizeof(*device));
			device->wdi->is_composite=false;

			GetWindowTextU(GetDlgItem(dialog, ID_TEXT_MANUFACTURER),
				device->manufacturer, sizeof(tmp));

			GetWindowTextU(GetDlgItem(dialog, ID_TEXT_DEV_NAME),
				device->description, sizeof(tmp));

			GetWindowText(GetDlgItem(dialog, ID_TEXT_VID), tmp, sizeof(tmp));
			if(sscanf(tmp, "0x%04x", &val) == 1)
				device->wdi->vid = (WORD)val;

			GetWindowText(GetDlgItem(dialog, ID_TEXT_PID), tmp, sizeof(tmp));
			if(sscanf(tmp, "0x%04x", &val) == 1)
				device->wdi->pid = (WORD)val;

			GetWindowText(GetDlgItem(dialog, ID_TEXT_MI), tmp, sizeof(tmp));

			if (sscanf(tmp, "0x%02x", &val) == 1)
			{
				device->wdi->mi = (BYTE)val;
				device->wdi->is_composite=true;
			}
			if (save_file(dialog, device))
				EndDialog(dialog, ID_DIALOG_3);
			return TRUE ;
		case ID_BUTTON_BACK:
			EndDialog(dialog, ID_DIALOG_1);
			return TRUE ;
		case ID_BUTTON_CANCEL:
		case IDCANCEL:
			EndDialog(dialog, 0);
			return TRUE ;
		}
	}

	return FALSE;
}