Seite 1 von 1

ProtoType Bug ?

Verfasst: 05.03.2006 16:14
von mk-soft
Habe versucht ein Prototype in einer Procedure aufzurufen.
Bekomme aber einer Fehlermedlungh vom IDE.

Code: Alles auswählen

;-TOP
; Kommentar : ALT Helper
; Datei     : AtlHelper.pb
; Version   : 1.0
; Erstellt  : 05.02.2006
; Geändert  : 

; ---------------------------------------------------------

Global Lastmessage.s
Global LastError.l

Prototype.l ProtoAtlAxWinInit()
Prototype.l ProtoAtlAxCreateControl(Control.p-unicode, hWnd.l, *pStream, *ppContainer.IUnknown)
Prototype.l ProtoAtlAxGetControl(hWnd.l, *Obj.IDispatch)

Procedure InitAtl()

  If OpenLibrary(0, "ATL.dll") = 0
    LastMessage = "Fehler OpenLibrary"
    LastError = $80080001
    ProcedureReturn 0
  EndIf

  ;- Init Functions
  AtlAxWinInit.ProtoAtlAxWinInit = GetFunction(0, "AtlAxWinInit")
  AtlAxCreateControl.ProtoAtlAxCreateControl = GetFunction(0, "AtlAxCreateControl")
  AtlAxGetControl.ProtoAtlAxGetControl = GetFunction(0, "AtlAxGetControl")

  ProcedureReturn 1
  
EndProcedure

; ---------------------------------------------------------

Procedure.l CreateControl(Control.s, hWnd.l) ; Result IUnknown

  If AtlAxWinInit() = 0
    LastMessage = "Fehler AtlAxWinInit"
    LastError = $80080002
    ProcedureReturn 0
  EndIf
  
  AtlAxCreateControl(Control, hWnd, 0, @*Container.IUnknown)
  If *Container = 0
    LastMessage = "Fehler AtlAxCreateControl: " + Control
    LastError = $80080003
    ProcedureReturn 0
  Else
    ProcedureReturn *Container
  EndIf

EndProcedure

; ---------------------------------------------------------

Procedure ReleaseControl(*Container.IUnknown)

  If *Container
    *Container\Release()
  EndIf
  
EndProcedure

; ---------------------------------------------------------

Procedure.l GetControl(hWnd.l) ; Result IDispatch

  AtlAxGetControl(hWnd, @*Obj.IDispatch)
  If *Obj = 0
    LastMessage = "Fehler AtlAxGetControl"
    LastError = $80080004
    ProcedureReturn 0
  Else
    ProcedureReturn *Obj
  EndIf  

EndProcedure

; ---------------------------------------------------------

Procedure COMLIB_Init()
  CoInitialize_(#Null)
EndProcedure

Procedure COMLIB_End()
  CoUninitialize_() 
EndProcedure


Verfasst: 05.03.2006 18:43
von mk-soft
Ok, ist erledigt.
Habe im Englischen Forum gesucht.

Code: Alles auswählen

;-TOP
; Kommentar : ALT Helper
; Datei     : AtlHelper.pb
; Version   : 1.0
; Erstellt  : 05.02.2006
; Geändert  : 

; ---------------------------------------------------------

Global Lastmessage.s
Global LastError.l

Prototype.l ProtoAtlAxWinInit()
Prototype.l ProtoAtlAxCreateControl(Control.p-unicode, hWnd.l, *pStream, *ppContainer.IUnknown)
Prototype.l ProtoAtlAxGetControl(hWnd.l, *Obj.IDispatch)

Procedure InitAtl()

  If OpenLibrary(0, "ATL.dll") = 0
    LastMessage = "Fehler OpenLibrary"
    LastError = $80080001
    ProcedureReturn 0
  EndIf

  ; Init Functions
  Global AtlAxWinInit.ProtoAtlAxWinInit = GetFunction(0, "AtlAxWinInit")
  Global AtlAxCreateControl.ProtoAtlAxCreateControl = GetFunction(0, "AtlAxCreateControl")
  Global AtlAxGetControl.ProtoAtlAxGetControl = GetFunction(0, "AtlAxGetControl")

  ProcedureReturn 1
  
EndProcedure

; ---------------------------------------------------------

Procedure.l CreateControl(Control.s, hWnd.l) ; Result IUnknown

  If AtlAxWinInit() = 0
    LastMessage = "Fehler AtlAxWinInit"
    LastError = $80080002
    ProcedureReturn 0
  EndIf
  
  AtlAxCreateControl(Control, hWnd, 0, @*Container.IUnknown)
  If *Container = 0
    LastMessage = "Fehler AtlAxCreateControl: " + Control
    LastError = $80080003
    ProcedureReturn 0
  Else
    ProcedureReturn *Container
  EndIf

EndProcedure

; ---------------------------------------------------------

Procedure ReleaseControl(*Container.IUnknown)

  If *Container
    *Container\Release()
  EndIf
  
EndProcedure

; ---------------------------------------------------------

Procedure.l GetControl(hWnd.l) ; Result IDispatch

  AtlAxGetControl(hWnd, @*Obj.IDispatch)
  If *Obj = 0
    LastMessage = "Fehler AtlAxGetControl"
    LastError = $80080004
    ProcedureReturn 0
  Else
    ProcedureReturn *Obj
  EndIf  

EndProcedure

; ---------------------------------------------------------

Procedure COMLIB_Init()
  CoInitialize_(#Null)
EndProcedure

Procedure COMLIB_End()
  CoUninitialize_() 
EndProcedure

FF :allright:

Verfasst: 05.03.2006 20:59
von ts-soft
@mk-soft
Bauste jetzt eine OCX-Lib?
Tolle Idee :allright:

Verfasst: 05.03.2006 21:07
von mk-soft
Werde das jetzt weiterentwickeln weil ich das für weitere Entwicklungen brauche. Das OCX (ActiveX) von Falko läuft jetzt. Kannst dir ja Das Projekt mal anschauen was daraus geworden ist. Klappt nicht mit Interface, sondern über die Dispatch Funktion Invoke.

FF :wink: