Go to the source code of this file.
Functions | |
| UINT APIENTRY | ColorDialogHook (HWND hdlg, UINT msg, WPARAM, LPARAM) |
| void | GetLightColor () |
| BOOL CALLBACK | NameOfProc (HWND hwnd, UINT Message, WPARAM wParam, LPARAM) |
|
||||||||||||||||||||
|
Definition at line 81 of file winfuncs.cpp. References DialogInUse, FALSE, and TRUE. Referenced by GetLightColor().
00082 {
00083 switch (msg)
00084 {
00085 case WM_INITDIALOG:
00086 {
00087 if(DialogInUse == 1) // Ambient
00088 SetWindowText(hdlg, "Choose Ambient Color");
00089 if(DialogInUse == 2) // Diffuse
00090 SetWindowText(hdlg, "Choose Diffuse Color");
00091 if(DialogInUse == 3) // Specular
00092 SetWindowText(hdlg, "Choose Specular Color");
00093 return TRUE;
00094 }
00095
00096 default:
00097 return FALSE;
00098 }
00099 }
|
|
|
Definition at line 101 of file winfuncs.cpp. References ColorDialogHook(), hWnd, and lightColor. Referenced by WinMain().
00102 {
00103 COLORREF colors[16];
00104 COLORREF colorRGB = RGB(lightColor[0]*255, lightColor[1]*255, lightColor[2]*255);
00105 CHOOSECOLOR colorDialog;
00106 memset(&colorDialog,0,sizeof(colorDialog));
00107 memset(colors,255,sizeof(colors));
00108 colorDialog.lStructSize = sizeof(CHOOSECOLOR);
00109 colorDialog.hwndOwner = hWnd;
00110 colorDialog.rgbResult = colorRGB;
00111 colorDialog.lpCustColors = colors;
00112 colorDialog.Flags = CC_FULLOPEN | CC_RGBINIT | CC_ENABLEHOOK;
00113 colorDialog.lpfnHook = (LPCCHOOKPROC)ColorDialogHook;
00114 ChooseColor(&colorDialog);
00115 lightColor[0] = (float)GetRValue(colorDialog.rgbResult)/255;
00116 lightColor[1] = (float)GetGValue(colorDialog.rgbResult)/255;
00117 lightColor[2] = (float)GetBValue(colorDialog.rgbResult)/255;
00118 }
|
|
||||||||||||||||||||
|
Definition at line 21 of file winfuncs.cpp. References BUFFER_SIZE, CurrentDirectory, FALSE, hWndOfDlg, ofn, testfloat, testint, teststring, and TRUE.
00022 {
00023 hWndOfDlg = hwnd;
00024 char szText[BUFFER_SIZE];
00025
00026 switch(Message)
00027 {
00028 case WM_INITDIALOG:
00029 hWndOfDlg = hwnd;
00030 GetCurrentDirectory(MAX_PATH, CurrentDirectory);
00031
00032 SendDlgItemMessage(hwnd, IDC_DLG_TEXT1, EM_SETLIMITTEXT, (WPARAM)BUFFER_SIZE - 1, (LPARAM)0);
00033 SendDlgItemMessage(hwnd, IDC_DLG_TEXT2, EM_SETLIMITTEXT, (WPARAM)BUFFER_SIZE - 1, (LPARAM)0);
00034 SendDlgItemMessage(hwnd, IDC_DLG_TEXT3, EM_SETLIMITTEXT, (WPARAM)BUFFER_SIZE - 1, (LPARAM)0);
00035
00036 SetDlgItemText(hWndOfDlg, IDC_DLG_TEXT1, "1");
00037
00038 SetDlgItemText(hWndOfDlg, IDC_DLG_TEXT2, "1.0");
00039
00040 SetDlgItemText(hWndOfDlg, IDC_DLG_TEXT3, "One");
00041 return TRUE;
00042
00043 case WM_COMMAND:
00044 switch(LOWORD(wParam))
00045 {
00046
00047 case IDCANCEL:
00048 EndDialog(hwnd, IDCANCEL);
00049 return TRUE;
00050
00051 case IDOK:
00052 GetDlgItemText(hwnd, IDC_DLG_TEXT1, szText, BUFFER_SIZE);
00053 testint = atoi(szText);
00054 GetDlgItemText(hwnd, IDC_DLG_TEXT2, szText, BUFFER_SIZE);
00055 testfloat = atof(szText);
00056 GetDlgItemText(hwnd, IDC_DLG_TEXT3, szText, BUFFER_SIZE);
00057 sprintf(teststring, "%s", szText);
00058 EndDialog(hwnd, IDOK);
00059 return TRUE;
00060
00061 case IDC_DLG_SETPATH:
00062 ZeroMemory(&ofn, sizeof(ofn));
00063 ofn.lStructSize = sizeof(ofn);
00064 ofn.hwndOwner = hWndOfDlg;
00065 ofn.lpstrFilter = "Text Files (*.txt)\0*.txt\0\0";
00066 ofn.lpstrFile = teststring;
00067 ofn.nMaxFile = MAX_PATH;
00068 ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
00069 ofn.lpstrDefExt = "txt";
00070 if(GetOpenFileName(&ofn))
00071 SetDlgItemText(hWndOfDlg, IDC_DLG_TEXT3, teststring);
00072 return TRUE;
00073
00074 }
00075 break;
00076 }
00077 return FALSE;
00078 }
|
1.2.15