Article View: comp.os.os2.programmer
Article #3004More Trouble with WinFileDlg
From: BEEBE,GARY E
Date: Tue, 17 Nov 1992 15:49
Date: Tue, 17 Nov 1992 15:49
98 lines
3170 bytes
3170 bytes
Hello All,
I am still having problems with the WinFileDlg API function
and would like to solicite some information. In general,
what I am trying to do is use the WinFileDlg function to
return a path\filename of a file selected to be opened in
the default OPEN style dialog box. The following section of
code has not entirely worked:
#define INCL_PM
#define INCL_DOSFILEMGR
#define INCL_DOSERRORS
#define INCL_WINSTDDLG
#define INCL_WINSTDFILE
#define INCL_WIN
#define INCL_DOSMEMMGR
#define INCL_DOSQUEUES
#define INCL_DOSSEMAPHORES
#define INCL_DEV
#include "V_PLOT_2.h"
APIRET open_file(HFILE *fptr,HWND hWndOwner)
{
CHAR buffer[4];
APIRET Dlgrc;
FILEDLG Dlgdat;
ULONG OpenAction;
strcpy(buffer,"*.*");Dlgdat.cbSize=sizeof(FILEDLG);
Dlgdat.fl= FDS_CENTER| FDS_OPEN_DIALOG
FDS_PRELOAD_VOLINFO;
Dlgdat.pszTitle=(PSZ)NULL;
Dlgdat.pszIType=(PSZ)NULL;
Dlgdat.pszOKButton=(PSZ)NULL;
/* Dlgdat.pfnDlgProc=(PFNWP)NULL;
Dlgdat.hMod=(HMODULE)NULL;*/
Dlgdat.usDlgId=(USHORT)0;
Dlgdat.pszIType=(PSZ)NULL;
Dlgdat.papszITypeList=(PAPSZ)NULL;
Dlgdat.pszIDrive=(PSZ)NULL;
Dlgdat.papszIDriveList=(PAPSZ)NULL;
WinFileDlg(HWND_DESKTOP,hWndOwner,&Dlgdat);
Dlgrc=DosOpen(Dlgdat.szFullFile , fptr , &OpenAction
,0,0,OPEN_ACTION_FAIL_IF_NEW,
OPEN_SHARE_DENYREADWRITE|OPEN_ACCESS_READONLY,0);
return(Dlgrc);
}
This code will compile properly but die at the WinFileDlg
call with a protection violation. If prior to the WinFileDlg
call the Dlgdat.pfnDlgProc and Dlgdat.hMod variables are set
to NULL (for example in IDBG) then the dialog procedure
appears to work fine. If the comments are removed from the
"open_file" section of code so that the Dlgdat.pfnDlgProc
and Dlgdat.hMod variables are set to NULL prior to
compilation, then the compiler dies with the following
error:
Invocation of <NMAKE.EXE> begins
Invocation string: /f V_PLOT_2.MAK
<---------------------------------------------------------->
Operating System/2 Program Maintenance Utility
Version 2.000.000 Dec 02 1991
Copyright (C) IBM Corporation 1988-1991.
Copyright (C) Microsoft Corp. 1988-1991.
All rights reserved.
ICC.EXE /Sn /Q /Ls /Lx /Ti /W1 /Gs- /Gf .\V_PLOT_2.c
D:\IBMC\WKFRAME\v_plot_2\V_PLOT_2.c(417:39) : severe error
EDC0002: Unexpected compiler error #C0000005:2FA2D occurred.
NMAKE : fatal error U1077: 'D:\OS2\CMD.EXE' :
return code '12'
Stop.
<Make - Vector Plotter for OS/2> ended tc = 0 rc = 2 at
11-16-1992 21:41
Will a CSD update fix this problem? I'm open to suggestions.
Thanks in advance,
Gary
P.S. Sorry about the M's :*)
--
BEEBE,GARY E
Georgia Institute of Technology, Atlanta Georgia, 30332
uucp: ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gb8
Internet: gb8@prism.gatech.edu
Technical Details
Message-ID:
<75110@hydra.gatech.EDU>Path:
arc1-ca.pugleaf.net!sparky!uunet!gumby!destroyer!gatech!prism!gb8Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!gumby!destroyer!gatech!prism!gb8 From: gb8@prism.gatech.EDU (BEEBE,GARY E) Newsgroups: comp.os.os2.programmer Subject: More Trouble with WinFileDlg Message-ID: <75110@hydra.gatech.EDU> Date: 17 Nov 92 15:49:06 GMT Organization: Georgia Institute of Technology Lines: 98