--- mstools/samples/mcitest/mcitest.c 2018/08/09 18:22:16 1.1.1.1 +++ mstools/samples/mcitest/mcitest.c 2018/08/09 18:24:31 1.1.1.2 @@ -34,11 +34,13 @@ \*----------------------------------------------------------------------------*/ #include +#include #include #include #include "mcitest.h" #include "mcimain.h" #include "edit.h" +#include "commdlg.h" /*----------------------------------------------------------------------------*\ @@ -58,9 +60,9 @@ \*----------------------------------------------------------------------------*/ #ifndef STATICDT #if DBG - #define STATICDT + #define STATICDT #else - #define STATICDT static + #define STATICDT static #endif #endif @@ -70,23 +72,23 @@ STATICDT HANDLE hInstApp; HWND hwndMainDlg = 0; STATICDT HWND hwndEdit = 0; STATICDT HWND hwndDevices = 0; -STATICDT char aszMciFile[BUFFER_LENGTH] = ""; -STATICDT char aszBuffer[BUFFER_LENGTH]; -STATICDT char aszExt[] = "*.mcs"; - char aszAppName[] = "MCITest"; -STATICDT char aszMainTextFormat[] = "%s - %s"; -STATICDT char aszDeviceTextFormat[] = "Open MCI Devices(count=%d)"; -STATICDT char aszNULL[] = ""; -STATICDT char aszTRUE[] = "TRUE"; -STATICDT char aszFALSE[] = "FALSE"; -STATICDT char aszEOL[] = "\r\n"; -STATICDT char aszOpenFileTitle[] = "Open MCITest File"; -STATICDT char aszSaveFileTitle[] = "Save MCITest File"; -STATICDT char aszSaveFileControl[] = "Save File &Name"; -STATICDT char aszProfileSection[] = "extensions"; -STATICDT char aszProfileKey[] = "mcs"; -STATICDT char aszProfileSetting[] = "mcitest.exe ^.mcs"; -STATICDT char aszMciTester[] = "MciTester"; +STATICDT TCHAR aszMciFile[BUFFER_LENGTH] = TEXT(""); +STATICDT TCHAR aszBuffer[BUFFER_LENGTH]; +STATICDT TCHAR aszExt[] = TEXT("*.mci"); + TCHAR aszAppName[] = TEXT("MCITest"); +STATICDT TCHAR aszMainTextFormat[] = TEXT("%s - %s"); +STATICDT TCHAR aszDeviceTextFormat[] = TEXT("Open MCI Devices(count=%d)"); +STATICDT TCHAR aszNULL[] = TEXT(""); +STATICDT TCHAR aszTRUE[] = TEXT("TRUE"); +STATICDT TCHAR aszFALSE[] = TEXT("FALSE"); +STATICDT TCHAR aszEOL[] = TEXT("\r\n"); +STATICDT TCHAR aszOpenFileTitle[] = TEXT("Open MCITest File"); +STATICDT TCHAR aszSaveFileTitle[] = TEXT("Save MCITest File"); +STATICDT TCHAR aszSaveFileControl[] = TEXT("Save File &Name"); +STATICDT TCHAR aszProfileSection[] = TEXT("extensions"); +STATICDT TCHAR aszProfileKey[] = TEXT("mcs"); +STATICDT TCHAR aszProfileSetting[] = TEXT("mcitest.exe ^.mcs"); +STATICDT TCHAR aszMciTester[] = TEXT("MciTester"); /*----------------------------------------------------------------------------*\ | | @@ -95,15 +97,16 @@ STATICDT char aszMciTester[] = "M \*----------------------------------------------------------------------------*/ BOOL mcitester(HWND hwnd, UINT Msg, LONG wParam, LONG lParam); -PSTR FileName(PSTR szPath); +PTSTR FileName(PTSTR szPath); STATICFN void update_device_list(void); -DWORD sendstring(HWND hwndDlg, PSTR strBuffer); +DWORD sendstring(HWND hwndDlg, PTSTR strBuffer); void execute( HWND hwndDlg, BOOL fStep); -void OpenMciFile( HWND hwndDlg, LPSTR szFile); +void OpenMciFile( HWND hwndDlg, LPTSTR szFile); BOOL AppInit(int argc, char *argv[]); BOOL ErrDlgFunc( HWND hwndDlg, UINT Msg, LONG w, LONG l ); void create_device_list(void); STATICFN BOOL devices(HWND hwndDlg, UINT Msg, LONG wParam, LONG lParam); +STATICFN void ProcessInternalCommand(HWND hDlg, LPTSTR aszBuffer); /*----------------------------------------------------------------------------*\ | AboutDlgProc( hwndDlg, Message, wParam, lParam ) | @@ -131,7 +134,7 @@ BOOL AboutDlgProc( LONG wParam, LONG lParam) { - dprintf4("AboutDlgProc"); + dprintf4((TEXT("AboutDlgProc"))); switch (Msg) { case WM_COMMAND: @@ -164,10 +167,10 @@ BOOL AboutDlgProc( | | \*----------------------------------------------------------------------------*/ -PSTR FileName( - PSTR szPath) +PTSTR FileName( + PTSTR szPath) { - PSTR szCurrent; /* temporary pointer to the string */ + PTSTR szCurrent; /* temporary pointer to the string */ /* Scan to the end of the string */ @@ -180,13 +183,13 @@ PSTR FileName( */ for (; szCurrent >= szPath - && !SLASH(*szCurrent) - && *szCurrent != ':' - ; szCurrent--) + && !SLASH(*szCurrent) + && *szCurrent != ':' + ; szCurrent--) {} ; - /* This should be done by calling a Win 32 function, e.g. GetFullPathName - */ + /* This should be done by calling a Win 32 function, e.g. GetFullPathName + */ /* Now pointing to the char before the first char in the filename. */ @@ -211,19 +214,17 @@ PSTR FileName( void OpenMciFile( HWND hwndDlg, - LPSTR lszFile) + LPTSTR lszFile) { - dprintf2("OpenMciFile: %s", lszFile); + dprintf2((TEXT("OpenMciFile: %s"), lszFile)); if (EditOpenFile(hwndEdit, lszFile)) { strcpy(aszMciFile, lszFile); - wsprintf(aszBuffer, aszMainTextFormat, (LPSTR)aszAppName, - (LPSTR)FileName(aszMciFile)); - dprintf3("Set caption: %s", aszBuffer); + wsprintf(aszBuffer, aszMainTextFormat, (LPTSTR)aszAppName, + (LPTSTR)FileName(aszMciFile)); + dprintf3((TEXT("Set caption: %s"), aszBuffer)); SetWindowText(hwndDlg, aszBuffer); - } else { - dprintf1("failed to open %s", lszFile); } } @@ -255,7 +256,7 @@ int get_number_of_devices( * into . */ - sysinfo.lpstrReturn = (LPSTR)(LPDWORD)&dwDevices; + sysinfo.lpstrReturn = (LPTSTR)(LPDWORD)&dwDevices; sysinfo.dwRetSize = sizeof(dwDevices); /* @@ -293,16 +294,13 @@ int get_number_of_devices( STATICFN void update_device_list( void) { - char aszBuf[BUFFER_LENGTH]; /* string used for several things */ + TCHAR aszBuf[BUFFER_LENGTH]; /* string used for several things */ MCI_SYSINFO_PARMS sysinfo; /* Parameter structure used for getting information about the devices in the system */ HWND hwndList; /* handle to the Devices listbox window */ int nDevices; int nCurrentDevice; -#if DBG - BOOL fNoRedraw = FALSE; -#endif /* If the Devices dialog is not present, then return */ @@ -316,20 +314,17 @@ STATICFN void update_device_list( /* Update the dialog caption appropriately */ - wsprintf(aszBuf, aszDeviceTextFormat, nDevices); - SetWindowText(hwndDevices, aszBuf); + wsprintf(aszBuf, aszDeviceTextFormat, nDevices); + SetWindowText(hwndDevices, aszBuf); /* Get a handle to the dialog's listbox, and prepare it for updating */ hwndList = GetDlgItem (hwndDevices, ID_DEVICE_LIST); SendMessage (hwndList, LB_RESETCONTENT, 0, 0L); - if (nDevices) { - SendMessage (hwndList, WM_SETREDRAW, FALSE, 0L); -#if DBG - fNoRedraw = TRUE; -#endif - } + if (nDevices) { + SendMessage (hwndList, WM_SETREDRAW, FALSE, 0L); + } /* * Get the name of each open device in the system, one device at a time. @@ -339,7 +334,7 @@ STATICFN void update_device_list( for (nCurrentDevice = 1; nCurrentDevice <= nDevices; ++nCurrentDevice) { sysinfo.dwNumber = nCurrentDevice; - sysinfo.lpstrReturn = (LPSTR)&aszBuf; + sysinfo.lpstrReturn = (LPTSTR)&aszBuf; sysinfo.dwRetSize = sizeof(aszBuf); /* If an error is encountered, skip to the next device. @@ -348,30 +343,20 @@ STATICFN void update_device_list( MCI_SYSINFO_OPEN | MCI_SYSINFO_NAME, (DWORD)(LPMCI_SYSINFO_PARMS)&sysinfo) != 0) { continue; - } + } /* Redraw the list when all device names have been added. */ if (nCurrentDevice == nDevices) { - /* About to add the last device - allow redrawing */ + /* About to add the last device - allow redrawing */ SendMessage(hwndList, WM_SETREDRAW, TRUE, 0L); -#if DBG - fNoRedraw = FALSE; -#endif - } + } /* Add the device name to the listbox. */ - SendMessage(hwndList, LB_ADDSTRING, 0, (LONG)(LPSTR)aszBuf); + SendMessage(hwndList, LB_ADDSTRING, 0, (LONG)(LPTSTR)aszBuf); } - -#if DBG - if (fNoRedraw) { // We had an error... - dDbgAssert("Assert failed, REDRAW is still off", __FILE__, __LINE__); - } -#endif - /* Remember the number of open devices we found this time */ nLastNumberOfDevices = nDevices; @@ -397,13 +382,13 @@ STATICFN void update_device_list( DWORD sendstring( HWND hwndDlg, - PSTR strBuffer) + PTSTR strBuffer) { - char aszReturn[BUFFER_LENGTH]; /* string containing the message + TCHAR aszReturn[BUFFER_LENGTH]; /* string containing the message returned by MCI */ DWORD dwErr; /* variable containing the return code from the MCI command */ - dprintf2("sendstring: %s", strBuffer); + dprintf2((TEXT("sendstring: %s"), strBuffer)); /* Uncheck the notification buttons */ @@ -461,21 +446,21 @@ BOOL ErrDlgFunc( LONG wParam, LONG lParam) { - dprintf4("ErrDlgFunc"); + dprintf4((TEXT("ErrDlgFunc"))); switch( Msg ) { - case WM_INITDIALOG: - return TRUE; - - - case WM_COMMAND: - switch( LOWORD(wParam) ) { // button pushed - case IDABORT: - case IDOK: - case IDIGNORE: - EndDialog( hwndDlg, LOWORD(wParam) ); // return button ID - break; - } - break; + case WM_INITDIALOG: + return TRUE; + + + case WM_COMMAND: + switch( LOWORD(wParam) ) { // button pushed + case IDABORT: + case IDOK: + case IDIGNORE: + EndDialog( hwndDlg, LOWORD(wParam) ); // return button ID + break; + } + break; } return( FALSE ); } @@ -518,7 +503,7 @@ void execute( */ iLineStart = EditGetCurLine(hwndEdit); - dprintf2("Called to execute %d lines from line %d", runcount, iLineStart); + dprintf2((TEXT("Called to execute %d lines from line %d"), runcount, iLineStart)); for (count = runcount; count-- > 0; ) { @@ -530,7 +515,12 @@ void execute( if (*aszBuffer == ';' || *aszBuffer == 0) { continue; - } + } + + if (*aszBuffer == '!' ) { // Internal command + ProcessInternalCommand(hwndDlg, aszBuffer+1); + continue; + } /* Select the line that is about to be processed */ @@ -603,7 +593,7 @@ STATICFN BOOL devices( case WM_COMMAND: - dprintf4("Devices -- WM_COMMAND"); + dprintf4((TEXT("Devices -- WM_COMMAND"))); switch (LOWORD(wParam)) { case ID_END_DEVICE_LIST: @@ -644,10 +634,9 @@ void create_device_list( hwndDevices = CreateDialog(hInstApp, MAKEINTRESOURCE(IDD_DEVICES), hwndMainDlg, (DLGPROC)devices); - //hwndDevices = CreateDialog (hInstApp, "devices", hwndMainDlg, (WNDPROC)devices); if (hwndDevices == NULL) { - dprintf1("NULL hwndDevices"); + dprintf1((TEXT("NULL hwndDevices"))); return; } @@ -681,7 +670,7 @@ BOOL mcitester( HWND hwndDlg, UINT Msg, LONG wParam, - LONG lParam) + LONG lParam) { DWORD dw; /* return value from various messages */ UINT EnableOrNot; /* is something currently selected? */ @@ -690,16 +679,20 @@ BOOL mcitester( #if DBG if (Msg != WM_MOUSEMOVE && Msg != WM_NCHITTEST && Msg != WM_NCMOUSEMOVE - && (Msg < WM_CTLCOLORMSGBOX || Msg > WM_CTLCOLORSTATIC) - && Msg != WM_SETCURSOR) { - dprintf4("hWnd: %08XH, Msg: %08XH, wParam: %08XH, lParam: %08XH", hwndDlg, Msg, wParam, lParam ); + && (Msg < WM_CTLCOLORMSGBOX || Msg > WM_CTLCOLORSTATIC) + && Msg != WM_SETCURSOR) { + dprintf4((TEXT("hWnd: %08XH, Msg: %08XH, wParam: %08XH, lParam: %08XH"), hwndDlg, Msg, wParam, lParam )); } #endif switch (Msg) { + case WM_CLOSE: + DestroyWindow( hwndDlg ); + break; + case WM_COMMAND: - dprintf3("WM_COMMAND, wParam: %08XH, lParam: %08XH", wParam, lParam); + dprintf3((TEXT("WM_COMMAND, wParam: %08XH, lParam: %08XH"), wParam, lParam)); switch (LOWORD(wParam)) { case IDOK: @@ -711,7 +704,7 @@ BOOL mcitester( */ SetFocus(hwndEdit); - i = EditGetCurLine(hwndEdit); + i = EditGetCurLine(hwndEdit); execute(hwndDlg, TRUE); @@ -719,7 +712,7 @@ BOOL mcitester( SendMessage(hwndEdit, WM_KEYDOWN, VK_END, 0L); SendMessage(hwndEdit, WM_KEYUP, VK_END, 0L); - SendMessage(hwndEdit, EM_REPLACESEL, 0,(LONG)(LPSTR)aszEOL); + SendMessage(hwndEdit, EM_REPLACESEL, 0,(LONG)(LPTSTR)aszEOL); break; @@ -749,7 +742,6 @@ BOOL mcitester( case MENU_EXIT: case ID_EXIT: - case IDCANCEL: /* * If the user indicates that he/she wishes to exit the @@ -757,11 +749,17 @@ BOOL mcitester( * message. * */ + DestroyWindow( hwndDlg ); + break; - EndDialog(hwndDlg,TRUE); - PostQuitMessage (0); - hwndMainDlg = 0; - + case IDCANCEL: + /* Ctrl+break will result in + 1. If there is an MCI command running, then breaking it (good) + 2. If there is NOT an MCI command running then the dialog manager will send + someone an IDCANCEL, and if we have the focus, we don't want to exit + by surprise. This means that to actually exit you'll have to do + Alt+F4 or else File manu and Exit to send (WM_COMMAND, ID_EXIT) + */ break; case MENU_ABOUT: @@ -779,7 +777,7 @@ BOOL mcitester( /* Pass whatever edit message we receive to the edit box */ // BUGBUG This might well be bogus - dprintf3("sending edit Msg to edit control"); + dprintf3((TEXT("sending edit Msg to edit control"))); SendMessage(hwndEdit, LOWORD(wParam), 0, 0); break; @@ -796,11 +794,12 @@ BOOL mcitester( /* If the user selected a valid file, then open it */ if ((int)f >= 0) - OpenMciFile(hwndDlg, aszBuffer); + OpenMciFile(hwndDlg, aszBuffer); #else strcpy(aszBuffer, aszExt); - i = DlgOpen(hInstApp, hwndDlg, aszBuffer, sizeof(aszBuffer) ); + i = DlgOpen(hInstApp, hwndDlg, aszBuffer, sizeof(aszBuffer), + OFN_FILEMUSTEXIST); /* If the user selected a valid file, then open it */ @@ -848,7 +847,8 @@ BOOL mcitester( #else strcpy(aszBuffer, aszExt); - i = DlgOpen(hInstApp, hwndDlg, aszBuffer, sizeof(aszBuffer) ); + i = DlgOpen(hInstApp, hwndDlg, aszBuffer, sizeof(aszBuffer) , + OFN_PATHMUSTEXIST | OFN_NOREADONLYRETURN | OFN_OVERWRITEPROMPT); /* * If the user didn't hit Cancel, then he must have set a @@ -857,7 +857,7 @@ BOOL mcitester( * */ - if (i != 2) { + if (i == 1) { EditSaveFile(hwndEdit, aszBuffer); } @@ -887,7 +887,8 @@ BOOL mcitester( dDbgSetDebugMenuLevel(wParam - IDM_DEBUG0); break; #endif - + default: /* no-op */ + break; } break; // end of WM_COMMAND case @@ -897,7 +898,7 @@ BOOL mcitester( hwndEdit = GetDlgItem(hwndDlg,ID_INPUT); - dprintf3("WM_INITDIALOG: hwndEdit = %08xH", hwndEdit); + dprintf3((TEXT("WM_INITDIALOG: hwndEdit = %08xH"), hwndEdit)); SetMenu(hwndDlg, LoadMenu(hInstApp, MAKEINTRESOURCE(IDM_MCITEST))); @@ -911,30 +912,26 @@ BOOL mcitester( SetDlgItemInt (hwndDlg, ID_RUNCOUNT, 1, TRUE); #if DBG - // Check the initial debug level - { - HANDLE hMenu; - hMenu = GetMenu(hwndDlg); - CheckMenuItem(hMenu, (UINT)(__iDebugLevel + IDM_DEBUG0), MF_CHECKED); - } + // Check the initial debug level + { + HANDLE hMenu; + hMenu = GetMenu(hwndDlg); + CheckMenuItem(hMenu, (UINT)(__iDebugLevel + IDM_DEBUG0), MF_CHECKED); + } #endif hAccTable = LoadAccelerators(hInstApp, MAKEINTRESOURCE(IDA_MCITEST)); - - dprintf4("INIT_DIALOG: hwndEdit = %08XH Haccel = %08XH,", hwndEdit, hAccTable); - + dprintf4((TEXT("INIT_DIALOG: hwndEdit = %08XH, Haccel = %08XH"), hwndEdit, hAccTable)); return TRUE; case WM_DESTROY: /* End the dialog and send a WM_QUIT message */ - dprintf2("dialog ending"); + dprintf2((TEXT("dialog ending"))); dSaveDebugLevel(aszAppName); - EndDialog(hwndDlg,TRUE); PostQuitMessage (0); hwndMainDlg = 0; - break; case MM_MCINOTIFY: @@ -945,10 +942,10 @@ BOOL mcitester( * */ - dprintf3("MM_MCINOTIFY, wParam: %08XH", wParam); + dprintf3((TEXT("MM_MCINOTIFY, wParam: %08XH"), wParam)); wID = 0; switch (wParam) { - case MCI_NOTIFY_SUCCESSFUL: + case MCI_NOTIFY_SUCCESSFUL: wID = ID_NOT_SUCCESS; break; @@ -982,7 +979,7 @@ BOOL mcitester( case WM_INITMENUPOPUP: /* wParam is menu handle */ - dprintf3("WM_INITMENUPOPUP"); + dprintf3((TEXT("WM_INITMENUPOPUP"))); /* Enable the 'Save' option if a valid filename exists */ @@ -1036,19 +1033,20 @@ BOOL AppInit( { /* Put up the main dialog box */ - hInstApp = GetModuleHandle(NULL); - dprintf1("MCITEST starting... module handle is %xH", hInstApp); + hInstApp = GetModuleHandle(NULL); + dprintf1((TEXT("MCITEST starting... module handle is %xH"), hInstApp)); if (NULL == (hwndMainDlg = CreateDialog (hInstApp, - MAKEINTRESOURCE(IDD_MCITEST),// "mcitester", - NULL, (DLGPROC)mcitester) + MAKEINTRESOURCE(IDD_MCITEST), + NULL, (DLGPROC)mcitester) )) { - DWORD n; - n = GetLastError(); - dprintf1("NULL hwndMainDLG, last error is %d", n); - DebugBreak(); + DWORD n; + + n = GetLastError(); + dprintf1((TEXT("NULL hwndMainDLG, last error is %d"), n)); + DebugBreak(); return(FALSE); } @@ -1064,8 +1062,19 @@ BOOL AppInit( * */ - if (argc > 1 && *argv[1]) + if (argc > 1 && *argv[1]) { +#ifdef UNICODE + LPTSTR lpCommandLine = GetCommandLine(); + + // Skip over the command name to get to the argument string + while (*lpCommandLine && *lpCommandLine++ != TEXT(' ')) { + } + + OpenMciFile(hwndMainDlg, lpCommandLine); +#else OpenMciFile(hwndMainDlg, argv[1]); +#endif + } return TRUE; } @@ -1100,7 +1109,7 @@ int _CRTAPI1 main( // If we are in DEBUG mode, get debug level for this module dGetDebugLevel(aszAppName); #if DBG - dprintf1("started (debug level %d)", __iDebugLevel); + dprintf1((TEXT("started (debug level %d)"), __iDebugLevel)); #endif /* Call the initialization procedure */ @@ -1128,6 +1137,7 @@ int _CRTAPI1 main( if (!hwndMainDlg || !IsDialogMessage(hwndMainDlg, &Msg)) { TranslateMessage(&Msg); DispatchMessage(&Msg); + // IsDialogMessage may enter with hwndMainDlg != NULL and exit with // hwndMainDlg == NULL after processing the message } @@ -1138,3 +1148,115 @@ int _CRTAPI1 main( return Msg.wParam; } + + +STATICDT TCHAR ms[] = TEXT("milliseconds"); +STATICDT TCHAR sc[] = TEXT("seconds"); +STATICDT TCHAR hr[] = TEXT("hours"); +STATICDT TCHAR mn[] = TEXT("minutes"); + +STATICFN void ProcessInternalCommand(HWND hDlg, LPTSTR aszBuffer) +{ + LPTSTR pch = aszBuffer; + TCHAR msg[80]; + + if( (0 == (strnicmp(aszBuffer, TEXT("SLEEP"),5))) + || (0 == (strnicmp(aszBuffer, TEXT("PAUSE"),5)))) { + + UINT factor = 1; + UINT number; + LPTSTR delay; + LPTSTR pch1; + pch += 5; // length SLEEP/PAUSE + while (*pch && *pch == TEXT(' ') ) { + pch++; + } + + if (!*pch) { + SetDlgItemText (hDlg, ID_OUTPUT, TEXT("No parameter provided for Sleep command")); + return; + } + +#ifdef UNICODE + wsprintf(msg "%hs", pch); // Convert string to ascii + number = atoi( msg ); +#else + number = atoi( pch ); +#endif + + if (0 == number) { + SetDlgItemText (hDlg, ID_OUTPUT, TEXT("Parameter is not a number")); + return; + } + + + // pch addresses the number + // Now see if there are any other parameters + // First, skip to the end of the number + + pch1 = pch+1; + while (*pch1 && *pch1 != TEXT(' ') ) { + pch1++; + } + + if (*pch1) { + *pch1++ = TEXT('\0'); + + // There is another parameter. Accept s/S for seconds, + // h/M for hours + // m/M for minutes + // Default is milliseconds + while (*pch1 && *pch1 == TEXT(' ') ) { + pch1++; + } + } + + switch (*pch1) { + case TEXT('s'): + case TEXT('S'): + delay = sc; + factor = 1000; + break; + case TEXT('m'): + case TEXT('M'): + delay = mn; + factor = 1000*60; + break; + case TEXT('h'): + case TEXT('H'): + delay = hr; + factor = 1000*60*60; + break; + case TEXT('\0'): + default: + delay = ms; + factor = 1; + break; + } + + wsprintf(msg, TEXT("Sleeping for %d %s"), number, delay); + SetDlgItemText (hDlg, ID_OUTPUT, msg); + Sleep(number*factor); + + } else if (0 == (strnicmp(aszBuffer, TEXT("CD"),2))) { + BOOL fResult; + pch += 2; // length CD + while (*pch && *pch == TEXT(' ') ) { + pch++; + } + fResult = SetCurrentDirectory(pch); + if (!fResult) { + UINT errorcode; + errorcode = GetLastError(); + wsprintf(msg, + TEXT("Set current directory to >%s< failed, error code==%d"), + pch, errorcode); + } else + wsprintf(msg, + TEXT("Set current directory to >%s<"), pch); + SetDlgItemText (hDlg, ID_OUTPUT, msg); + + } else { + SetDlgItemText (hDlg, ID_OUTPUT, TEXT("Unrecognised internal command")); + } +}