Author | Topic: CreateObject() can not :setProperty( XbpActiveXControl() ) | |
---|---|---|
AUGE_OHR | CreateObject() can not :setProperty( XbpActiveXControl() ) on Thu, 22 Jul 2010 04:55:02 +0200 hi, using *.OCX as activeX most send Events so i use XbpActiveXControl(), but with Codejock Calendar i can not use :setProperty() to a CreateObject() it work AutomationObject:setProperty("Prop", AutomationObject), but now AutomationObject (by CreateObject() ) does not show any Property or Methode ?! i did try set Property and Methode before :DynamicCast( ActiveXObject()) *** Code *** #define CJ_CAL "Codejock.CalendarControl.13.x.x" #define CJ_LIC "Calendar Control Copyright (c) 2003-2009 Codejock Software"+CHR(13)+CHR(10)+; "PRODUCT-ID: Codejock.Calendar.ActiveX.vXX.X"+CHR(13)+CHR(10)+; "VALIDATE-CODE: xxx-xxx-xxx-xxx" #PRAGMA LIBRARY( "ASCOM10.LIB" ) PROCEDURE APPSYS RETURN PROCEDURE MAIN(cNo) ... DEFAULT cNo TO "2" nNo := VAL(cNo) DO CASE CASE nNo == 1 will crash @ oDialog oCalCon := XbpActiveXControl():new(oDlg:drawingArea,, ; {0,0},{aSize[1]-10,aSize[2]-30}) oCalCon:CLSID := CJ_CAL oCalCon:License := CJ_LIC oCalCon:create() CASE nNo == 2 use CreateObject and :DynamicCast( ActiveXObject() ) oCalCon := CreateObject(CJ_CAL,,CJ_LIC) try after all Property and Methode later * oCalCon := oCalCon:DynamicCast( ActiveXObject() ) ENDCASE ErrorBlock( {|e| Break(e)} ) BEGIN SEQUENCE ohWnd := oCalCon:getProperty("hWnd") RECOVER USING oError MsgBox("Error hWnd()") ErrorBlock( bSaveError ) END SEQUENCE ErrorBlock( bSaveError ) internal Dialogs ErrorBlock( {|e| Break(e)} ) BEGIN SEQUENCE oDialogs := CreateObject("Codejock.CalendarDialogs.13.x.x") works : AutomationObject:setProperty("Prop", AutomationObject ) crash : AutomationObject:setProperty("Prop", XbpActiveXControl() ) oDialogs:Calendar := oCalCon show internal Dialog oDialogs:ShowNewEvent() might in Backgound ... use ALT-TAB RECOVER USING oError MsgBox("Error oDialogs()") ErrorBlock( bSaveError ) END SEQUENCE ErrorBlock( bSaveError ) ENDIF IF IsMemberVar(oCalCon, "Options") oOptions := oCalCon:Options() oOptions:FirstDayOfTheWeek := xtpCalendarDayMonday "CJCAL.CH" ELSE only XbpActiveXControl() can ":SubClass" Property "Options" CreateObject() and AutomationObject() does not get Property MsgBox("No Property Options()") ENDIF oDlg:show() try after setting Property and Methode oCalCon := oCalCon:DynamicCast( ActiveXObject() ) *** Eof *** so what is the Differenz from CreateObject()/AutomationObject() vs. XbpActiveXControl() and why is it not "Compatible" with ":=" ( :setProperty() ) ? seems CreateObject() can not ":SubClass" Property "Options" or even :getProperty("hWnd") greetings by OHR Jimmy |