devilyn Posted July 21, 2010 Share Posted July 21, 2010 (edited) All,First thanks you for reading.I have an ocx custom control that i found in my old computer that i would like to embed in my applications.my issue is that after parsing the ocx methods with OLE Browser i'm not able to successfully pass them to the object.OLE Browser Screenshot:Autoit Code:expandcollapse popup#region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_outfile=tes2t.exe #AutoIt3Wrapper_UseX64=n #endregion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Global $obj, $GUIActiveX, $GUI_Button_Back, $GUI_Button_Forward, $answer Global $GUI_Button_Home, $GUI_Button_Stop, $msg, $r Example() Func Example() $obj = ObjCreate("TIMECONTROL.TimeControlCtrl.1") If Not @error Then Else MsgBox(0, "ObjCreate Test", "Failed to create Object. Error code: " & Hex(@error, 8)) EndIf GUICreate("Test", 640, 580, (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2) $GUIActiveX = GUICtrlCreateObj($obj, 100, 80, 150, 160) $r = GUICtrlCreateButton("Test", 20, 300, 100, 100) GUISetState() ;Show GUI If IsObj($obj) Then ;MsgBox(0, "OK", "") Else ;MsgBox(16, "error", "") EndIf While 1 $msg = GUIGetMsg() Select Case $msg = $r $obj.AboutBox() Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd GUIDelete() EndFunc ;==>ExampleThanks... Edited July 21, 2010 by Lior Berezinski Link to comment Share on other sites More sharing options...
evilertoaster Posted July 21, 2010 Share Posted July 21, 2010 after parsing the ocx methods with OLE Browser i'm not able to successfully pass them to the object.I don't think that sentence, in and of itself, makes much sense...Does that mean that if you don't parse the methods it does work?and what does "pass them to the object" mean exactly... GUICtrlCreateObj($obj, 100, 80, 150, 160) ?Does ObjCreate() fail? What's the error code? Can you attach your control to see if it's reproducible? Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 21, 2010 Share Posted July 21, 2010 He did provide code. I don't see a COM error handler though. I would do something better than just test @error after ObjCreate(): $obj = ObjCreate("TIMECONTROL.TimeControlCtrl.1") If IsObj($obj) Then MsgBox(64, "Success", "Created object: " & ObjName($obj)) Else MsgBox(16, "Error", "Failed to create Object.") EndIf See the help file under COM/OBJ Reference for an example COM Error Handler. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now