PowerBASIC Peer Support Forums
 

Go Back   PowerBASIC Peer Support Forums > User to user Discussions > Programming with Objects

Programming with Objects User to user discussions about programming with objects, including COM objects.

Reply
 
Thread Tools Display Modes
  #1  
Old Jan 13th, 2009, 04:09 PM
Michael Zimmer Michael Zimmer is offline
Member
 
Join Date: Feb 2005
Location: Bavaria, GERMANY
Posts: 79
How can i use VirtualBox COM Interface?

Hello everybody and a happy new year.

I want to use the COM interface of Sun VirtualBox. Normally examples can be used with C/C++, but i thought i gave the new compilers a chance to deal with those COM objects.
Years ago i've written some OOP code with Borland Pascal, developed some small tools with C++, but i don't have the slightest idea how to begin with this integration of the VB COM function, that should be used to automatically backup virtual guest machines.


here is a small example how i did it before (worked with VirtualBox 2.0.4, not 2.1.0, current release):
Code:
#COMPILE EXE
#DIM ALL
#INCLUDE "Win32API.inc"
#INCLUDE "VirtualBox210.inc"


'========================================================================================
' CLSCTX enum => MSDN
'========================================================================================
%CLSCTX_INPROC_SERVER          = &H1      ' Component is allowed in the same process space.
                                          ' Requires that the component be implemented as a DLL
%CLSCTX_INPROC_HANDLER         = &H2      ' Part is in-proc and the rest local or remote
%CLSCTX_LOCAL_SERVER           = &H4      ' Different process, same machine
%CLSCTX_INPROC_SERVER16        = &H8
%CLSCTX_REMOTE_SERVER          = &H10     ' Components may reside on remote computers (DCOM)
%CLSCTX_INPROC_HANDLER16       = &H20
%CLSCTX_RESERVED1              = &H40
%CLSCTX_RESERVED2              = &H80
%CLSCTX_RESERVED3              = &H100
%CLSCTX_RESERVED4              = &H200
%CLSCTX_NO_CODE_DOWNLOAD       = &H400
%CLSCTX_RESERVED5              = &H800
%CLSCTX_NO_CUSTOM_MARSHAL      = &H1000
%CLSCTX_ENABLE_CODE_DOWNLOAD   = &H2000
%CLSCTX_NO_FAILURE_LOG         = &H4000
%CLSCTX_DISABLE_AAA            = &H8000
%CLSCTX_ENABLE_AAA             = &H10000
%CLSCTX_FROM_DEFAULT_CONTEXT   = &H20000
%CLSCTX_ACTIVATE_32_BIT_SERVER = &H40000
%CLSCTX_ACTIVATE_64_BIT_SERVER = &H80000

%CLSCTX_INPROC = %CLSCTX_INPROC_SERVER OR %CLSCTX_INPROC_HANDLER
%CLSCTX_SERVER = %CLSCTX_INPROC_SERVER OR %CLSCTX_LOCAL_SERVER OR %CLSCTX_REMOTE_SERVER
%CLSCTX_ALL    = %CLSCTX_INPROC_SERVER OR %CLSCTX_INPROC_HANDLER OR %CLSCTX_LOCAL_SERVER OR %CLSCTX_REMOTE_SERVER
' ========================================================================================



FUNCTION PBMAIN () AS LONG

    LOCAL sVersion      AS STRING
    LOCAL ret           AS LONG
    LOCAL pIVBox        AS DWORD
    LOCAL CLSID_VBox    AS GUID
    LOCAL IID_VBox      AS GUID

    CLSID_VBox  = $CLSID_VirtualBox_VirtualBox
    IID_VBox    = $IID_VirtualBox_IVirtualBox

    ret = CoCreateInstance( CLSID_VBox, _
                            BYVAL %NULL, _
                            %CLSCTX_LOCAL_SERVER, _
                            IID_VBox, _
                            pIVBox )
    IF ret = %S_OK THEN
        STDOUT "Object instance created"
        ret = VirtualBoxIVirtualBox_Version( pIVBox, sVersion )
        STDOUT "VirtualBox-Version: " + sVersion
        ret = VirtualBox_Release( pIVBox )
        STDOUT "Objecthandle released"+STR$(ret)
        WAITKEY$
    ELSE
        STDOUT "could not create object"
    END IF

    WAITKEY$

END FUNCTION

below is a snippet for the COM interfaces build with PB COM browser:
Code:
' Generated by: PowerBASIC COM Browser v.2.00.0058
' DateTime    : 13.01.2009 at 18:57
' ------------------------------------------------
' Library Name: VirtualBox
' Library File: C:\Program Files\Sun\xVM VirtualBox\VBoxC.dll
' Description : VirtualBox Type Library
' GUID : {46137EEC-703B-4FE5-AFD4-7C9BBBBA0259}
' LCID : 0
' Version : 1.3

