Changeset 29 for branches/1.0/src/uni.c
- Timestamp:
- Apr 21, 2010, 7:37:01 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.0/src/uni.c
r26 r29 12 12 #include <stdio.h> 13 13 #include <stdlib.h> 14 #include <process.h> 14 15 #include "utils.h" 15 16 … … 23 24 CHAR szTemp[ STR_LEN_PORTDESC ]; 24 25 CHAR pwBuffer[256]; 26 CHAR setupwiz[256]; 27 CHAR setupparms[256]; 25 28 USHORT i; 26 29 ULONG rc = 0; 27 30 PUCHAR token; 31 BOOL ulResult = MBID_ERROR; 32 BOOL fResult; 33 FILEDLG fd; 34 CHAR szMessage[ _MAX_PATH]; 35 CHAR szDrive[ _MAX_PATH]; 36 CHAR szDir[ _MAX_PATH]; 37 PSZ pszButtonCode; 28 38 29 39 switch (msg) … … 31 41 case WM_INITDLG: 32 42 // WinSendDlgItemMsg(hDlg,ID_BINARY,BM_SETCHECK,MPFROM2SHORT(1,0),NULL); 43 WinSendDlgItemMsg(hDlg,ID_PROGRAM, EM_SETTEXTLIMIT, MPFROMSHORT(128),NULL); 44 WinSendDlgItemMsg(hDlg,ID_PARAMETERS,EM_SETTEXTLIMIT, MPFROMSHORT(128),NULL); 45 WinSendDlgItemMsg(hDlg,ID_DIRECTORY, EM_SETTEXTLIMIT, MPFROMSHORT(128),NULL); 46 33 47 pUniData = (PUNIDATA)mp2; 34 48 WinSetWindowULong (hDlg, QWL_USER, (ULONG)pUniData); … … 158 172 WinDismissDlg(hDlg, TRUE); 159 173 break; 174 case DID_FIND: 175 // setup data 176 memset( &fd, 0, sizeof( fd)); 177 fd.cbSize = sizeof( fd); 178 fd.fl = FDS_CENTER | FDS_HELPBUTTON | FDS_OPEN_DIALOG; 179 fd.pszTitle = "Find executable"; 180 181 WinQueryDlgItemText (hDlg, ID_PROGRAM, sizeof(szTemp), szTemp ); 182 if (strlen(szTemp) > 0) { 183 _splitpath(szTemp, szDrive, szDir, NULL, NULL); 184 strncat(szDrive, szDir, strlen(szDir) -1); 185 strcat(szDrive,"\\*"); 186 strcpy( fd.szFullFile,szDrive); 187 } 188 else strcpy( fd.szFullFile, "C:\\*"); 189 190 // launch dialog 191 fResult = WinFileDlg( HWND_DESKTOP, hDlg, &fd); 192 if (!fResult) 193 sprintf( szMessage, "error launching WinFileDlg\n"); 194 else if (fd.lReturn == DID_OK) { 195 WinSetDlgItemText(hDlg,ID_PROGRAM,fd.szFullFile); 196 _splitpath(fd.szFullFile, szDrive, szDir, NULL, NULL); 197 strncat(szDrive, szDir, strlen(szDir) -1); 198 WinSetDlgItemText(hDlg,ID_DIRECTORY,szDrive); 199 } 200 else 201 sprintf( szMessage, "error occurred!\n"); 202 break; 203 case DID_SETUPWIZARD: 204 // preliminary 205 WinDismissDlg(hDlg, TRUE); 206 sprintf(setupwiz,"unipdrcfg.exe"); 207 rc = spawnlp(P_NOWAIT,setupwiz,setupwiz,pUniData->pszPortName,NULL); 208 // preliminary 209 WinDismissDlg(hDlg, TRUE); 210 break; 160 211 case DID_CANCEL: 161 212 WinDismissDlg(hDlg, MBID_CANCEL); … … 193 244 } 194 245 246 /* 247 static ULONG _launchFileDlg( HWND hwnd, HWND hwndBubbleHelp) 248 249 { 250 BOOL ulResult = MBID_ERROR; 251 BOOL fResult; 252 FILEDLG fd; 253 254 CHAR szMessage[ _MAX_PATH]; 255 PSZ pszButtonCode; 256 257 // stop bubble help 258 WtkDeactivateBubbleHelp( hwndBubbleHelp); 259 260 do 261 { 262 // setup data 263 memset( &fd, 0, sizeof( fd)); 264 fd.cbSize = sizeof( fd); 265 fd.fl = FDS_CENTER | FDS_HELPBUTTON | FDS_OPEN_DIALOG; 266 fd.pszTitle = "System File test dialog"; 267 strcpy( fd.szFullFile, "C:\\*"); 268 269 // launch dialog 270 fResult = WinFileDlg( HWND_DESKTOP, hwnd, &fd); 271 272 if (!fResult) 273 sprintf( szMessage, "error launching WinFileDlg\n"); 274 else if (fd.lReturn == DID_OK) 275 sprintf( szMessage, "file is: %s\n", fd.szFullFile); 276 else 277 sprintf( szMessage, "error occurred!\n"); 278 279 switch (fd.lReturn) 280 { 281 case DID_OK: pszButtonCode = "(DID_OK)"; break; 282 case DID_CANCEL: pszButtonCode = "(DID_CANCEL)"; break; 283 case DID_ERROR: pszButtonCode = "(DID_ERROR)"; break; 284 default: pszButtonCode = ""; break; 285 } 286 287 sprintf( &szMessage[ strlen( szMessage)], 288 "\015\015" 289 "return code is: %u %s\015" 290 "WinFileDlg error source code is: %u\015", 291 fd.lReturn, pszButtonCode, fd.lSRC); 292 293 WinMessageBox( HWND_DESKTOP, hwnd, szMessage, "File Dialog Result", 294 IDDLG_MSGBOX_RESULTFILEDLG, MB_MOVEABLE | MB_OK | MB_HELP); 295 296 // on error return error code 297 if (!fResult) 298 break; 299 300 // hand over result 301 ulResult = fd.lReturn; 302 303 } while (FALSE); 304 305 306 // restart bubble help 307 WtkActivateBubbleHelp( hwndBubbleHelp); 308 return ulResult; 309 } 310 */
Note:
See TracChangeset
for help on using the changeset viewer.