Fragen und Bugreports zur PureBasic 4.0-Beta.
mk-soft
Beiträge: 3855 Registriert: 24.11.2004 13:12
Wohnort: Germany
Beitrag
von mk-soft » 05.03.2006 16:14
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
mk-soft
Beiträge: 3855 Registriert: 24.11.2004 13:12
Wohnort: Germany
Beitrag
von mk-soft » 05.03.2006 18:43
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
ts-soft
Beiträge: 22292 Registriert: 08.09.2004 00:57
Computerausstattung: Mainboard: MSI 970A-G43 CPU: AMD FX-6300 Six-Core Processor GraKa: GeForce GTX 750 Ti, 2 GB Memory: 16 GB DDR3-1600 - Dual Channel
Wohnort: Berlin
Beitrag
von ts-soft » 05.03.2006 20:59
@mk-soft
Bauste jetzt eine OCX-Lib?
Tolle Idee
mk-soft
Beiträge: 3855 Registriert: 24.11.2004 13:12
Wohnort: Germany
Beitrag
von mk-soft » 05.03.2006 21:07
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