Habe es Versucht im Container laufen zu lassen und komme zum gleichen ergebis. Sorry
Code: Alles auswählen
Interface AD_USB2XX Extends IDispatch
Scan(DeviceNr); boolean (Long)
AnalogVoltage(DeviceNr, Channel); Double
AnalogVoltage2(DeviceNr.w, Channel.w, rhs.double); Void
DigIO(DeviceNr.w); short
DigIO2(DeviceNr.w, rhs.w); void
GetAnalogDiffVoltage(DeviceNr.w,Channel.w); Double
GetDeviceType(DeviceNr.w); short
GetError(DeviceNr.w); short
GetSerialNr(DeviceNr.w); short
AnalogIO(DeviceNr.w, Channel.w); long
AnalogIO2(DeviceNr.w, Channel.w, rhs.l); void
EnableCalibration(*Password); BSTR Unicode ;
Calibration(DeviceNr.w, IO.w, Level.w, Channel.w); long
Calibration2(DeviceNr.w, IO.w, Level.w, Channel.w, rhs.l); void
SerialNr(DeviceNr.w); short
SerialNr2(DeviceNr.w, rhs.w); void
ReadAnalogVoltage(DeviceNr.w, Channel.w); double
WriteAnalogVoltage(DeviceNr.w, Channel.w, Voltage.double); void
ReadDigIn(DeviceNr.w); short
WriteDigOut(DeviceNr.w, Value.w); void
DataIO(DeviceNr.w); void
Close(); void
EndInterface
Procedure.s Uni2Ansi(unicodestr.l) ; Converts Unicode to normal (Ansi) string
lenA = WideCharToMultiByte_(#CP_ACP, 0, unicodestr, -1, 0, 0, 0, 0);
ansistr.s = Space(lenA)
If (lenA > 0)
WideCharToMultiByte_(#CP_ACP, 0, unicodestr, -1, @ansistr, lenA, 0, 0);
EndIf
ProcedureReturn ansistr
EndProcedure
Procedure.l Ansi2Uni(ansistr.s) ; Converts normal (Ansi) string to Unicode
lenA.l = Len(ansistr)
lenW = MultiByteToWideChar_(#CP_ACP, 0, ansistr, lenA, 0, 0)
If (lenW > 0) ; Check whether conversion was successful
unicodestr = SysAllocStringLen_(0, lenW)
MultiByteToWideChar_(#CP_ACP, 0, ansistr, lenA, unicodestr, lenW)
result = unicodestr
ProcedureReturn result
Else
ProcedureReturn 0
EndIf
EndProcedure
If OpenLibrary(0, "ATL.dll") ; Use the ATL DLL for our container
CoInitialize_(0)
If OpenWindow(0, 100, 100, 300, 315, #PB_Window_SystemMenu, "ATL test")
CreateGadgetList(WindowID())
ContainerGadget(0, 10, 10, 280, 270) ; This will be our container window, where the ActiveX will be rendered
CloseGadgetList()
ButtonGadget(1, 10, 285, 70, 25, "Stop")
ButtonGadget(2, 90, 285, 70, 25, "Play")
If CallFunction(0,"AtlAxWinInit")
CallFunction(0, "AtlAxCreateControl", Ansi2Uni("ADUSB2XX.ADUSB2XXCtrl.1"), GadgetID(0), 0, @Container.IUnknown) ; It always create the IE control even if flash isn't found
If Container
CallFunction(0,"AtlAxGetControl", GadgetID(0), @oObject.AD_USB2XX)
If oObject
If oObject\QueryInterface(?IID__DAD_USB2XX, @oObject.AD_USB2XX) = 0 ; Be sure it's a flash object in the IE container
r1 = oObject\Scan(0)
Debug r1
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
Select EventGadgetID()
Case 1
Case 2
EndSelect
EndIf
Until Event = #PB_Event_CloseWindow
oObject\Release()
EndIf
oObject\Release()
EndIf
EndIf
EndIf
CloseWindow(0) ; Don't forget this one, else the program will crash
EndIf
CoUninitialize_()
EndIf
End
DataSection
IID__DAD_USB2XX: ; BFD9E61F-75C4-4B33-8949-73A64F014514
Data.l $BFD9E61F
Data.w $75C4,$4B33
Data.b $89,$49,$73,$A6,$4F,$01,$45,$14
IID__DAD_USB2XXEvents: ; 9A894BB7-0F68-429D-A30A-FCE4F6379D78
Data.l $BFD9E61F
Data.w $75C4,$4B33
Data.b $89,$49,$73,$A6,$4F,$01,$45,$14
EndDataSection