home *** CD-ROM | disk | FTP | other *** search
- #include "stdafx.h"
- #include "HTBfileopen.h"
- #include "export.h"
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- BEGIN_MESSAGE_MAP(CHTBfileopenApp, CWinApp)
- //{{AFX_MSG_MAP(CHTBfileopenApp)
- // NOTE - the ClassWizard will add and remove mapping macros here.
- // DO NOT EDIT what you see in these blocks of generated code!
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- CHTBfileopenApp::CHTBfileopenApp()
- {
- }
-
- CHTBfileopenApp theApp;
-
- void Fileopen(void *RetBuffer, char * FoRetVal, char * foP1, char * foP2, char * foP3, long foP4)
- {
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
-
- DWORD dwFlags; //Flag to define Dialog Box style and appearence.
- dwFlags = foP4;
-
-
- BOOL bOpenFileDialog = TRUE;
- LPCTSTR lpszDefExt = foP1; //The default filename extension.
- LPCTSTR lpszFileName = foP2; //The initial filename that appears in the filename edit box.
- LPCTSTR lpszFilter = foP3; //file extension filters.
-
- CWnd* pParentWnd;
- pParentWnd = CWnd::FromHandle(g_hBasicWindow);
- pParentWnd = pParentWnd->GetTopWindow();
-
-
- CFileDialog FileOpener(bOpenFileDialog, //CFileDialog assignment.
- lpszDefExt,
- lpszFileName,
- dwFlags,
- lpszFilter,
- pParentWnd);
-
- FileOpener.m_ofn.hwndOwner = g_hBasicWindow;
-
-
- FileOpener.DoModal(); //call the assignment.
-
- if(OFN_ALLOWMULTISELECT & dwFlags) //if the multiselect flag is set then
- { //put all the names into the HTB buffer
- POSITION pos;
- pos = FileOpener.GetStartPosition();
- while(pos)
- {
- strcpy(FoRetVal, FileOpener.GetNextPathName(pos)); //copy the string to FoRetVal.
- PutBuffer(RetBuffer,FoRetVal,1); //put the string in the HTB buffer
- }
- }
- else
- {
- strcpy(FoRetVal, FileOpener.GetPathName()); //copy the string to FoRetVal.
- PutBuffer(RetBuffer,FoRetVal,1); //put the string in the HTB buffer
- }
- }
-
- void Saveas(char * SaRetVal, char * SaP1, char * SaP2, char * SaP3, long SaP4)
- {
-
- DWORD dwFlags; //Flag to define Dialog Box style and appearence.
- dwFlags = SaP4;
-
-
- BOOL bSaveAsDialog = FALSE;
- LPCTSTR lpszDefExt = SaP1; //The default filename extension.
- LPCTSTR lpszFileName = SaP2; //The initial filename that appears in the filename edit box.
- LPCTSTR lpszFilter = SaP3; //file extension filters.
-
- CWnd* pParentWnd;
- pParentWnd = CWnd::FromHandle(g_hBasicWindow);
- pParentWnd = pParentWnd->GetTopWindow();
-
- CFileDialog SaveAsFunc(bSaveAsDialog, //CFileDialog assignment.
- lpszDefExt,
- lpszFileName,
- dwFlags,
- lpszFilter,
- pParentWnd);
-
- SaveAsFunc.DoModal(); //call the assignment.
- strcpy(SaRetVal, SaveAsFunc.GetPathName()); //copy the string to SaRetVal.
- }
-