You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

  • "StefanSchnell" is male
  • "StefanSchnell" started this thread

Posts: 102

Date of registration: Mar 13th 2009

Location: Oberirsen - Germany

Occupation: Senior Software Engineer

Hobbies: Programming aund Photography

  • Send private message

1

Wednesday, April 29th 2009, 8:43pm

How to use ActiveX controls with Jabaco

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.
Visit my personal or commercial site
If you have questions or suggestions, write me an eMail or
meet me here

This post has been edited 1 times, last edit by "StefanSchnell" (Apr 29th 2009, 8:52pm)


Rate this thread
WoltLab Burning Board