QuryDemo: MDI Child Window Multi-database Query Sample

Click to open or copy the files for the QuryDemo sample.

Demonstrates a simple MDI (Multiple Document Interface) application that allows a user to simultaneously connect to multiple heterogeneous databases and perform SQL queries to get results.

The application uses MDI Child Window Titles to store values of PROVIDERs and Command Objects. These values are also stored in the combo boxes that are displayed on the toolbar.

Main.cpp Functions

Function Description
WinMain Main routine
MainWndProc Processes Main Application Window messages
MDIChildProc Processes MDI child window messages
ToolbarProc Processes tool bar messages
StatusbarProc Processes status bar messages
ConnectDlgProc Processes Connection dialog box messages
DisconnectDlgProc Processes Disconnect dialog box messages
AboutDlgProc Processes messages for About dialog box
MDIChildDlgProc Processes messages for dummy child dialog box in MDI window
DrawBitmap Draws bitmaps for toolbuttons

Query.cpp Functions

Function Description
InitEnvironment Initializes OLE
DisplayProviders Displays available providers
ConnectDatabase Connects to a specific data source
DisplayConnections Displays list of made connections
DisplayICommands Displays list of ICommands
NewICommandWindow Opens a new ICommand and update displays
ChangeCurrentCursor Changes current cursor display
ChangeCurrentICommand Changes current ICommand display
DisplayNewCrsrAndICommand Updates cursor and ICommand displays
FreeConnect Frees an IDBCreateCommand
FreeICommand Frees an ICommand
CloseICommandWindow Closes an ICommand window
ExecuteQuery Executes a user-specified query
CloseIDBCreateCommand Checks if all connections are closed
FreeEnvironment Frees OLE
ExecuteCommand Executes the ICommand and returns an IRowset
GetDataFromRowset Gets the data from the IRowset
SetupBindings Sets the binding structure
CreateAccessor Creates an accessor to store the data
GetData Gets the data out of the rowset

Building SDK Samples

This sample uses the following keywords:

aboutdlgproc; activatewindow; assert; beginpaint; bindmoniker; bitblt; bringwindowtotop; changecurrentcursor; changecurrenticommand; cleanuprowset; closeicommandwindow; closeidbcreatecommand; cocreateinstance; cofreeunusedlibraries; cogetmalloc; coinitialize; connectdatabase; connectdlgproc; couninitialize; createaccessor; createcommand; createcompatibledc; createdialog; createpen; createsession; createwindow; ctl3dautosubclass; ctl3dcolorchange; ctl3dregister; ctl3dunregister; defframeproc; defmdichildproc; defwindowproc; deletedc; deleteobject; destroyicon; destroywindow; dialogbox; disconnectdlgproc; dispatchmessage; displayconnections; displaydatasource; displayicommands; displaynewcrsrandicommand; displayproviders; dptolp; drawbitmap; drawbttnlift1; drawbttnlift2; drawbttnrect; drawtext; dumperror; dumperrorhresult; dumprow; enablemenuitem; enablewindow; enddialog; endpaint; enumerateproviders; execute; executecommand; executequery; failed; findwindow; formatmessage; free; freeconnect; freeenvironment; freeicommand; freeprocinstance; get_wm_command_cmd; get_wm_command_hwnd; get_wm_command_id; get_wm_command_mps; get_wm_mdiactivate_factivate; get_wm_menuselect_cmd; get_wm_menuselect_flags; getcapture; getclassname; getclientrect; getcolumninfo; getcolumnsinfo; getdata; getdatafromrowset; getdc; getdlgitem; getdlgitemtext; geterrorinfo; getlastactivepopup; getmapmode; getmenu; getmenuitemcount; getmenuitemid; getmenustring; getmessage; getnextrows; getobject; getrowset; getschemarowset; getsourcesrowset; getstockobject; getsubmenu; getsyscolor; gettextextentpoint; getwindow; getwindowlong; getwindowrect; getwindowtext; id; initenvironment; initialize; interfacesupportserrorinfo; invalidaterect; isdialogmessage; isiconic; iszoomed; lineto; loadaccelerators; loadbitmap; loadcursor; loadicon; localalloc; localfree; localtime; mainwndproc; makeintresource; makelangid; malloc; max; mdichilddlgproc; mdichildproc; memset; messagebox; movetoex; movewindow; multibytetowidechar; newicommandwindow; newiopenrowsetwindow; numelem; offsetof; openicon; openrowset; parsedisplayname; postmessage; postquitmessage; ptinrect; queryinterface; rectangle; registerclass; release; releaseaccessor; releasecapture; releasedc; releaserows; resultfromscode; round_up; selectobject; sendmessage; setbkmode; setcapture; setcommandtext; setcursor; seterrorinfo; setfocus; setforegroundwindow; setmapmode; setproperties; settextcolor; settimer; setupbindings; setwindowlong; setwindowtext; showwindow; sprintf; sscanf; statusbarproc; strcat; strcmp; strcpy; strftime; strstr; succeeded; sysallocstring; time; toolbarproc; translateaccelerator; translatemdisysaccel; translatemessage; updatewindow; variantclear; variantinit; wcscpy; widechartomultibyte; winmain; wsprintf