livewire Posted January 5, 2008 Posted January 5, 2008 Does anyone know how to get this ActiveX control to work with AutoIt? I can get the control to display in AutoIt's GUI but cannot access its methods or properties.ActiveX source can be downloaded here (click the 'Download demo project' at the bottom):http://www.codeguru.com/cpp/com-tech/activ...icle.php/c5517/I also had to comment out the following line in the function (void CPlotCtrl::OnDraw) in file (PlotCtl.cpp) to get the sin graph to display correctly (for some reason):pdc->FillRect (m_DrawRect,&hbrBackground); // <---- I had to comment out this lineThis control works perfectly unmodified in VB6 (no need to comment out the line and methods and properties work fine)...what's the deal?-Livewire
ptrex Posted January 5, 2008 Posted January 5, 2008 @livewireAU3 can not build ActiveX controles natively, only use ActiveX controls.Ypu can create your COM Objects using Windows Script Componentsregards,ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
livewire Posted January 5, 2008 Author Posted January 5, 2008 @livewireAU3 can not build ActiveX controles natively, only use ActiveX controls.Ypu can create your COM Objects using Windows Script Componentsregards,ptrex@ptrex,I know that AU3 cannot build ActiveX controls. In this post, I'm saying that AU3 cannot use the C++ ActiveX control mentioned in the ActiveX tutorial link in the first post.-Livewire
livewire Posted January 8, 2008 Author Posted January 8, 2008 I found an old post where someone else ran into this problem...see here...any suggestions.Thanks,Livewire
ptrex Posted January 8, 2008 Posted January 8, 2008 @livewire Sorry for the misunderstanding, was a little to quick. Maybe this can be of any help. expandcollapse popup#include <GUIConstants.au3> ; EXAMPLE ; ; Just experimenting around with the Forms 2.0 controls ; ; However, its poorly documented by Microsoft ; Initialize my error handler $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ; Create a new Forms collection $oForm = ObjCreate("Forms.Form.1") ; Initialize a custom Event Handler $oFormEvt=ObjEvent($oForm,"Form_") $oForm.caption = "Forms Frame Test" ; OK! $oForm.Zoom=100 ;Some more gadgets to play with: ;$oForm.ScrollWidth=200 ;$oForm.ScrollHeight=200 ;$oForm.InsideWidth(100) ;$oForm2.ShowGridDots(1) ;$oForm2.Width=200 ; The undocumented 'Add' method adds ONLY Forms 2.0 controls. ; Why is that? I don't know yet. $oButton=$oForm.Add("Forms.CommandButton.1","TestButton",1) ;ok $oButtonEvt=ObjEvent($oButton,"Button_") With $oButton .caption="Test Button" .Left=10 .Top=8 .Height=20 .Width=70 .Visible=1 EndWith $oCheckBox=$oForm.Add("Forms.CheckBox.1","TestCheck",1) ;ok $oCheckBoxEvt=ObjEvent($oCheckBox,"CheckBox_") With $oCheckBox .caption="Test Check" .Left=10 .Top=28 .Height=20 .Width=100 .Visible=1 EndWith $oSpinButton=$oForm.Add("Forms.SpinButton.1","TestSpin",1) ;ok $oSpinButtonEvt=ObjEvent($oSpinButton,"SpinButton_") With $oSpinButton .Left=10 .Top=45 .Height=15 .Width=50 .Visible=1 EndWith $oToggleButton=$oForm.Add("Forms.ToggleButton.1","TestToggle",1) ;ok With $oToggleButton .caption="Test Toggle" .Left=10 .Top=63 .Height=20 .Width=50 .Visible=1 EndWith $oForm.repaint ; Not really necessary ; Create a simple GUI for our test output GUICreate ( "Embedded ActiveX Test", 640, 480,(@DesktopWidth-640)/2, (@DesktopHeight-480)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE ) $GUI_ActiveX = GUICtrlCreateObj ( $oForm, 30, 30 , 400 , 400 ) $GUI_Label = GUICtrlCreateLabel ( "", 10, 420 , 300 , 20 ) GUISetState () ;Show GUI ; Waiting for user to close the window While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend GUIDelete () ; Clear all created objects. $oCheckBoxEvt="" $oCheckBox="" $oSpinButtonEvt="" $oSpinButton="" $oToggleButton="" $oButtonEvt="" ; Clear button event handler $oButton="" ; Remove the button $oFormEvt="" ; Clear form event handler $oForm="" ; Clear form Exit ; This is my custom error handler Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(1) ; to check for after this function returns Endfunc ; -----Some example Event Functions ; ; NOTE: Events can already appear BEFORE the GUI is fully initialized. ; That's why the 'If Isdeclared ...' must be used. ; This one catches all unused 'Form' events Func Form_($Event) If Isdeclared("GUI_Label") then GUICtrlSetData($GUI_Label,"Form Unused Event: " & $Event) EndFunc Func Form_MouseMove($Button, $Shift, $X, $Y) If Isdeclared("GUI_Label") then GUICtrlSetData($GUI_Label,"Form Mousemove: X:" & round($X,2) & " Y:" & round($Y,2)) EndFunc Func Form_Click() If Isdeclared("GUI_Label") then GUICtrlSetData($GUI_Label,"Form: Single mouseclick!") EndFunc Func Button_Click() If Isdeclared("GUI_Label") then GUICtrlSetData($GUI_Label,"Button: Single mouseclick!") EndFunc Func Button_DblClick() If Isdeclared("GUI_Label") then GUICtrlSetData($GUI_Label,"Button: Double mouseclick!") EndFunc Func SpinButton_Change() If Isdeclared("GUI_Label") then GUICtrlSetData($GUI_Label,"SpinButton: Change!") EndFunc Func SpinButton_SpinUp() If Isdeclared("GUI_Label") then GUICtrlSetData($GUI_Label,"SpinButton: SpinUp!") EndFunc regards, ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
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