Annotation of mstools/samples/mcitest/fileopen.c, revision 1.1.1.1

1.1       root        1: /*
                      2:     This is a very simple file open dbox.
                      3: */
                      4: 
                      5: #include <stdlib.h>
                      6: #include <stdio.h>
                      7: #include <string.h>
                      8: #include <windows.h>
                      9: #include "mcitest.h"
                     10: #include "commdlg.h"
                     11: 
                     12: 
                     13: // global stuff
                     14: 
                     15: static char szSearchSpec[_MAX_PATH];
                     16: 
                     17: // routine to invoke the standard file open dialog box
                     18: 
                     19: int DlgOpen(HANDLE hModule, HWND hParent, LPSTR lpName, int count)
                     20: {
                     21:        OPENFILENAME ofn;
                     22:        DWORD flags = OFN_FILEMUSTEXIST;
                     23:     strcpy(szSearchSpec, lpName);
                     24:     if (strlen(szSearchSpec) == 0) strcpy(szSearchSpec, "*.*");
                     25:     dprintf3("Search spec: %s", szSearchSpec);
                     26: 
                     27:     *lpName = 0;
                     28: 
                     29:     ofn.lStructSize         = sizeof(ofn);
                     30:     ofn.hwndOwner           = hParent;
                     31:     ofn.hInstance           = hModule;
                     32:     ofn.lpstrFilter         = "MCI Files\0*.mci\0All Files\0*.*\0";
                     33:     ofn.lpstrCustomFilter   = NULL;
                     34:     ofn.nMaxCustFilter      = 0;
                     35:     ofn.nFilterIndex        = 1;
                     36:     ofn.lpstrFile           = lpName;
                     37:     ofn.nMaxFile            = count;
                     38:     ofn.lpstrFileTitle      = NULL;
                     39:     ofn.nMaxFileTitle       = 0;
                     40:     ofn.lpstrInitialDir     = ".";
                     41:     ofn.lpstrTitle          = "File Open";
                     42:     ofn.Flags               = flags;
                     43:     ofn.nFileOffset         = 0;
                     44:     ofn.nFileExtension      = 0;
                     45:     ofn.lpstrDefExt         = szSearchSpec;
                     46:     ofn.lCustData           = 0;
                     47:     ofn.lpfnHook            = NULL;
                     48:     ofn.lpTemplateName      = NULL;
                     49: 
                     50: 
                     51:     dprintf3("Calling GetOpenFileName");
                     52:     if (GetOpenFileName(&ofn)) {
                     53:                return(1);
                     54:     } else {
                     55:                return(0);
                     56:        }
                     57: 
                     58: }
                     59: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.