' Version Dependant ProgID's
$PROGID_VirtualBox_VirtualBox1 = "VirtualBox.VirtualBox.1"
$PROGID_VirtualBox_Session1 = "VirtualBox.Session.1"

' Version Independant ProgID's
$PROGID_VirtualBox_VirtualBox = "VirtualBox.VirtualBox"
$PROGID_VirtualBox_Session = "VirtualBox.Session"

' Class Indentifiers
$CLSID_VirtualBox_VirtualBox = GUID$("{B1A7A4F2-47B9-4A1E-82B2-07CCD5323C3F}")
$CLSID_VirtualBox_Session = GUID$("{3C02F46D-C9D2-4F11-A384-53F0CF917214}")

' Interface Indentifiers
$IID_VirtualBox_IErrorInfo = GUID$("{1CF2B120-547D-101B-8E65-08002B2BD119}")
$IID_VirtualBox_IVirtualBoxErrorInfo = GUID$("{E98B5376-8EB4-4EEA-812A-3964BF3BB26F}")
$IID_VirtualBox_IVirtualBoxCallback = GUID$("{5516CC08-FB81-47A6-B184-031E7BBD2997}")
$IID_VirtualBox_IVirtualBox = GUID$("{339ABCA2-F47A-4302-87F5-7BC324E6BBDE}")
$IID_VirtualBox_IHost = GUID$("{F39438D7-ABFD-409B-BC80-5F5291D92897}")
$IID_VirtualBox_IHostDVDDriveCollection = GUID$("{1909C533-1A1E-445F-A4E1-A267CFFC30ED}")
$IID_VirtualBox_IHostDVDDrive = GUID$("{21F86694-202D-4CE4-8B05-A63FF82DBF4C}")
$IID_VirtualBox_IHostDVDDriveEnumerator = GUID$("{1ED7CFAF-C363-40DF-AA4E-89C1AFB7D96B}")
$IID_VirtualBox_IHostFloppyDriveCollection = GUID$("{FD84BB86-C59A-4037-A557-755FF263A460}")
$IID_VirtualBox_IHostFloppyDrive = GUID$("{B6A4D1A9-4221-43C3-BD52-021A5DAA9ED2}")
$IID_VirtualBox_IHostFloppyDriveEnumerator = GUID$("{CE04C924-4F54-432A-9DEC-11FDDC3EA875}")
$IID_VirtualBox_IHostUSBDeviceCollection = GUID$("{F9D3F96D-B027-4994-B589-70BB9EE0D364}")
$IID_VirtualBox_IHostUSBDevice = GUID$("{173B4B44-D268-4334-A00D-B6521C9A740A}")
$IID_VirtualBox_IUSBDevice = GUID$("{850AF07B-9EE8-48C2-B6B0-F6D0ACBF63C3}")
$IID_VirtualBox_IHostUSBDeviceEnumerator = GUID$("{A0C55136-939F-4D20-B9D3-4D406F08BFA5}")
$IID_VirtualBox_IHostUSBDeviceFilterCollection = GUID$("{1A80458B-87F1-4A74-995D-04E2330119E0}")
$IID_VirtualBox_IHostUSBDeviceFilter = GUID$("{4CC70246-D74A-400F-8222-3900489C0374}")
$IID_VirtualBox_IUSBDeviceFilter = GUID$("{D6831FB4-1A94-4C2C-96EF-8D0D6192066D}")
$IID_VirtualBox_IHostUSBDeviceFilterEnumerator = GUID$("{FF735211-903E-4642-9C37-189EB44579FE}")
$IID_VirtualBox_IHostNetworkInterface = GUID$("{832720AC-2DF6-41D4-A867-A0B40DF14C7F}")
$IID_VirtualBox_IProgress = GUID$("{10CC03A1-717E-429B-992D-C67B56175A51}")
$IID_VirtualBox_ISystemProperties = GUID$("{604AFEBA-5963-4D12-A577-902FFB96352A}")
$IID_VirtualBox_IHardDiskFormat = GUID$("{7F3BA790-3A0B-4A8A-BAC2-BB50150123C5}")
$IID_VirtualBox_IMachine = GUID$("{EA6FB7EA-1993-4642-B113-F29EB39E0DF0}")
$IID_VirtualBox_IBIOSSettings = GUID$("{38B54279-DC35-4F5E-A431-835B867C6B5E}")
$IID_VirtualBox_IVRDPServer = GUID$("{F4584AE7-6BCE-474B-83D6-17D235E6AA89}")
$IID_VirtualBox_IHardDisk2Attachment = GUID$("{FA2F4619-2C14-4090-869E-73B45419B7B5}")
$IID_VirtualBox_IHardDisk2 = GUID$("{ED6E2525-C2FD-42A4-917A-7A9045AC9E15}")
$IID_VirtualBox_IMedium = GUID$("{A7FB3BFB-C180-4274-BAE4-7FBC89046E13}")
$IID_VirtualBox_IDVDDrive = GUID$("{D650EF30-BE9B-4DAE-B463-11D5824681A5}")
$IID_VirtualBox_IDVDImage2 = GUID$("{1C5165F1-9543-478D-A117-84A1D2317068}")
$IID_VirtualBox_IFloppyDrive = GUID$("{159412CD-BAB8-452E-8097-218A020825A6}")
$IID_VirtualBox_IFloppyImage2 = GUID$("{FCDEE8F0-03F9-11DD-95FF-0800200C9A66}")
$IID_VirtualBox_IUSBController = GUID$("{F4C2D3DC-F109-4DA7-93B1-EC28973AC89F}")
$IID_VirtualBox_IUSBDeviceFilterCollection = GUID$("{4FA3FC99-CEB1-4BF5-A9CB-E962D825C1EF}")
$IID_VirtualBox_IUSBDeviceFilterEnumerator = GUID$("{D5109C61-93E7-4726-926B-0DEE1020DA56}")
$IID_VirtualBox_IAudioAdapter = GUID$("{921873DB-5F3F-4B69-91F9-7BE9E535A2CB}")
$IID_VirtualBox_ISATAController = GUID$("{9A4B868B-1376-4533-8EF5-065B8E8CEDFF}")
$IID_VirtualBox_ISnapshot = GUID$("{9F1BBF79-13B0-4DA2-ABBA-4A992C65C083}")
$IID_VirtualBox_ISnapshotCollection = GUID$("{23852E3C-94CD-4801-AB05-ED35675B3894}")
$IID_VirtualBox_ISnapshotEnumerator = GUID$("{25CFA2A4-1F1D-4F05-9658-B7A5894EF1A3}")
$IID_VirtualBox_ISharedFolderCollection = GUID$("{9C7E2282-BB16-4FA7-9138-F383C5E02353}")
$IID_VirtualBox_ISharedFolder = GUID$("{8B0C5F70-9139-4F97-A421-64D5E9C335D5}")
$IID_VirtualBox_ISharedFolderEnumerator = GUID$("{1D420FD8-E7C1-4511-ABF4-A504DC6D0CBF}")
$IID_VirtualBox_INetworkAdapter = GUID$("{A876D9B1-68D9-43B1-9C68-DDEA0A473663}")
$IID_VirtualBox_ISerialPort = GUID$("{937F6970-5103-4745-B78E-D28DCF1479A8}")
$IID_VirtualBox_IParallelPort = GUID$("{0C925F06-DD10-4B77-8DE8-294D738C3214}")
$IID_VirtualBox_IProgressCollection = GUID$("{78B76A7C-F0F2-467C-9F0E-F089A54EE957}")
$IID_VirtualBox_IProgressEnumerator = GUID$("{E0380522-4EF1-48F4-856C-E455177CCB2D}")
$IID_VirtualBox_IGuestOSTypeCollection = GUID$("{A5E36749-A610-498B-9F29-2E36C1042D65}")
$IID_VirtualBox_IGuestOSType = GUID$("{BC415228-EED0-402C-92F5-96FC4E2DD7E4}")
$IID_VirtualBox_IGuestOSTypeEnumerator = GUID$("{A3335E02-4669-4E3C-80C7-C4DC7056A07C}")
$IID_VirtualBox_IPerformanceCollector = GUID$("{E22E1ACB-AC4A-43BB-A31C-17321659B0C6}")
$IID_VirtualBox_IPerformanceMetric = GUID$("{2A1A60AE-9345-4019-AD53-D34BA41CBFE9}")
$IID_VirtualBox_ISession = GUID$("{12F4DCDB-12B2-4EC1-B7CD-DDD9F6C5BF4D}")
$IID_VirtualBox_IConsole = GUID$("{E3C6D4A1-A935-47CA-B16D-F9E9C496E53E}")
$IID_VirtualBox_IGuest = GUID$("{D8556FCA-81BC-12AF-FCA3-365528FA38CA}")
$IID_VirtualBox_IKeyboard = GUID$("{2D1A531B-4C6E-49CC-8AF6-5C857B78B5D7}")
$IID_VirtualBox_IMouse = GUID$("{FD443EC1-0006-4F5B-9282-D72760A66916}")
$IID_VirtualBox_IDisplay = GUID$("{09789F63-4525-48E5-A5E4-1080453B0EAB}")
$IID_VirtualBox_IFramebuffer = GUID$("{AF431304-5B09-40E2-94DA-3C3CB03822C1}")
$IID_VirtualBox_IFramebufferOverlay = GUID$("{0BCC1C7E-E415-47D2-BFDB-E4C705FB0F47}")
$IID_VirtualBox_IMachineDebugger = GUID$("{B0B2A2DD-0627-4502-91C2-DDC5E77609E0}")
$IID_VirtualBox_IUSBDeviceCollection = GUID$("{E31F3248-90DD-4CA2-95F0-6B36042D96A2}")
$IID_VirtualBox_IUSBDeviceEnumerator = GUID$("{AEFE00F7-EB8A-454B-9EA4-FD5AD93C0E99}")
$IID_VirtualBox_IRemoteDisplayInfo = GUID$("{550104CD-2DFD-4A6C-857D-F6F8E088E62C}")
$IID_VirtualBox_IConsoleCallback = GUID$("{13DFBEF3-B74D-487D-BADA-2304529AEFA6}")
$IID_VirtualBox_IMachineEnumerator = GUID$("{1B554149-BE0A-4465-9252-9FF8F420AF55}")
$IID_VirtualBox_IMachineCollection = GUID$("{FD443EC1-3007-4F5B-9282-D72760A66916}")
$IID_VirtualBox_IInternalMachineControl = GUID$("{4042DDF2-93D3-4749-8517-DDE3F17EA630}")
$IID_VirtualBox_IInternalSessionControl = GUID$("{2581845A-5A9D-45FB-BC3B-2476552DD970}")

