TActiveX

Fonte: source/classes/activex.prg

Inherits from: TControl

TActiveX is FiveWin's ActiveX/COM container control that enables embedding ActiveX components (such as WebBrowser, Windows Media Player, Adobe Reader, or any registered COM component) inside FiveWin windows and dialogs. It provides direct access to the underlying OleObject for invoking methods, reading and writing properties, and handling events.

Key DATA Members

DATATypeDescription
hActiveXHandleWindow handle of the embedded ActiveX control
cProgIDCharacterProgID string (e.g. "Shell.Explorer", "WMPlayer.OCX")
aPropertiesArrayList of property names browsable via OLE
aMethodsArrayList of method names browsable via OLE
aEventsArrayList of event names provided by the control
bOnEventBlockCode block executed on each fired event
oOleAutoObjectUnderlying OLE automation object

Methods

MethodDescription
New( oWnd, cProgID, nRow, nCol, nW, nH )Create a new ActiveX control instance
ReDefine( nId, oWnd, cProgID )Redefine from a dialog resource placeholder
Do( cMethod, ... )Invoke a method of the underlying OLE object
GetProp( cName )Read a property value from the OLE object
SetProp( cName, uVal )Write a property value to the OLE object
OnEvent( nEvent, aParams )Event handler called on each ActiveX event

Example: Embedding a WebBrowser Control

#include "FiveWin.ch"

function Main()

   local oWnd, oActiveX

   DEFINE WINDOW oWnd TITLE "WebBrowser Embedded" SIZE 800, 600

   oActiveX := TActiveX():New( oWnd, "Shell.Explorer", 10, 10, 780, 550 )

   // Navigate to a URL using the OLE object
   oActiveX:Do( "Navigate2", "https://fivetechsoft.com" )

   oWnd:oClient := oActiveX

   ACTIVATE WINDOW oWnd CENTERED

return nil

Notes

Veja Também