Added OLE automation sample, changed BC++ makefiles
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1130 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -17,7 +17,7 @@ WXDIR = $(WXWIN)
|
|||||||
WXLIBDIR = $(WXDIR)\lib
|
WXLIBDIR = $(WXDIR)\lib
|
||||||
WXINC = $(WXDIR)\include\msw
|
WXINC = $(WXDIR)\include\msw
|
||||||
WXLIB = $(WXLIBDIR)\wx32.lib
|
WXLIB = $(WXLIBDIR)\wx32.lib
|
||||||
LIBS=$(WXLIB) cw32 import32
|
LIBS=$(WXLIB) cw32 import32 ole2w32
|
||||||
|
|
||||||
TARGET=checklst
|
TARGET=checklst
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@ WXDIR = $(WXWIN)
|
|||||||
|
|
||||||
WXLIBDIR = $(WXDIR)\lib
|
WXLIBDIR = $(WXDIR)\lib
|
||||||
WXLIB=$(WXLIBDIR)\wx32.lib
|
WXLIB=$(WXLIBDIR)\wx32.lib
|
||||||
LIBS=$(WXLIB) cw32 import32
|
LIBS=$(WXLIB) cw32 import32 ole2w32
|
||||||
|
|
||||||
TARGET=dialogs
|
TARGET=dialogs
|
||||||
|
|
||||||
|
@@ -17,7 +17,7 @@ WXDIR = $(WXWIN)
|
|||||||
|
|
||||||
WXLIBDIR = $(WXDIR)\lib
|
WXLIBDIR = $(WXDIR)\lib
|
||||||
WXLIB=$(WXLIBDIR)\wx32.lib
|
WXLIB=$(WXLIBDIR)\wx32.lib
|
||||||
LIBS=$(WXLIB) cw32 import32
|
LIBS=$(WXLIB) cw32 import32 ole2w32
|
||||||
|
|
||||||
TARGET=docview
|
TARGET=docview
|
||||||
|
|
||||||
|
@@ -17,7 +17,7 @@ WXDIR = $(WXWIN)
|
|||||||
|
|
||||||
WXLIBDIR = $(WXDIR)\lib
|
WXLIBDIR = $(WXDIR)\lib
|
||||||
WXLIB=$(WXLIBDIR)\wx32.lib
|
WXLIB=$(WXLIBDIR)\wx32.lib
|
||||||
LIBS=$(WXLIB) cw32 import32
|
LIBS=$(WXLIB) cw32 import32 ole2w32
|
||||||
|
|
||||||
TARGET=docview
|
TARGET=docview
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@ WXDIR = $(WXWIN)
|
|||||||
|
|
||||||
WXLIBDIR = $(WXDIR)\lib
|
WXLIBDIR = $(WXDIR)\lib
|
||||||
WXLIB = $(WXLIBDIR)\wx32.lib
|
WXLIB = $(WXLIBDIR)\wx32.lib
|
||||||
LIBS=$(WXLIB) cw32 import32
|
LIBS=$(WXLIB) cw32 import32 ole2w32
|
||||||
|
|
||||||
TARGET=test
|
TARGET=test
|
||||||
|
|
||||||
|
@@ -17,7 +17,7 @@ WXDIR = $(WXWIN)
|
|||||||
WXLIBDIR = $(WXDIR)\lib
|
WXLIBDIR = $(WXDIR)\lib
|
||||||
WXINC = $(WXDIR)\include\msw
|
WXINC = $(WXDIR)\include\msw
|
||||||
WXLIB = $(WXLIBDIR)\wx32.lib
|
WXLIB = $(WXLIBDIR)\wx32.lib
|
||||||
LIBS=$(WXLIB) cw32 import32
|
LIBS=$(WXLIB) cw32 import32 ole2w32
|
||||||
|
|
||||||
TARGET=internat
|
TARGET=internat
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@ WXDIR = $(WXWIN)
|
|||||||
|
|
||||||
WXLIBDIR = $(WXDIR)\lib
|
WXLIBDIR = $(WXDIR)\lib
|
||||||
WXLIB = $(WXLIBDIR)\wx32.lib
|
WXLIB = $(WXLIBDIR)\wx32.lib
|
||||||
LIBS=$(WXLIB) cw32 import32
|
LIBS=$(WXLIB) cw32 import32 ole2w32
|
||||||
|
|
||||||
TARGET=joytest
|
TARGET=joytest
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@ WXDIR = $(WXWIN)
|
|||||||
|
|
||||||
WXLIBDIR = $(WXDIR)\lib
|
WXLIBDIR = $(WXDIR)\lib
|
||||||
WXLIB = $(WXLIBDIR)\wx32.lib
|
WXLIB = $(WXLIBDIR)\wx32.lib
|
||||||
LIBS=$(WXLIB) cw32 import32
|
LIBS=$(WXLIB) cw32 import32 ole2w32
|
||||||
|
|
||||||
TARGET=layout
|
TARGET=layout
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@ WXDIR = $(WXWIN)
|
|||||||
|
|
||||||
WXLIBDIR = $(WXDIR)\lib
|
WXLIBDIR = $(WXDIR)\lib
|
||||||
WXLIB = $(WXLIBDIR)\wx32.lib
|
WXLIB = $(WXLIBDIR)\wx32.lib
|
||||||
LIBS=$(WXLIB) cw32 import32
|
LIBS=$(WXLIB) cw32 import32 ole2w32
|
||||||
|
|
||||||
TARGET=listtest
|
TARGET=listtest
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@ WXDIR = $(WXWIN)
|
|||||||
|
|
||||||
WXLIBDIR = $(WXDIR)\lib
|
WXLIBDIR = $(WXDIR)\lib
|
||||||
WXLIB = $(WXLIBDIR)\wx32.lib
|
WXLIB = $(WXLIBDIR)\wx32.lib
|
||||||
LIBS=$(WXLIB) cw32 import32
|
LIBS=$(WXLIB) cw32 import32 ole2w32
|
||||||
|
|
||||||
TARGET=mdi
|
TARGET=mdi
|
||||||
|
|
||||||
|
@@ -17,7 +17,7 @@ WXDIR = $(WXWIN)
|
|||||||
WXLIBDIR = $(WXDIR)\lib
|
WXLIBDIR = $(WXDIR)\lib
|
||||||
WXINC = $(WXDIR)\include\wx
|
WXINC = $(WXDIR)\include\wx
|
||||||
WXLIB = $(WXLIBDIR)\wx32.lib
|
WXLIB = $(WXLIBDIR)\wx32.lib
|
||||||
LIBS=$(WXLIB) cw32 import32
|
LIBS=$(WXLIB) cw32 import32 ole2w32
|
||||||
|
|
||||||
TARGET=memcheck
|
TARGET=memcheck
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@ WXDIR = $(WXWIN)
|
|||||||
|
|
||||||
WXLIBDIR = $(WXDIR)\lib
|
WXLIBDIR = $(WXDIR)\lib
|
||||||
WXLIB = $(WXLIBDIR)\wx32.lib
|
WXLIB = $(WXLIBDIR)\wx32.lib
|
||||||
LIBS=$(WXLIB) cw32 import32
|
LIBS=$(WXLIB) cw32 import32 ole2w32
|
||||||
|
|
||||||
TARGET=nativdlg
|
TARGET=nativdlg
|
||||||
|
|
||||||
|
64
samples/oleauto/makefile.b32
Normal file
64
samples/oleauto/makefile.b32
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.b32
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1993
|
||||||
|
# Updated:
|
||||||
|
# Copyright:
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile : Builds oleauto example
|
||||||
|
|
||||||
|
# WXWIN and BCCDIR are set by parent make
|
||||||
|
|
||||||
|
WXDIR = $(WXWIN)
|
||||||
|
!include $(WXDIR)\src\makeb32.env
|
||||||
|
|
||||||
|
WXLIBDIR = $(WXDIR)\lib
|
||||||
|
WXINC = $(WXDIR)\include\msw
|
||||||
|
WXLIB = $(WXLIBDIR)\wx32.lib
|
||||||
|
LIBS=$(WXLIB) cw32 import32 ole2w32
|
||||||
|
|
||||||
|
TARGET=oleauto
|
||||||
|
|
||||||
|
!if "$(FINAL)" == "0"
|
||||||
|
LINKFLAGS=/v /Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
|
||||||
|
OPT = -Od
|
||||||
|
DEBUG_FLAGS= -v
|
||||||
|
!else
|
||||||
|
LINKFLAGS=/Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
|
||||||
|
OPT = -Od
|
||||||
|
DEBUG_FLAGS =
|
||||||
|
!endif
|
||||||
|
CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
|
||||||
|
|
||||||
|
OBJECTS = oleauto.obj
|
||||||
|
|
||||||
|
$(TARGET).exe: $(OBJECTS) $(TARGET).res
|
||||||
|
tlink32 $(LINKFLAGS) @&&!
|
||||||
|
c0w32.obj $(OBJECTS)
|
||||||
|
$(TARGET)
|
||||||
|
nul
|
||||||
|
$(LIBS)
|
||||||
|
$(TARGET).def
|
||||||
|
$(TARGET).res
|
||||||
|
!
|
||||||
|
|
||||||
|
.$(SRCSUFF).obj:
|
||||||
|
bcc32 $(CPPFLAGS) -c {$< }
|
||||||
|
|
||||||
|
.c.obj:
|
||||||
|
bcc32 $(CPPFLAGS) -P- -c {$< }
|
||||||
|
|
||||||
|
oleauto.obj: oleauto.$(SRCSUFF)
|
||||||
|
|
||||||
|
$(TARGET).res : $(TARGET).rc $(WXDIR)\include\wx\msw\wx.rc
|
||||||
|
brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include $(TARGET)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-erase *.obj
|
||||||
|
-erase *.exe
|
||||||
|
-erase *.res
|
||||||
|
-erase *.map
|
||||||
|
-erase *.rws
|
||||||
|
|
37
samples/oleauto/makefile.g95
Normal file
37
samples/oleauto/makefile.g95
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.unx
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1993
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile for oleauto example (UNIX).
|
||||||
|
|
||||||
|
WXDIR = ../..
|
||||||
|
|
||||||
|
# All common UNIX compiler flags and options are now in
|
||||||
|
# this central makefile.
|
||||||
|
include $(WXDIR)/src/makeg95.env
|
||||||
|
|
||||||
|
OBJECTS = $(OBJDIR)/oleauto.$(OBJSUFF) $(OBJDIR)/oleauto_resources.$(OBJSUFF)
|
||||||
|
|
||||||
|
all: $(OBJDIR) oleauto$(GUISUFFIX)$(EXESUFF)
|
||||||
|
|
||||||
|
wx:
|
||||||
|
|
||||||
|
$(OBJDIR):
|
||||||
|
mkdir $(OBJDIR)
|
||||||
|
|
||||||
|
oleauto$(GUISUFFIX)$(EXESUFF): $(OBJECTS) $(WXLIB)
|
||||||
|
$(CC) $(LDFLAGS) -o oleauto$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(LDLIBS)
|
||||||
|
|
||||||
|
$(OBJDIR)/oleauto.$(OBJSUFF): oleauto.$(SRCSUFF)
|
||||||
|
$(CC) -c $(CPPFLAGS) -o $@ oleauto.$(SRCSUFF)
|
||||||
|
|
||||||
|
$(OBJDIR)/oleauto_resources.o: oleauto.rc
|
||||||
|
$(RESCOMP) -i oleauto.rc -o $(OBJDIR)/oleauto_resources.o $(RESFLAGS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJECTS) oleauto$(GUISUFFIX).exe core *.rsc *.res
|
64
samples/oleauto/makefile.nt
Normal file
64
samples/oleauto/makefile.nt
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.nt
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1993
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile : Builds oleauto example (MS VC++).
|
||||||
|
# Use FINAL=1 argument to nmake to build final version with no debugging
|
||||||
|
# info
|
||||||
|
|
||||||
|
# Set WXDIR for your system
|
||||||
|
WXDIR = $(WXWIN)
|
||||||
|
|
||||||
|
WXUSINGDLL=0
|
||||||
|
|
||||||
|
!include $(WXDIR)\src\ntwxwin.mak
|
||||||
|
|
||||||
|
THISDIR = $(WXDIR)\samples\oleauto
|
||||||
|
PROGRAM=oleauto
|
||||||
|
|
||||||
|
OBJECTS = $(PROGRAM).obj
|
||||||
|
|
||||||
|
$(PROGRAM): $(PROGRAM).exe
|
||||||
|
|
||||||
|
all: wx $(PROGRAM).exe
|
||||||
|
|
||||||
|
wx:
|
||||||
|
cd $(WXDIR)\src\msw
|
||||||
|
nmake -f makefile.nt FINAL=$(FINAL)
|
||||||
|
cd $(THISDIR)
|
||||||
|
|
||||||
|
wxclean:
|
||||||
|
cd $(WXDIR)\src\msw
|
||||||
|
nmake -f makefile.nt clean
|
||||||
|
cd $(THISDIR)
|
||||||
|
|
||||||
|
$(PROGRAM).exe: $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(PROGRAM).res
|
||||||
|
$(link) @<<
|
||||||
|
-out:$(PROGRAM).exe
|
||||||
|
$(LINKFLAGS)
|
||||||
|
$(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res
|
||||||
|
$(LIBS)
|
||||||
|
<<
|
||||||
|
|
||||||
|
|
||||||
|
$(PROGRAM).obj: $(PROGRAM).$(SRCSUFF) $(DUMMYOBJ)
|
||||||
|
$(cc) @<<
|
||||||
|
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||||
|
<<
|
||||||
|
|
||||||
|
$(PROGRAM).res : $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc
|
||||||
|
$(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc
|
||||||
|
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-erase *.obj
|
||||||
|
-erase *.exe
|
||||||
|
-erase *.res
|
||||||
|
-erase *.map
|
||||||
|
-erase *.sbr
|
||||||
|
-erase *.pdb
|
BIN
samples/oleauto/mondrian.ico
Normal file
BIN
samples/oleauto/mondrian.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
44
samples/oleauto/mondrian.xpm
Normal file
44
samples/oleauto/mondrian.xpm
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/* XPM */
|
||||||
|
static char *mondrian_xpm[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"32 32 6 1",
|
||||||
|
" c Black",
|
||||||
|
". c Blue",
|
||||||
|
"X c #00bf00",
|
||||||
|
"o c Red",
|
||||||
|
"O c Yellow",
|
||||||
|
"+ c Gray100",
|
||||||
|
/* pixels */
|
||||||
|
" ",
|
||||||
|
" oooooo +++++++++++++++++++++++ ",
|
||||||
|
" oooooo +++++++++++++++++++++++ ",
|
||||||
|
" oooooo +++++++++++++++++++++++ ",
|
||||||
|
" oooooo +++++++++++++++++++++++ ",
|
||||||
|
" oooooo +++++++++++++++++++++++ ",
|
||||||
|
" oooooo +++++++++++++++++++++++ ",
|
||||||
|
" oooooo +++++++++++++++++++++++ ",
|
||||||
|
" ",
|
||||||
|
" ++++++ ++++++++++++++++++ .... ",
|
||||||
|
" ++++++ ++++++++++++++++++ .... ",
|
||||||
|
" ++++++ ++++++++++++++++++ .... ",
|
||||||
|
" ++++++ ++++++++++++++++++ .... ",
|
||||||
|
" ++++++ ++++++++++++++++++ .... ",
|
||||||
|
" ++++++ ++++++++++++++++++ ",
|
||||||
|
" ++++++ ++++++++++++++++++ ++++ ",
|
||||||
|
" ++++++ ++++++++++++++++++ ++++ ",
|
||||||
|
" ++++++ ++++++++++++++++++ ++++ ",
|
||||||
|
" ++++++ ++++++++++++++++++ ++++ ",
|
||||||
|
" ++++++ ++++++++++++++++++ ++++ ",
|
||||||
|
" ++++++ ++++++++++++++++++ ++++ ",
|
||||||
|
" ++++++ ++++++++++++++++++ ++++ ",
|
||||||
|
" ++++++ ++++++++++++++++++ ++++ ",
|
||||||
|
" ++++++ ++++++++++++++++++ ++++ ",
|
||||||
|
" ++++++ ++++ ",
|
||||||
|
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||||
|
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||||
|
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||||
|
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||||
|
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||||
|
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||||
|
" "
|
||||||
|
};
|
220
samples/oleauto/oleauto.cpp
Normal file
220
samples/oleauto/oleauto.cpp
Normal file
@@ -0,0 +1,220 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: oleauto.cpp
|
||||||
|
// Purpose: OLE Automation wxWindows sample
|
||||||
|
// Author: Julian Smart
|
||||||
|
// Modified by:
|
||||||
|
// Created: 08/12/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Julian Smart
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// declarations
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// headers
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation "oleauto.cpp"
|
||||||
|
#pragma interface "oleauto.cpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx/wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// for all others, include the necessary headers (this file is usually all you
|
||||||
|
// need because it includes almost all "standard" wxWindows headers
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/wx.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <wx/msw/ole/automtn.h>
|
||||||
|
|
||||||
|
#ifndef __WXMSW__
|
||||||
|
#error "Sorry, this sample works under Windows only."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// ressources
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// the application icon
|
||||||
|
#if defined(__WXGTK__) || defined(__WXMOTIF__)
|
||||||
|
#include "mondrian.xpm"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// private classes
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Define a new application type, each program should derive a class from wxApp
|
||||||
|
class MyApp : public wxApp
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// override base class virtuals
|
||||||
|
// ----------------------------
|
||||||
|
|
||||||
|
// this one is called on application startup and is a good place for the app
|
||||||
|
// initialization (doing it here and not in the ctor allows to have an error
|
||||||
|
// return: if OnInit() returns false, the application terminates)
|
||||||
|
virtual bool OnInit();
|
||||||
|
};
|
||||||
|
|
||||||
|
// Define a new frame type: this is going to be our main frame
|
||||||
|
class MyFrame : public wxFrame
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// ctor(s)
|
||||||
|
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
|
||||||
|
|
||||||
|
// event handlers (these functions should _not_ be virtual)
|
||||||
|
void OnQuit(wxCommandEvent& event);
|
||||||
|
void OnAbout(wxCommandEvent& event);
|
||||||
|
void OnTest(wxCommandEvent& event);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// any class wishing to process wxWindows events must use this macro
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// constants
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// IDs for the controls and the menu commands
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
// menu items
|
||||||
|
OleAuto_Quit = 1,
|
||||||
|
OleAuto_About,
|
||||||
|
OleAuto_Test,
|
||||||
|
|
||||||
|
// controls start here (the numbers are, of course, arbitrary)
|
||||||
|
OleAuto_Text = 1000,
|
||||||
|
};
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// event tables and other macros for wxWindows
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// the event tables connect the wxWindows events with the functions (event
|
||||||
|
// handlers) which process them. It can be also done at run-time, but for the
|
||||||
|
// simple menu events like this the static method is much simpler.
|
||||||
|
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||||
|
EVT_MENU(OleAuto_Quit, MyFrame::OnQuit)
|
||||||
|
EVT_MENU(OleAuto_About, MyFrame::OnAbout)
|
||||||
|
EVT_MENU(OleAuto_Test, MyFrame::OnTest)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
// Create a new application object: this macro will allow wxWindows to create
|
||||||
|
// the application object during program execution (it's better than using a
|
||||||
|
// static object for many reasons) and also declares the accessor function
|
||||||
|
// wxGetApp() which will return the reference of the right type (i.e. MyApp and
|
||||||
|
// not wxApp)
|
||||||
|
IMPLEMENT_APP(MyApp)
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// implementation
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// the application class
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// `Main program' equivalent: the program execution "starts" here
|
||||||
|
bool MyApp::OnInit()
|
||||||
|
{
|
||||||
|
// Create the main application window
|
||||||
|
MyFrame *frame = new MyFrame("OleAuto wxWindows App",
|
||||||
|
wxPoint(50, 50), wxSize(450, 340));
|
||||||
|
|
||||||
|
// Show it and tell the application that it's our main window
|
||||||
|
// @@@ what does it do exactly, in fact? is it necessary here?
|
||||||
|
frame->Show(TRUE);
|
||||||
|
SetTopWindow(frame);
|
||||||
|
|
||||||
|
// success: wxApp::OnRun() will be called which will enter the main message
|
||||||
|
// loop and the application will run. If we returned FALSE here, the
|
||||||
|
// application would exit immediately.
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// main frame
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// frame constructor
|
||||||
|
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||||
|
: wxFrame((wxFrame *)NULL, -1, title, pos, size)
|
||||||
|
{
|
||||||
|
// set the frame icon
|
||||||
|
SetIcon(wxICON(mondrian));
|
||||||
|
|
||||||
|
// create a menu bar
|
||||||
|
wxMenu *menuFile = new wxMenu;
|
||||||
|
|
||||||
|
menuFile->Append(OleAuto_Test, "&Test Excel Automation...");
|
||||||
|
menuFile->Append(OleAuto_About, "&About...");
|
||||||
|
menuFile->AppendSeparator();
|
||||||
|
menuFile->Append(OleAuto_Quit, "E&xit");
|
||||||
|
|
||||||
|
// now append the freshly created menu to the menu bar...
|
||||||
|
wxMenuBar *menuBar = new wxMenuBar;
|
||||||
|
menuBar->Append(menuFile, "&File");
|
||||||
|
|
||||||
|
// ... and attach this menu bar to the frame
|
||||||
|
SetMenuBar(menuBar);
|
||||||
|
|
||||||
|
// create a status bar just for fun (by default with 1 pane only)
|
||||||
|
CreateStatusBar(2);
|
||||||
|
SetStatusText("Welcome to wxWindows!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// event handlers
|
||||||
|
|
||||||
|
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
// TRUE is to force the frame to close
|
||||||
|
Close(TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
wxMessageBox("This is an OLE Automation sample",
|
||||||
|
"About OleAuto", wxOK | wxICON_INFORMATION, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Tests OLE automation by making the active Excel cell bold,
|
||||||
|
* and changing the text.
|
||||||
|
*/
|
||||||
|
void MyFrame::OnTest(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
wxMessageBox("Please ensure Excel is running, then press OK.\nThe active cell should then say 'wxWindows automation test!' in bold.");
|
||||||
|
|
||||||
|
wxAutomationObject excelObject, rangeObject;
|
||||||
|
if (!excelObject.GetInstance("Excel.Application"))
|
||||||
|
{
|
||||||
|
if (!excelObject.CreateInstance("Excel.Application"))
|
||||||
|
{
|
||||||
|
wxMessageBox("Could not create Excel object.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!excelObject.PutProperty("ActiveCell.Value", "wxWindows automation test!"))
|
||||||
|
{
|
||||||
|
wxMessageBox("Could not set active cell value.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!excelObject.PutProperty("ActiveCell.Font.Bold", (bool) TRUE))
|
||||||
|
{
|
||||||
|
wxMessageBox("Could not put Bold property to active cell.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
8
samples/oleauto/oleauto.def
Normal file
8
samples/oleauto/oleauto.def
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
NAME OleAuto
|
||||||
|
DESCRIPTION 'OLE Automation wxWindows Sample'
|
||||||
|
EXETYPE WINDOWS
|
||||||
|
STUB 'WINSTUB.EXE'
|
||||||
|
CODE PRELOAD MOVEABLE DISCARDABLE
|
||||||
|
DATA PRELOAD MOVEABLE MULTIPLE
|
||||||
|
HEAPSIZE 4048
|
||||||
|
STACKSIZE 16000
|
3
samples/oleauto/oleauto.rc
Normal file
3
samples/oleauto/oleauto.rc
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
mondrian ICON "mondrian.ico"
|
||||||
|
#include "wx/msw/wx.rc"
|
||||||
|
|
@@ -17,7 +17,7 @@ WXDIR = $(WXWIN)
|
|||||||
WXLIBDIR = $(WXDIR)\lib
|
WXLIBDIR = $(WXDIR)\lib
|
||||||
WXINC = $(WXDIR)\include\msw
|
WXINC = $(WXDIR)\include\msw
|
||||||
WXLIB = $(WXLIBDIR)\wx32.lib
|
WXLIB = $(WXLIBDIR)\wx32.lib
|
||||||
LIBS=$(WXLIB) cw32 import32
|
LIBS=$(WXLIB) cw32 import32 ole2w32
|
||||||
|
|
||||||
TARGET=ownerdrw
|
TARGET=ownerdrw
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@ WXDIR = $(WXWIN)
|
|||||||
|
|
||||||
WXLIBDIR = $(WXDIR)\lib
|
WXLIBDIR = $(WXDIR)\lib
|
||||||
WXLIB = $(WXLIBDIR)\wx32.lib
|
WXLIB = $(WXLIBDIR)\wx32.lib
|
||||||
LIBS=$(WXLIB) cw32 import32
|
LIBS=$(WXLIB) cw32 import32 ole2w32
|
||||||
|
|
||||||
TARGET=printing
|
TARGET=printing
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@ WXDIR = $(WXWIN)
|
|||||||
|
|
||||||
WXLIBDIR = $(WXDIR)\lib
|
WXLIBDIR = $(WXDIR)\lib
|
||||||
WXLIB = $(WXLIBDIR)\wx32.lib
|
WXLIB = $(WXLIBDIR)\wx32.lib
|
||||||
LIBS=$(WXLIB) cw32 import32
|
LIBS=$(WXLIB) cw32 import32 ole2w32
|
||||||
|
|
||||||
TARGET=resource
|
TARGET=resource
|
||||||
|
|
||||||
|
@@ -17,7 +17,7 @@ WXDIR = $(WXWIN)
|
|||||||
WXLIBDIR = $(WXDIR)\lib
|
WXLIBDIR = $(WXDIR)\lib
|
||||||
WXINC = $(WXDIR)\include\msw
|
WXINC = $(WXDIR)\include\msw
|
||||||
WXLIB = $(WXLIBDIR)\wx32.lib
|
WXLIB = $(WXLIBDIR)\wx32.lib
|
||||||
LIBS=$(WXLIB) cw32 import32
|
LIBS=$(WXLIB) cw32 import32 ole2w32
|
||||||
|
|
||||||
TARGET=test
|
TARGET=test
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@ WXDIR = $(WXWIN)
|
|||||||
|
|
||||||
WXLIBDIR = $(WXDIR)\lib
|
WXLIBDIR = $(WXDIR)\lib
|
||||||
WXLIB = $(WXLIBDIR)\wx32.lib
|
WXLIB = $(WXLIBDIR)\wx32.lib
|
||||||
LIBS=$(WXLIB) cw32 import32
|
LIBS=$(WXLIB) cw32 import32 ole2w32
|
||||||
|
|
||||||
TARGET=test
|
TARGET=test
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@ WXDIR = $(WXWIN)
|
|||||||
|
|
||||||
WXLIBDIR = $(WXDIR)\lib
|
WXLIBDIR = $(WXDIR)\lib
|
||||||
WXLIB = $(WXLIBDIR)\wx32.lib
|
WXLIB = $(WXLIBDIR)\wx32.lib
|
||||||
LIBS=$(WXLIB) cw32 import32
|
LIBS=$(WXLIB) cw32 import32 ole2w32
|
||||||
|
|
||||||
TARGET=treetest
|
TARGET=treetest
|
||||||
|
|
||||||
|
@@ -19,7 +19,7 @@ WXINC = $(WXDIR)\include\msw
|
|||||||
WXBASESRC = $(WXDIR)\src\base
|
WXBASESRC = $(WXDIR)\src\base
|
||||||
WXBASEINC = $(WXDIR)\include\base
|
WXBASEINC = $(WXDIR)\include\base
|
||||||
WXLIB = $(WXLIBDIR)\wx32.lib
|
WXLIB = $(WXLIBDIR)\wx32.lib
|
||||||
LIBS=$(WXLIB) cw32 import32
|
LIBS=$(WXLIB) cw32 import32 ole2w32
|
||||||
|
|
||||||
TARGET=validate
|
TARGET=validate
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user