' Macros
MACRO MachineState = LONG
MACRO DeviceType = LONG
MACRO SessionState = LONG
MACRO USBDeviceState = LONG
MACRO USBDeviceFilterAction = LONG
MACRO HostNetworkInterfaceType = LONG
MACRO HostNetworkInterfaceStatus = LONG
MACRO ProcessorFeature = LONG
MACRO DataType = LONG
MACRO BIOSBootMenuMode = LONG
MACRO IDEControllerType = LONG
MACRO TSBool = LONG
MACRO VRDPAuthType = LONG
MACRO MediaState = LONG
MACRO HardDiskType = LONG
MACRO StorageBus = LONG
MACRO DriveState = LONG
MACRO AudioControllerType = LONG
MACRO AudioDriverType = LONG
MACRO ClipboardMode = LONG
MACRO NetworkAdapterType = LONG
MACRO NetworkAttachmentType = LONG
MACRO PortMode = LONG
MACRO SessionType = LONG
MACRO GuestStatisticType = LONG
MACRO FramebufferAccelerationOperation = LONG
MACRO DeviceActivity = LONG
MACRO Scope = LONG
MACRO DataFlags = LONG
MACRO HardDiskFormatCapabilities = LONG
MACRO MouseButtonState = LONG
MACRO FramebufferPixelFormat = LONG

