Jump to content

Search the Community

Showing results for tags 'ocx'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 3 results

  1. Although I think the best way to use WebView2 in AutoIt would be to complete and use the work started by @LarsJ in this other @mLipok's topic, now it is possible to use WebView2 in AutoIt in a much simpler way. This is possible thanks to this ocx control and thanks to @Danyfirex for his decisive contribution. Now we can easily start embedding one or more WebView2 controls in our GUI in AutoIt. What we need is: the OrdoWebView2.ocx control and the \OrdoRC6 folder. These two are installed together with other programs (in the C:\Program Files (x86)\OrdoWebView2Control folder) by running the OrdoWebView2ActiveXControl.2.0.9.exe program downloadable from this link: https://freeware.ordoconcept.net/OrdoWebview2.php by clicking on "Download OrdoWebView2 SDK" at the bottom of the screen. Or, more simply, you can find them directly attached to this post by @Danyfirex. As explained in this post on VBForums (https://www.vbforums.com/showthread.php?899415-OrdoWebview2-ActiveX-WebView2-Browser-Control-(Replacement-of-the-MS-browser-control)&p=5651133&viewfull=1#post5651133): "On the latest versions of Windows 10 and Windows 11, only the following components are needed: OrdoWebView2.ocx OrdoRC6 folder and its contents, in the same directory as OrdoWebView2.ocx Finally, you need to register OrdoWebView2.ocx with regsvr32.exe OrdoWebView2.ocx". Also: Our AutoIt script and the OrdoWebView2.au3 must also be in the same directory along with the above. I have extracted the essential parts needed to create the WebView2 object from the DanyFirex's original example and grouped them into the OrdoWebView2.au3 UDF so that it can be easily included into a program. This is just a quick draft to get you started, but it can definitely be improved. Suggestions are welcome. Here are the basic UDF and a very basic example script: Embed 4 WebView2 controls in an AutoIt GUI More scripts to follow to test the functionality and interaction between OrdoWebView2 and AutoIt. See you later. P.S. Here is a reference link to the OrdoWebView2.ocx help (https://freeware.ordoconcept.net/Help/OrdoWebView2/) OrdoWebView2.au3 ; From the following POST By DanyFirex: ; https://www.autoitscript.com/forum/topic/204362-microsoft-edge-webview2-embed-web-code-in-your-native-application/page/9/#findComment-1542694 ; ... first draft to be continue ... #include <WinAPI.au3> Global Const $gATL = DllOpen("ATL.DLL") Global Const $gOleaut32 = DllOpen("oleaut32.dll") _WinAPI_CoInitialize($COINIT_APARTMENTTHREADED) AtlAxWinInit() Global $pProgID = SysAllocString('OrdoWebView2.OrdoWebView') Func webview2_GUI_Create($w, $h, $x, $y, $hMain, _ $sEventsPrefix = '', _ ; ......................... The prefix of the functions you define to handle receiving events. The prefix is appended by the Objects event name. $sLang = "", _ ; ................................. Language defined by the 2-letter code from ISO 639. If omitted, the chosen language will be that of the user's system. $bIsPrivateNavigation = False, _ ; ............... if TRUE the browser goes into private browsing mode. Default value is False $sBrowserInstallPath = "", _ ; ................... sets the installation directory of the WebView2 fixed version. Only considered if UseEdgeFixedVersion is TRUE. $sUserDataFolder = "", _ ; ....................... defines the user's browsing data directory. If empty, use default user assignment directory. Ignored if IsPrivateNavigation is true $sAdditionalBrowserArguments = "", _ ; ........... Allows passing parameters to the Chromium WebView2 browser through command line switches. You can find a list of Chromium Command Line Switches here $iAllowSingleSignOnUsingOSPrimaryAccount = 0) ; .. Determines whether to enable single sign on with Azure Active Directory Local $hGUI_1 = GUICreate('', $w, $h, $x, $y, $WS_POPUPWINDOW) ; BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN)) Local $hResult = AtlAxCreateControl($pProgID, $hGUI_1) ; _SysFreeString($pProgID) Local $pIUnkown = AtlAxGetControl($hGUI_1) ; ConsoleWrite("AtlAxGetControl: " & $pIUnkown & @CRLF) _WinAPI_SetParent($hGUI_1, $hMain) ; trap this child gui within the main gu GUISetState(@SW_SHOW, $hGUI_1) Local $oOrdoWebView2 = ObjCreateInterface($pIUnkown, "{E54909AA-1705-44A9-8235-B24F74366B3F}") Local $oOrdoWebViewEvents = ObjEvent($oOrdoWebView2, $sEventsPrefix, "__OrdoWebView") ; ConsoleWrite("$oOrdoWebView2: " & IsObj($oOrdoWebView2) & @CRLF) ; ConsoleWrite($oOrdoWebView2.GetWebView2Version() & @CRLF) ; ConsoleWrite($oOrdoWebView2.GetMostRecentInstallPath() & @CRLF) #cs $oOrdoWebView2.Anchor = True $oOrdoWebView2.Search_URL = "https://search.yahoo.com/search?p=%1" $oOrdoWebView2.HomeURL = "http://www.google.com" $oOrdoWebView2.SearchEngine = 2 $oOrdoWebView2.SearchAuto = True #ce $oOrdoWebView2.UseEdgeFixedVersion = False $oOrdoWebView2.InitEx($sLang, $bIsPrivateNavigation, $sBrowserInstallPath, $sUserDataFolder, $sAdditionalBrowserArguments, $iAllowSingleSignOnUsingOSPrimaryAccount) While Not $oOrdoWebView2.IsWebViewInit() ;wait initialization otherwise Navigate will fail Sleep(100) WEnd Local $aReturn = [$oOrdoWebView2, $hGUI_1] Return $aReturn ; $oOrdoWebView2 EndFunc ;==>webview2_GUI_Create Func AtlAxCreateControl($pProgID, $HWND) Local $aCall = DllCall($gATL, "long", "AtlAxCreateControl", "ptr", $pProgID, "handle", $HWND, "ptr", 0, "ptr", 0) If @error Then Return SetError(1, 0, -1) Return $aCall[0] EndFunc ;==>AtlAxCreateControl Func AtlAxGetControl($HWND) Local $aCall = DllCall($gATL, "long", "AtlAxGetControl", "handle", $HWND, "ptr*", 0) If @error Then Return SetError(1, 0, -1) Return $aCall[2] EndFunc ;==>AtlAxGetControl Func AtlAxWinInit() Local $aCall = DllCall($gATL, "bool", "AtlAxWinInit") If @error Then Return SetError(1, 0, -1) Return $aCall[0] EndFunc ;==>AtlAxWinInit Func _SysFreeString($pBSTR) ; Author: Prog@ndy If Not $pBSTR Then Return SetError(2, 0, 0) DllCall($gOleaut32, "none", "SysFreeString", "ptr", $pBSTR) If @error Then Return SetError(1, 0, 0) EndFunc ;==>_SysFreeString Func SysAllocString($str) ; Author: monoceres Local $aCall = DllCall($gOleaut32, "ptr", "SysAllocString", "wstr", $str) If @error Then Return SetError(1, 0, 0) Return $aCall[0] EndFunc ;==>SysAllocString OrdoWebView2_Demo.au3 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include "OrdoWebView2.au3" Global $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") _TestOrdoWebView() Func _TestOrdoWebView() Local $hMain_GUI = GUICreate("Main GUI", 990, 810, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN)) GUISetState(@SW_SHOW, $hMain_GUI) Local $hAutoIt_Button_1 = GUICtrlCreateButton("test", 10, 785) ; Create 4 controls Local $aWebView1 = webview2_GUI_Create(480, 380, 10, 10, $hMain_GUI) Local $aWebView2 = webview2_GUI_Create(480, 380, 500, 10, $hMain_GUI) Local $aWebView3 = webview2_GUI_Create(480, 380, 10, 400, $hMain_GUI) Local $aWebView4 = webview2_GUI_Create(480, 380, 500, 400, $hMain_GUI) ; Navigate to web pages $aWebView1[0].Navigate("https://www.kevs3d.co.uk/dev/js1kdragons/") ; "http://www.3quarks.com/en/SegmentDisplay/" $aWebView2[0].Navigate("https://gridstackjs.com/demo/anijs.html") ; "https://retejs.org/") $aWebView3[0].Navigate("https://www.youtube.com/watch?v=ojBYW3ycVTE") $aWebView4[0].Navigate("https://freeware.ordoconcept.net/OrdoWebview2.php") ; "https://freeware.ordoconcept.net/Help/OrdoWebView2/" While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $hAutoIt_Button_1 MsgBox(0, 'AutoIt', 'Hi') EndSwitch WEnd _SysFreeString($pProgID) GUIDelete($aWebView1[1]) GUIDelete($aWebView2[1]) GUIDelete($aWebView3[1]) GUIDelete($aWebView4[1]) GUIDelete($hMain_GUI) EndFunc ;==>_TestOrdoWebView ; User's COM error function. Will be called if COM error occurs Func _ErrFunc($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc
  2. Hi ~ I have a OCX file and its IDL like below: // Generated .IDL/C++ pseudo source equivalent of Win32 type library ..\CZEMApi.ocx [ uuid({71BD42C1-EBD3-11D0-AB3A-444553540000}), version(1.0), helpstring("CZ EM API OLE Control") ] library APILib { // Forward references and typedefs dispinterface _EMApi; dispinterface _EMApiEvents; [ uuid({71BD42C2-EBD3-11D0-AB3A-444553540000}), helpstring("Dispatch interface for CZ EM API Control") ] dispinterface _EMApi { properties: [id(0), bindable, requestedit] BSTR Caption; methods: [id(0)] long Set( BSTR lpszParam, VARIANT* vValue); [id(1)] long Get( BSTR lpszParam, VARIANT* vValue); [id(2)] long Execute(BSTR lpszCommand); [id(3)] long Initialise(BSTR lpszMachine); [id(4)] long Grab( short xoff, short yoff, short width, short height, short reduction, BSTR lpszFilename); [id(5)] long GetStagePosition( VARIANT* x, VARIANT* y, VARIANT* z, VARIANT* t, VARIANT* r, VARIANT* m); [id(6)] long MoveStage( single x, single y, single z, single t, single r, single m); [id(7)] long SetNotify( BSTR lpszParameter, long bNotify); [id(8)] long GetLastError(VARIANT* Error); [id(9)] long ClosingControl(); [id(10)] long GetLimits( BSTR lpszParam, VARIANT* vMinValue, VARIANT* vMaxValue); [id(11)] long GetMulti( BSTR lpszParam, VARIANT* vValues); [id(12)] long SetMulti( BSTR lpszParam, VARIANT* vValues); [id(13)] long GetVersion(short* Version); [id(14)] long InitialiseRemoting(); [id(15)] long GetCurrentUserName( BSTR* strServerUserName, BSTR* strNTUserName); [id(16)] long GetUserIsIdle(long* bUserIsIdle); [id(17)] long GetLastRemotingConnectionError(BSTR* strLastConnectionError); [id(18)] long SetSuppressRemotingConnectionErrors(); [id(19)] long LogonToEMServer( BSTR lpszUserName, BSTR lpszUserPassword); [id(20)] long StartEMServer(); [id(21)] long MoveStageDoubles( double x, double y, double z, double t, double r, double m); [id(22)] void AboutBox(); }; [ uuid({71BD42C3-EBD3-11D0-AB3A-444553540000}), helpstring("Event interface for CZ EM API Control") ] dispinterface _EMApiEvents { properties: methods: [id(0)] void Notify( BSTR lpszParameter, long Reason); [id(1)] void NotifyWithCurrentValue( BSTR lpszParameter, long Reason, long paramid, double dLastKnownValue); }; [ uuid({71BD42C4-EBD3-11D0-AB3A-444553540000}), helpstring("CZ EM API Control") ] coclass Api { [default] dispinterface _EMApi; [default, source] dispinterface _EMApiEvents; }; }; My autoit code like: ; CZ EM API OLE Control Local Const $CLSID_API = "{71BD42C4-EBD3-11D0-AB3A-444553540000}" Local $CZEMApi=ObjCreate($CLSID_API) If Not IsObj($CZEMApi) Then MsgBox(4096,"Failed to create APILib.Api object","You may need to run regsvr32 CZEMApi.ocx :error=" & Hex(@error,8)) Exit Else ;MsgBox(4096,"info","success") EndIf $Notify = ObjEvent($CZEMApi,"EMApiEvents_") Func EMApiEvents_Notify($parameter,$reason) MsgBox(4096,"Notify", "Event catchall for " & $parameter & @TAB & $reason & @CR) EndFunc $CZEMApi.Caption = "for test" MsgBox(4096,"caption",$CZEMApi.Caption) Local $long = $CZEMApi.InitialiseRemoting() Local $pVAR = "" Local $result = $CZEMApi.Get("AP_MAG",Ptr($pVAR)) But issue is: "G:\test.au3" (79) : ==> The requested action with this object has failed.: Local $result = $CZEMApi.Get("AP_MAG",Ptr($pVAR)) Local $result = $CZEMApi^ ERROR How to fixed this issue?
  3. Hi all, My programming knowledge is very basic. I have an old script that creates shares and assign permissions. It normally registers SetAcl.ocx if necessary and creates an object to assign permissions. The command that registers SetAcl was apparently working fine under Windows 7 but is not working under Windows 10. RunWait("regsvr32.exe path\to\setacl.ocx /s", "", @SW_HIDE) As I'm logged in as admin, I changed this command to : RunAsWait(@UserName, "", "", 0, "regsvr32.exe path\to\setacl.ocx /s", "", @SW_HIDE) It seems to terminate correctly but the script still doesn't work as expected. To check that, I've created that small script : Local $objSetAcl = ObjCreate("SETACL.SetACLCtrl.1") If IsObj($objSetAcl) Then ConsoleWrite("Object successfully created." & @CRLF) Else ConsoleWrite("Object not created. Registering SetAcl.ocx" & @CRLF) Local $result = RunAsWait(@UserName, "", "", 0, "regsvr32.exe path\to\setacl.ocx /s", "", @SW_HIDE); Use of my admin username to elevate CMD ConsoleWrite("Return code : " & $result & @CRLF) ConsoleWrite("Creating object" & @CRLF) $objSetAcl = ObjCreate("SETACL.SetACLCtrl.1") If IsObj($objSetAcl) Then ConsoleWrite("Object successfully created." & @CRLF) Else ConsoleWrite("Object creation failed." & @CRLF) EndIf EndIf It tries to register SetAcl.ocx, return code 0 seems to be fine but still can't use SetAcl. But if I go to CMD as admin, run the regsvr32 command and restart my script, it can create the object without issue. I know my poor knowledge makes me miss something. Anyone can help me figure this out ?
×
×
  • Create New...