home *** CD-ROM | disk | FTP | other *** search
- // vbxdemo.cpp : Defines the class behaviors for the application.
- //
-
- #include "stdafx.h"
- #include "vbxdemo.h"
- #include "resources.h"
- #include "3ddemo.h"
- #include "animdemo.h"
- #include "combodem.h"
- #include "editdemo.h"
- #include "fcombode.h"
- #include "gaugedem.h"
- #include "linedemo.h"
- #include "listdemo.h"
- #include "flistdem.h"
- #include "spindemo.h"
- #include "textdemo.h"
- #include "picbtnde.h"
- #include "tabdemo.h"
- #include "ddropdem.h"
-
- #include "maindlg.h"
- #include <sys\types.h>
- #include <sys\stat.h>
-
-
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CVbxdemoApp
-
- BEGIN_MESSAGE_MAP(CVbxdemoApp, CWinApp)
- //{{AFX_MSG_MAP(CVbxdemoApp)
- // 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
- // Standard file based document commands
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CVbxdemoApp construction
-
- CVbxdemoApp::CVbxdemoApp()
- {
- // TODO: add construction code here,
- // Place all significant initialization in InitInstance
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // The one and only CVbxdemoApp object
-
- CVbxdemoApp NEAR theApp;
-
- /////////////////////////////////////////////////////////////////////////////
- // CVbxdemoApp initialization
-
- BOOL CVbxdemoApp::InitInstance()
- {
- // Standard initialization
- // If you are not using these features and wish to reduce the size
- // of your final executable, you should remove from the following
- // the specific initialization routines you do not need.
-
- SetDialogBkColor(); // Set dialog background color to gray
- LoadStdProfileSettings(); // Load standard INI file options (including MRU)
- EnableVBX(); // Initialize VBX support
-
- // Register the application's document templates. Document templates
- // serve as the connection between documents, frame windows and views.
- if ( !AreVBXHere() )
- return TRUE;
-
- IsHlpHere( TRUE );
-
- CMainDlg mainDlg;
- /*AfxGetApp()->*/m_pMainWnd = &mainDlg;
- mainDlg.DoModal();
-
-
- return TRUE;
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- // VB-Event registration
- // (calls to AfxRegisterVBEvent will be placed here by ClassWizard)
-
- //{{AFX_VBX_REGISTER_MAP()
- UINT NEAR VBN_DBLCLICK = AfxRegisterVBEvent("DBLCLICK");
- UINT NEAR VBN_KEYDOWN = AfxRegisterVBEvent("KEYDOWN");
- UINT NEAR VBN_UPDATE = AfxRegisterVBEvent("UPDATE");
- UINT NEAR VBN_SCROLLUP = AfxRegisterVBEvent("SCROLLUP");
- UINT NEAR VBN_SCROLLDN = AfxRegisterVBEvent("SCROLLDN");
- UINT NEAR VBN_SELCHANGE = AfxRegisterVBEvent("SELCHANGE");
- UINT NEAR VBN_CLICK = AfxRegisterVBEvent("CLICK");
- UINT NEAR VBN_GOTFOCUS = AfxRegisterVBEvent("GOTFOCUS");
- UINT NEAR VBN_FILEDROPPED = AfxRegisterVBEvent("FILEDROPPED");
- //}}AFX_VBX_REGISTER_MAP
-
- /////////////////////////////////////////////////////////////////////////////
- // CVbxdemoApp commands
-
- // -----------------------------------------------------------------------------------------
- // AreVBXHere
- // Check VBXs
- // -----------------------------------------------------------------------------------------
- BOOL AreVBXHere()
- {
- /* CString FAR szWinDir, szName, szErrorMsg;
- GetSystemDirectory( szWinDir.GetBuffer(250), 248 );
- szWinDir.ReleaseBuffer();
- if ( szWinDir.GetLength() > 3 )
- szWinDir += "\\";
- szName = szWinDir;
- szName += "SPINDLL.DLL";
- if ( !Exist( szName ) )
- goto NOT_FOUND;
- szName = szWinDir;
- szName += "VBSPIN.VBX";
- if ( !Exist( szName ) )
- goto NOT_FOUND;
- szName = szWinDir;
- szName += "VBLIST.VBX";
- if ( !Exist( szName ) )
- goto NOT_FOUND;
- szName = szWinDir;
- szName += "VBFLIST.VBX";
- if ( !Exist( szName ) )
- goto NOT_FOUND;
- szName = szWinDir;
- szName += "VBCOMBO.VBX";
- if ( !Exist( szName ) )
- goto NOT_FOUND;
- szName = szWinDir;
- szName += "VBFCOMBO.VBX";
- if ( !Exist( szName ) )
- goto NOT_FOUND;
- szName = szWinDir;
- szName += "VB3D.VBX";
- if ( !Exist( szName ) )
- goto NOT_FOUND;
- szName = szWinDir;
- szName += "VBANIM.VBX";
- if ( !Exist( szName ) )
- goto NOT_FOUND;
- szName = szWinDir;
- szName += "VBDDROP.VBX";
- if ( !Exist( szName ) )
- goto NOT_FOUND;
- szName = szWinDir;
- szName += "VBEDIT.VBX";
- if ( !Exist( szName ) )
- goto NOT_FOUND;
- szName = szWinDir;
- szName += "VBGAUGE.VBX";
- if ( !Exist( szName ) )
- goto NOT_FOUND;
- szName = szWinDir;
- szName += "VBLINE.VBX";
- if ( !Exist( szName ) )
- goto NOT_FOUND;
- szName = szWinDir;
- szName += "VBNOTE.VBX";
- if ( !Exist( szName ) )
- goto NOT_FOUND;
- szName = szWinDir;
- szName += "VBPICBTN.VBX";
- if ( !Exist( szName ) )
- goto NOT_FOUND;
- szName = szWinDir;
- szName += "VBTAB.VBX";
- if ( !Exist( szName ) )
- goto NOT_FOUND;
- szName = szWinDir;
- szName += "VBTEXT.VBX";
- if ( !Exist( szName ) )
- goto NOT_FOUND;
- return TRUE;
- NOT_FOUND:
- szErrorMsg = "Error!\n\n";
- szErrorMsg += szName;
- szErrorMsg += "\nnot found: to run this demo you must put all VBX Studio VBXs in\nthe WINDOWS\\SYSTEM directory.";
- AfxMessageBox( szErrorMsg, MB_OK | MB_ICONSTOP );
- return FALSE;
- */
- return TRUE; }
-
-
- // -----------------------------------------------------------------------------------------
- // IsHlpHere
- // Check VBXSTD12.HLP
- // -----------------------------------------------------------------------------------------
- BOOL IsHlpHere( BOOL bShowWarning )
- {
- CString FAR szWinDir, szName, szErrorMsg;
- GetSystemDirectory( szWinDir.GetBuffer(250), 248 );
- szWinDir.ReleaseBuffer();
- if ( szWinDir.GetLength() > 3 )
- szWinDir += "\\";
- szName = szWinDir;
- szName += "VBXSTD12.HLP";
- if ( !Exist( szName ) )
- {
- if ( bShowWarning )
- {
- szErrorMsg = "Warning!\n\n";
- szErrorMsg += szName;
- szErrorMsg += "\nnot found. To use this file you must put it in this directory.";
- AfxMessageBox( szErrorMsg, MB_OK | MB_ICONEXCLAMATION );
- }
- return FALSE;
- }
- return TRUE;
- }
-
-
- // -----------------------------------------------------------------------------------------
- // Exist
- // Check a file
- // -----------------------------------------------------------------------------------------
- BOOL Exist( LPCSTR szName )
- {
- struct _stat StatBuf;
- if ( _stat( szName, &StatBuf ) )
- return FALSE;
- if ( StatBuf.st_mode & _S_IFDIR )
- return FALSE;
- return TRUE;
- }
-