' __MIDL___MIDL_itf_VirtualBox_0000_0002 enumeration
%MachineState_Null = 0
%MachineState_PoweredOff = 1
%MachineState_Saved = 2
%MachineState_Aborted = 3
%MachineState_Running = 4
%MachineState_Paused = 5
%MachineState_Stuck = 6
%MachineState_Starting = 7
%MachineState_Stopping = 8
%MachineState_Saving = 9
%MachineState_Restoring = 10
%MachineState_Discarding = 11
%MachineState_SettingUp = 12
%MachineState_FirstOnline = 4
%MachineState_LastOnline = 10

' __MIDL___MIDL_itf_VirtualBox_0000_0005 enumeration
%DeviceType_Null = 0
%DeviceType_Floppy = 1
%DeviceType_DVD = 2
%DeviceType_HardDisk = 3
%DeviceType_Network = 4
%DeviceType_USB = 5
%DeviceType_SharedFolder = 6

' __MIDL___MIDL_itf_VirtualBox_0000_0003 enumeration
%SessionState_Null = 0
%SessionState_Closed = 1
%SessionState_Open = 2
%SessionState_Spawning = 3
%SessionState_Closing = 4

' __MIDL___MIDL_itf_VirtualBox_0000_0028 enumeration
%USBDeviceState_NotSupported = 0
%USBDeviceState_Unavailable = 1
%USBDeviceState_Busy = 2
%USBDeviceState_Available = 3
%USBDeviceState_Held = 4
%USBDeviceState_Captured = 5

