home *** CD-ROM | disk | FTP | other *** search
- Save Format v1.3
- @begin Form "WinExcel40"
- Exported 0;
-
- @begin Object "WDialog"
- WSCaption 1;
- WSSizeable 1;
- WSDlgBorder 1;
- WSSysMenu 1;
- WSSystemMenu 1;
- WSMinimizeBox 1;
- WSMaximizeBox 1;
- WSGroup 1;
- WSTabStop 1;
- WSResizeBorder 1;
- WSVisible 1;
- FormPositionType "Centered";
- FormAbsTop "336";
- FormAbsLeft "191";
- FDXStructName "WinExcel40FDXStruct";
- Font "8.MS Sans Serif";
- Text "Microsoft Excel 4.0 Example";
- @begin Event "Create"
- GencodeSrcLine 224;
- FunctionName "WinExcel40::WinExcel40_Create";
- @end;
- @begin UserFunction "WinExcel40()"
- Compiler 1;
- GencodeSrcLine 238;
- FunctionName "WinExcel40::WinExcel40()";
- @end;
- @begin UserFunction "~WinExcel40()"
- Compiler 1;
- GencodeSrcLine 242;
- FunctionName "WinExcel40::~WinExcel40()";
- @end;
- @begin UserFunction "Process( WWindow *parent )"
- GencodeSrcLine 246;
- FunctionName "WinExcel40::Process( WWindow *parent )";
- @end;
- @begin UserFunction "Prototype for Process( WWindow *parent )"
- Private 1;
- GencodeSrcLine 66;
- FunctionName "WinExcel40::Prototype for Process( WWindow *parent )";
- @end;
- ResID 106;
- DesignName WinExcel40;
- TabIndex 0;
- DesignRect 234,117,218,92;
- @end;
-
- @begin Object "WQuery"
- BindLimit "0";
- ConcurrencyLevel "WQCLLock";
- CursorType "WQCTDynamic";
- SQL "select * from excel40.xls\r\norder by Employee";
- Transaction "WinExcel40::transaction_excel40";
- AutoOpen "0";
- ResID 101;
- DesignName query_excel40;
- TabIndex 0;
- DesignRect 8,56,14,14;
- @end;
-
- @begin Object "WTransaction"
- DataSource "Excel 4.0 Optima Example";
- AutoConnect "0";
- ResID 102;
- DesignName transaction_excel40;
- TabIndex 1;
- DesignRect 28,56,14,14;
- @end;
-
- @begin Object "WTextBox"
- WTextBoxAutoHScroll 1;
- WSBorder 1;
- WSChild 1;
- WSExClientEdge 1;
- WSVisible 1;
- DataColumns "Employee";
- DataSource "WinExcel40::query_excel40";
- FDXFieldName "textb_1_data";
- FDXFieldType "WString";
- ResizePercentages "[ 0 0 100 0 ]";
- ResID 103;
- DesignName textb_1;
- TabIndex 2;
- DesignRect 58,11,145,12;
- @end;
-
- @begin Object "WTextBox"
- WTextBoxAutoHScroll 1;
- WSBorder 1;
- WSChild 1;
- WSExClientEdge 1;
- WSVisible 1;
- DataColumns "StartDate";
- DataSource "WinExcel40::query_excel40";
- FDXFieldName "textb_2_data";
- FDXFieldType "WString";
- ResizePercentages "[ 0 0 100 0 ]";
- ResID 104;
- DesignName textb_2;
- TabIndex 3;
- DesignRect 58,26,145,12;
- @end;
-
- @begin Object "WTextBox"
- WTextBoxAutoHScroll 1;
- WSBorder 1;
- WSChild 1;
- WSExClientEdge 1;
- WSVisible 1;
- DataColumns "Salary";
- DataSource "WinExcel40::query_excel40";
- FDXFieldName "textb_3_data";
- FDXFieldType "WString";
- ResizePercentages "[ 0 0 100 0 ]";
- ResID 105;
- DesignName textb_3;
- TabIndex 4;
- DesignRect 58,41,145,12;
- @end;
-
- @begin Object "WLabel"
- WSSLeftNoWordWrap 1;
- WSSNotify 1;
- WCCSNoResize 1;
- WCCSNoParentAlign 1;
- WSChild 1;
- WSVisible 1;
- AutoSize "1";
- Text "Employee:";
- ResID 106;
- DesignName label_1;
- TabIndex 5;
- DesignRect 8,11,33,8;
- @end;
-
- @begin Object "WLabel"
- WSSLeftNoWordWrap 1;
- WSSNotify 1;
- WCCSNoResize 1;
- WCCSNoParentAlign 1;
- WSChild 1;
- WSVisible 1;
- AutoSize "1";
- Text "Start date:";
- ResID 107;
- DesignName label_2;
- TabIndex 6;
- DesignRect 8,26,30,8;
- @end;
-
- @begin Object "WLabel"
- WSSLeftNoWordWrap 1;
- WSSNotify 1;
- WCCSNoResize 1;
- WCCSNoParentAlign 1;
- WSChild 1;
- WSVisible 1;
- AutoSize "1";
- Text "Salary:";
- ResID 108;
- DesignName label_3;
- TabIndex 7;
- DesignRect 8,41,21,8;
- @end;
-
- @begin Object "WDataNavigator"
- WSChild 1;
- WSMaximizeBox 1;
- WSTabStop 1;
- WSVisible 1;
- BOFAction "WDNActionMoveFirst";
- DataSource "WinExcel40::query_excel40";
- EOFAction "WDNActionMoveLast";
- ShowAdd "1";
- ShowCancel "1";
- ShowDelete "1";
- ShowEdit "1";
- ShowMoveFirst "1";
- ShowMoveLast "1";
- ShowMoveNext "1";
- ShowMovePrevious "1";
- ShowRefresh "1";
- ShowTooltips "1";
- ShowUpdate "1";
- ResID 109;
- DesignName datanavigator_1;
- TabIndex 8;
- DesignRect 58,61,147,12;
- @end;
-
- @begin HPPPrefixBlock
- @begin-code HPPPrefix
-
- // Declarations added here will be included at the top of the .HPP file
-
- @end-code;
- GencodeSrcLine 13;
- @end;
-
- @begin CPPPrefixBlock
- @begin-code CPPPrefix
-
- // Code added here will be included at the top of the .CPP file
-
- // Include definitions for resources.
- #include "WRes.h"
- #include "odbcadm.hpp"
- #include "applic.hpp"
-
-
- static WChar *Driver_keys[]={
- WTEXT( "Description" ), WTEXT( "" ),
- WTEXT( "ScanRows" ), WTEXT( "25" ),
- WTEXT( "FileOpenCache" ), WTEXT( "0" ),
- WTEXT( "CacheSize" ), WTEXT( "256" ),
- WTEXT( "IntlSort" ), WTEXT( "0" ),
- WTEXT( "CharacterLengthGuessing" ), WTEXT( "0" ),
- WTEXT( "UseLongQualifiers" ), WTEXT( "0" ),
- WTEXT( "UltraSafeCommit" ), WTEXT( "0" ),
- NULL
- };
-
- static WChar Driver[]=
- WTEXT( "INTERSOLV OEM 2.12 32-BIT ExcelFile" );
-
- static WChar Datasource[]= WTEXT( "Excel 4.0 Optima Example" );
-
- @end-code;
- GencodeSrcLine 10;
- @end;
-
- @begin ClassContentsBlock
- @begin-code ClassContents
-
- public:
- // add your public instance data here
- private:
- // add your private instance data here
- WString _dbpath;
-
- protected:
- // add your protected instance data here
-
- @end-code;
- GencodeSrcLine 58;
- @end;
-
- @begin-code GeneratedClassContents
-
- WinExcel40();
- ~WinExcel40();
-
- @end-code;
-
- @begin-code Code "WinExcel40::WinExcel40()"
-
- WinExcel40::WinExcel40()
- {
-
- }
-
- @end-code;
-
- @begin-code Code "WinExcel40::~WinExcel40()"
-
- WinExcel40::~WinExcel40()
- {
-
- }
-
- @end-code;
-
- @begin-code Code "WinExcel40::Process( WWindow *parent )"
-
- WBool WinExcel40::Process( WWindow *parent )
- {
- WString driver_dll;
- WStringArray keys;
- int i;
- WString db_file;
- WFilePath path;
- WString dir;
-
- if( !ODBCAdmin::DriverExists( Driver, driver_dll ) ) {
- WMessageBox::Messagef( parent, WMBLevelError, WMBButtonOk, "Driver Error",
- "The ODBC Driver '%s' is not installed. Data source cannot "
- "be created.", Driver );
- return( FALSE );
- }
-
- for( i = 0; Driver_keys[i] != NULL; ++i );
- keys.SetCount( i + 4 );
- for( i = 0; Driver_keys[i] != NULL; ++i ) {
- keys[i] = Driver_keys[i];
- }
- keys[i] = WTEXT( "Driver" );
- keys[i + 1] = driver_dll;
- keys[i + 2] = WTEXT( "Database" );
- db_file = Application->GetProgramPath();
- path = db_file;
- dir = path.GetDirectory();
- dir.Concat( "\\.." );
- path.SetFileName( "" );
- path.SetDirectory( dir );
- path.CleanDirectory();
- keys[i + 3] = path;
- _dbpath = path;
-
- if( !ODBCAdmin::AddDataSource( Datasource, Driver, keys ) ) {
- WMessageBox::Messagef( parent, WMBLevelError, WMBButtonOk, "Data source Error",
- "The ODBC Datasource '%s' could not be installed", Datasource );
- return( FALSE );
- }
-
- Create( parent );
-
- return( TRUE );
- }
-
- @end-code;
-
- @begin-code Code "WinExcel40::Prototype for Process( WWindow *parent )"
-
- public:
- WBool Process( WWindow *parent );
-
- @end-code;
-
- @begin-code Code "WinExcel40::WinExcel40_Create"
-
- WBool WinExcel40::WinExcel40_Create(
- WObject * source,
- WCreateEventData * event )
- {
- WString connect_parms;
-
- connect_parms.Sprintf( "database=%s", _dbpath.GetText() );
- transaction_excel40->SetConnectParams( connect_parms );
- transaction_excel40->Connect();
- query_excel40->Open();
- query_excel40->MoveFirst();
-
- return FALSE;
- }
-
- @end-code;
- @end;
-