home *** CD-ROM | disk | FTP | other *** search
- /*
- * OPENTEST.C -- Program to test the FileOpenDlg function.
- * Compile command used:
- * cl -c -AC -Os -Gs opentest.c
- */
-
- #define INCL_DOSFILEMGR
- #define INCL_WINWINDOWMGR
- #define INCL_WINDIALOGS
- #define INCL_DOSMISC
- #include <os2.h>
- #include <string.h>
- #include <malloc.h>
- #include "filedlg.h"
-
- void CALLBACK HelpProc( HWND hwnd );
-
- void main( void )
- {
- HAB hab = WinInitialize( 0 );
- HMQ hmq = WinCreateMsgQueue( hab,DEFAULT_QUEUE_SIZE );
- USHORT usPathLen;
- PSZ pszFile,pszBuf;
- HFILE hf;
- USHORT usAction;
- USHORT usResult;
-
- DosQSysInfo( 0,(PBYTE)&usPathLen,sizeof(USHORT) );
- pszFile = malloc( usPathLen );
- pszBuf = malloc( usPathLen );
-
- usResult = FileOpenDlg( HWND_DESKTOP,
- NULL,
- NULL,
- "*.*",
- FILE_NORMAL,
- HelpProc,
- pszFile,
- &hf,
- 0L,
- &usAction,
- FILE_NORMAL,
- FILE_OPEN,
- OPEN_ACCESS_READONLY|OPEN_SHARE_DENYWRITE,
- 0L );
-
- switch ( usResult ) {
- case FDLG_OK:
- strcpy( pszBuf,pszFile );
- break;
-
- case FDLG_CANCEL:
- strcpy( pszBuf,"Open file dialog box was cancelled." );
- break;
-
- default:
- strcpy( pszBuf,"Internal error in FileOpenDlg procedure." );
- break;
- }
-
- WinMessageBox( HWND_DESKTOP,HWND_DESKTOP,
- pszBuf,"Debugging information",
- 0,MB_OK|MB_NOICON );
-
- WinDestroyMsgQueue( hmq );
- WinTerminate( hab );
- }
-
- void CALLBACK HelpProc( HWND hwnd )
- {
- WinMessageBox( HWND_DESKTOP,hwnd,
- "This message box was activated by the HELP button.",
- "Help",
- 0,MB_OK|MB_NOICON );
- }
-