' __MIDL___MIDL_itf_VirtualBox_0000_0029 enumeration
%USBDeviceFilterAction_Null = 0
%USBDeviceFilterAction_Ignore = 1
%USBDeviceFilterAction_Hold = 2

' __MIDL___MIDL_itf_VirtualBox_0000_0015 enumeration
%HostNetworkInterfaceType_Unknown = 0
%HostNetworkInterfaceType_Ethernet = 1
%HostNetworkInterfaceType_PPP = 2
%HostNetworkInterfaceType_SLIP = 3

' __MIDL___MIDL_itf_VirtualBox_0000_0016 enumeration
%HostNetworkInterfaceStatus_Unknown = 0
%HostNetworkInterfaceStatus_Up = 1
%HostNetworkInterfaceStatus_Down = 2

' __MIDL___MIDL_itf_VirtualBox_0000_0014 enumeration
%ProcessorFeature_HWVirtEx = 0
%ProcessorFeature_PAE = 1
%ProcessorFeature_LongMode = 2

' __MIDL___MIDL_itf_VirtualBox_0000_0019 enumeration
%DataType_Int32 = 0
%DataType_Int8 = 1
%DataType_String = 2

' __MIDL___MIDL_itf_VirtualBox_0000_0011 enumeration
%BIOSBootMenuMode_Disabled = 0
%BIOSBootMenuMode_MenuOnly = 1
%BIOSBootMenuMode_MessageAndMenu = 2

' __MIDL___MIDL_itf_VirtualBox_0000_0012 enumeration
%IDEControllerType_Null = 0
%IDEControllerType_PIIX3 = 1
%IDEControllerType_PIIX4 = 2

' __MIDL___MIDL_itf_VirtualBox_0000_0001 enumeration
%TSBool_False = 0
%TSBool_True = 1
%TSBool_Default = 2

' __MIDL___MIDL_itf_VirtualBox_0000_0032 enumeration
%VRDPAuthType_Null = 0
%VRDPAuthType_External = 1
%VRDPAuthType_Guest = 2

' __MIDL___MIDL_itf_VirtualBox_0000_0017 enumeration
%MediaState_NotCreated = 0
%MediaState_Created = 1
%MediaState_LockedRead = 2
%MediaState_LockedWrite = 3
%MediaState_Inaccessible = 4
%MediaState_Creating = 5
%MediaState_Deleting = 6

' __MIDL___MIDL_itf_VirtualBox_0000_0018 enumeration
%HardDiskType_Normal = 0
%HardDiskType_Immutable = 1
%HardDiskType_Writethrough = 2

' __MIDL___MIDL_itf_VirtualBox_0000_0007 enumeration
%StorageBus_Null = 0
%StorageBus_IDE = 1
%StorageBus_SATA = 2

' __MIDL___MIDL_itf_VirtualBox_0000_0013 enumeration
%DriveState_Null = 0
%DriveState_NotMounted = 1
%DriveState_ImageMounted = 2
%DriveState_HostDriveCaptured = 3

' __MIDL___MIDL_itf_VirtualBox_0000_0031 enumeration
%AudioControllerType_AC97 = 0
%AudioControllerType_SB16 = 1

' __MIDL___MIDL_itf_VirtualBox_0000_0030 enumeration
%AudioDriverType_Null = 0
%AudioDriverType_WinMM = 1
%AudioDriverType_OSS = 2
%AudioDriverType_ALSA = 3
%AudioDriverType_DirectSound = 4
%AudioDriverType_CoreAudio = 5
%AudioDriverType_MMPM = 6
%AudioDriverType_Pulse = 7
%AudioDriverType_SolAudio = 8

' __MIDL___MIDL_itf_VirtualBox_0000_0008 enumeration
%ClipboardMode_Disabled = 0
%ClipboardMode_HostToGuest = 1
%ClipboardMode_GuestToHost = 2
%ClipboardMode_Bidirectional = 3

' __MIDL___MIDL_itf_VirtualBox_0000_0026 enumeration
%NetworkAdapterType_Null = 0
%NetworkAdapterType_Am79C970A = 1
%NetworkAdapterType_Am79C973 = 2
%NetworkAdapterType_I82540EM = 3
%NetworkAdapterType_I82543GC = 4

' __MIDL___MIDL_itf_VirtualBox_0000_0025 enumeration
%NetworkAttachmentType_Null = 0
%NetworkAttachmentType_NAT = 1
%NetworkAttachmentType_HostInterface = 2
%NetworkAttachmentType_Internal = 3

' __MIDL___MIDL_itf_VirtualBox_0000_0027 enumeration
%PortMode_Disconnected = 0
%PortMode_HostPipe = 1
%PortMode_HostDevice = 2

