Hello community,
here is the first "incomplete" step to use ActiveX controls with Jabaco. I collect all necessary WinAPI functions and create a form with one button. After the button click the Windows Media Player is part of the Jabaco form - not nice, but it works.
To control the ActiveX component, it is necessary to use the arguments pIStream and pIUnknwon - which are here still unused. You find a great COMViewer
here, to analyze COM components, the interface, methods etc.
With the using of COM components you produce only a result for Windows OS, but also a far pallet of new possibilities.
|
Jabaco Source
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
'-Begin-----------------------------------------------------------------
Private WinAPI Function FindWindow Lib "user32.dll" _
Alias "FindWindowW" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private WinAPI Sub CoInitialize Lib "ole32.dll" (_
ByRef pvReserved As Long)
Private WinAPI Sub CoUninitialize Lib "ole32.dll" ()
Private WinAPI Function AtlAxWinInit Lib "ATL.dll" () As Long
Private WinAPI Function AtlAxCreateControl Lib "ATL.dll" (_
ByVal lpszName As String, ByVal hWnd As Long, _
ByVal pIStream As Long, ByVal pIUnknown As Long) As Long
Dim Debug As New Debug
'-Procedure-----------------------------------------------------------
Public Sub Command1_Click()
Dim i As Long
Dim ActiveX As String
ActiveX = "WMPlayer.OCX"
Dim uActiveX As String
uActiveX = ""
'-Change name to wide char convention-----------------------------
For i = 1 To Len(ActiveX)
uActiveX = uActiveX & Mid(ActiveX, i, 1)
uActiveX = uActiveX & Chr(0)
Next
uActiveX = uActiveX & Chr(0) & Chr(0)
Debug.Print ActiveX
Debug.Print Len(uActiveX)
'-Get the handle of the Jabaco form-------------------------------
Dim hwnd As Long
hwnd = FindWindow(Null, "Jabaco Form")
Debug.Print hwnd
'-Initialize and create ActiveX control on Jabaco form------------
CoInitialize 0
Debug.Print AtlAxWinInit
Debug.Print AtlAxCreateControl(uActiveX, hwnd, 0, 0)
CoUninitialize
End Sub
'-End-------------------------------------------------------------------
|
Cheers
Stefan
P.S. Ignored all Debug.Print commands, it is my personal debug class as an equivalent to VB.