' __MIDL___MIDL_itf_VirtualBox_0000_0004 enumeration
%SessionType_Null = 0
%SessionType_Direct = 1
%SessionType_Remote = 2
%SessionType_Existing = 3

' __MIDL___MIDL_itf_VirtualBox_0000_0010 enumeration
%GuestStatisticType_CPULoad_Idle = 0
%GuestStatisticType_CPULoad_Kernel = 1
%GuestStatisticType_CPULoad_User = 2
%GuestStatisticType_Threads = 3
%GuestStatisticType_Processes = 4
%GuestStatisticType_Handles = 5
%GuestStatisticType_MemoryLoad = 6
%GuestStatisticType_PhysMemTotal = 7
%GuestStatisticType_PhysMemAvailable = 8
%GuestStatisticType_PhysMemBalloon = 9
%GuestStatisticType_MemCommitTotal = 10
%GuestStatisticType_MemKernelTotal = 11
%GuestStatisticType_MemKernelPaged = 12
%GuestStatisticType_MemKernelNonpaged = 13
%GuestStatisticType_MemSystemCache = 14
%GuestStatisticType_PageFileSize = 15
%GuestStatisticType_SampleNumber = 16
%GuestStatisticType_MaxVal = 17

' __MIDL___MIDL_itf_VirtualBox_0000_0023 enumeration
%FramebufferAccelerationOperation_SolidFillAcceleration = 1
%FramebufferAccelerationOperation_ScreenCopyAcceleration = 2

' __MIDL___MIDL_itf_VirtualBox_0000_0006 enumeration
%DeviceActivity_Null = 0
%DeviceActivity_Idle = 1
%DeviceActivity_Reading = 2
%DeviceActivity_Writing = 3

' __MIDL___MIDL_itf_VirtualBox_0000_0009 enumeration
%Scope_Global = 0
%Scope_Machine = 1
%Scope_Session = 2

' __MIDL___MIDL_itf_VirtualBox_0000_0020 enumeration
%DataFlags_None = 0
%DataFlags_Mandatory = 1
%DataFlags_Expert = 2
%DataFlags_Array = 4
%DataFlags_FlagMask = 7

' __MIDL___MIDL_itf_VirtualBox_0000_0021 enumeration
%HardDiskFormatCapabilities_Uuid = 1
%HardDiskFormatCapabilities_CreateFixed = 2
%HardDiskFormatCapabilities_CreateDynamic = 4
%HardDiskFormatCapabilities_CreateSplit2G = 8
%HardDiskFormatCapabilities_Differencing = 16
%HardDiskFormatCapabilities_Asynchronous = 32
%HardDiskFormatCapabilities_File = 64
%HardDiskFormatCapabilities_Properties = 128
%HardDiskFormatCapabilities_CapabilityMask = 255

' __MIDL___MIDL_itf_VirtualBox_0000_0022 enumeration
%MouseButtonState_LeftButton = 1
%MouseButtonState_RightButton = 2
%MouseButtonState_MiddleButton = 4
%MouseButtonState_WheelUp = 8
%MouseButtonState_WheelDown = 16
%MouseButtonState_MouseStateMask = 31

' __MIDL___MIDL_itf_VirtualBox_0000_0024 enumeration
%FramebufferPixelFormat_Opaque = -1
%FramebufferPixelFormat_FOURCC_RGB = 843204434


' Interface Name  : IErrorInfo
INTERFACE IErrorInfo $IID_VirtualBox_IErrorInfo
    INHERIT IUNKNOWN

    METHOD GetGUID(BYREF pGUID AS GUID) AS LONG
    METHOD GetSource(BYREF pBstrSource AS STRING) AS LONG
    METHOD GetDescription(BYREF pBstrDescription AS STRING) AS LONG
    METHOD GetHelpFile(BYREF pBstrHelpFile AS STRING) AS LONG
    METHOD GetHelpContext(BYREF pdwHelpContext AS DWORD) AS LONG
END INTERFACE

' Interface Name  : IVirtualBoxErrorInfo
INTERFACE IVirtualBoxErrorInfo $IID_VirtualBox_IVirtualBoxErrorInfo
    INHERIT IDISPATCH

    METHOD GetGUID <1610678272> (BYREF pGUID AS GUID)
    METHOD GetSource <1610678273> (BYREF pBstrSource AS STRING)
    METHOD GetDescription <1610678274> (BYREF pBstrDescription AS STRING)
    METHOD GetHelpFile <1610678275> (BYREF pBstrHelpFile AS STRING)
    METHOD GetHelpContext <1610678276> (BYVAL aMachineId AS GUID)
    PROPERTY GET ResultCode <1610743808> () AS LONG
    PROPERTY GET InterfaceID <1610743809> () AS GUID
    PROPERTY GET Component <1610743810> () AS STRING
    PROPERTY GET TEXT <1610743811> () AS STRING
    PROPERTY GET NEXT <1610743812> () AS IVirtualBoxErrorInfo
END INTERFACE

' Interface Name  : IVirtualBoxCallback
INTERFACE IVirtualBoxCallback $IID_VirtualBox_IVirtualBoxCallback
    INHERIT IDISPATCH

    METHOD OnMachineStateChange <1610678272> (BYVAL aMachineId AS GUID, BYVAL aState AS LONG)
    METHOD OnMachineDataChange <1610678273> (BYVAL aMachineId AS GUID)
    METHOD OnExtraDataCanChange <1610678274> (BYVAL aMachineId AS GUID, BYVAL aKey AS STRING, BYVAL aValue AS STRING, BYREF _
        aError AS STRING) AS LONG
    METHOD OnExtraDataChange <1610678275> (BYVAL aMachineId AS GUID, BYVAL aKey AS STRING, BYVAL aValue AS STRING)
    METHOD OnMediaRegistered <1610678276> (BYVAL aMediaId AS GUID, BYVAL aMediaType AS LONG, BYVAL aRegistered AS LONG)
    METHOD OnMachineRegistered <1610678277> (BYVAL aMachineId AS GUID, BYVAL aRegistered AS LONG)
    METHOD OnSessionStateChange <1610678278> (BYVAL aMachineId AS GUID, BYVAL aState AS LONG)
    METHOD OnSnapshotTaken <1610678279> (BYVAL aMachineId AS GUID, BYVAL aSnapshotId AS GUID)
    METHOD OnSnapshotDiscarded <1610678280> (BYVAL aMachineId AS GUID, BYVAL aSnapshotId AS GUID)
    METHOD OnSnapshotChange <1610678281> (BYVAL aMachineId AS GUID, BYVAL aSnapshotId AS GUID)
    METHOD OnGuestPropertyChange <1610678282> (BYVAL aMachineId AS GUID, BYVAL aName AS STRING, BYVAL aValue AS STRING, _
        BYVAL aFlags AS STRING)
END INTERFACE

' Interface Name  : IVirtualBox
' ClassID         : $CLSID_VirtualBox_VirtualBox
' ProgID          : $PROGID_VirtualBox_VirtualBox
' Version ProgID  : $PROGID_VirtualBox_VirtualBox1
INTERFACE IVirtualBox $IID_VirtualBox_IVirtualBox
    INHERIT IDISPATCH

    PROPERTY GET Version <1610743808> () AS STRING
    PROPERTY GET Revision <1610743809> () AS DWORD
    PROPERTY GET PackageType <1610743810> () AS STRING
    PROPERTY GET HomeFolder <1610743811> () AS STRING
    PROPERTY GET SettingsFilePath <1610743812> () AS STRING
    PROPERTY GET SettingsFileVersion <1610743813> () AS STRING
    PROPERTY GET SettingsFormatVersion <1610743814> () AS STRING
    PROPERTY GET HOST <1610743815> () AS IHost
    PROPERTY GET SystemProperties <1610743816> () AS ISystemProperties
    PROPERTY GET Machines2 <1610743817> () AS DWORD
    PROPERTY GET HardDisks2 <1610743818> () AS DWORD
    PROPERTY GET DVDImages <1610743819> () AS DWORD
    PROPERTY GET FloppyImages <1610743820> () AS DWORD
    PROPERTY GET ProgressOperations <1610743821> () AS IProgressCollection
    PROPERTY GET GuestOSTypes <1610743822> () AS IGuestOSTypeCollection
    PROPERTY GET SharedFolders <1610743823> () AS ISharedFolderCollection
    PROPERTY GET PerformanceCollector <1610743824> () AS IPerformanceCollector
    METHOD CreateMachine <1610743825> (BYVAL aName AS STRING, BYVAL aOSTypeId AS STRING, BYVAL aBaseFolder AS STRING, BYVAL _
        aId AS GUID) AS IMachine
    METHOD CreateLegacyMachine <1610743826> (BYVAL aName AS STRING, BYVAL aOSTypeId AS STRING, BYVAL aSettingsFile AS STRING, _
        BYVAL aId AS GUID) AS IMachine
    METHOD OpenMachine <1610743827> (BYVAL aSettingsFile AS STRING) AS IMachine
    METHOD RegisterMachine <1610743828> (BYVAL aMachine AS IMachine)
    METHOD GetMachine <1610743829> (BYVAL aId AS GUID) AS IMachine
    METHOD FindMachine <1610743830> (BYVAL aName AS STRING) AS IMachine
    METHOD UnregisterMachine <1610743831> (BYVAL aId AS GUID) AS IMachine
    METHOD CreateHardDisk2 <1610743832> (BYVAL aFormat AS STRING, BYVAL aLocation AS STRING) AS IHardDisk2
    METHOD OpenHardDisk2 <1610743833> (BYVAL aLocation AS STRING) AS IHardDisk2
    METHOD GetHardDisk2 <1610743834> (BYVAL aId AS GUID) AS IHardDisk2
    METHOD FindHardDisk2 <1610743835> (BYVAL aLocation AS STRING) AS IHardDisk2
    METHOD OpenDVDImage <1610743836> (BYVAL aLocation AS STRING, BYVAL aId AS GUID) AS IDVDImage2
    METHOD GetDVDImage <1610743837> (BYVAL aId AS GUID) AS IDVDImage2
    METHOD FindDVDImage <1610743838> (BYVAL aLocation AS STRING) AS IDVDImage2
    METHOD OpenFloppyImage <1610743839> (BYVAL aLocation AS STRING, BYVAL aId AS GUID) AS IFloppyImage2
    METHOD GetFloppyImage <1610743840> (BYVAL aId AS GUID) AS IFloppyImage2
    METHOD FindFloppyImage <1610743841> (BYVAL aLocation AS STRING) AS IFloppyImage2
    METHOD GetGuestOSType <1610743842> (BYVAL aId AS STRING) AS IGuestOSType
    METHOD CreateSharedFolder <1610743843> (BYVAL aName AS STRING, BYVAL aHostPath AS STRING, BYVAL aWritable AS LONG)
    METHOD RemoveSharedFolder <1610743844> (BYVAL aName AS STRING)
    METHOD GetNextExtraDataKey <1610743845> (BYVAL aKey AS STRING, BYREF aNextKey AS STRING, BYREF aNextValue AS STRING)
    METHOD GetExtraData <1610743846> (BYVAL aKey AS STRING) AS STRING
    METHOD SetExtraData <1610743847> (BYVAL aKey AS STRING, BYVAL aValue AS STRING)
    METHOD OpenSession <1610743848> (BYVAL aSession AS ISession, BYVAL aMachineId AS GUID)
    METHOD OpenRemoteSession <1610743849> (BYVAL aSession AS ISession, BYVAL aMachineId AS GUID, BYVAL aType AS STRING, _
        BYVAL aEnvironment AS STRING) AS IProgress
    METHOD OpenExistingSession <1610743850> (BYVAL aSession AS ISession, BYVAL aMachineId AS GUID)
    METHOD RegisterCallback <1610743851> (BYVAL aCallback AS IVirtualBoxCallback)
    METHOD UnregisterCallback <1610743852> (BYVAL aCallback AS IVirtualBoxCallback)
    METHOD WaitForPropertyChange <1610743853> (BYVAL aWhat AS STRING, BYVAL aTimeout AS DWORD, BYREF aChanged AS STRING, _
        BYREF aValues AS STRING)
    METHOD SaveSettings <1610743854> ()
    METHOD SaveSettingsWithBackup <1610743855> () AS STRING
END INTERFACE
__________________
I'am still confused...but on a higher level.
Reply With Quote
  #2  
Old Jan 13th, 2009, 05:07 PM
Josť Roca Josť Roca is offline
Moderator
 
Join Date: Mar 2004
Location: Valencia, Spain
Posts: 6,811
And where is the problem? Your old example will translate as follows:

Code:
FUNCTION PBMAIN () AS LONG

    LOCAL sVersion      AS STRING
    LOCAL pIVBox        AS IVirtualBox

    pIVBox = NEWCOM "VirtualBox.VirtualBox"
    IF ISOBJECT(pIVBox) THEN
        STDOUT "Object instance created"
        sVersion = pIVBox.Version
        STDOUT "VirtualBox-Version: " + ACODE$(sVersion)
        WAITKEY$
    ELSE
        STDOUT "could not create object"
    END IF

    WAITKEY$

END FUNCTION
__________________
Website: http://www.jose.it-berater.org/index.html
SED Editor, TypeLib Browser.
Forum: http://www.jose.it-berater.org/smfforum/index.php
Reply With Quote
  #3  
Old Jan 14th, 2009, 05:22 AM
Michael Zimmer Michael Zimmer is offline
Member
 
Join Date: Feb 2005
Location: Bavaria, GERMANY
Posts: 79
Thanks Josť. Looks very simple to me and best of it, really works.
__________________
I'am still confused...but on a higher level.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:41 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright © 1999-2011 PowerBASIC, Inc. All Rights Reserved.
Error in my_thread_global_end(): 1 threads didn't exit