Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
|
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 22nd, 2016, 02:45 PM
Registered User
 
Join Date: Sep 2016
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default HOW TO OPEN VHD FILE VIA OpenVirtualDisk API?

HELLO
I WANT TO OPEN VHD FILE VIA OpenVirtualDisk
I DID NOT FIND ANY VB6 CODE
 
Old December 24th, 2016, 12:28 PM
Registered User
 
Join Date: Sep 2016
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I TRIED THIS
Code:
Private Declare Function OpenVirtualDisk Lib "VirtDisk" (ByRef VirtualStorageType As PVirtualStorageType, ByVal Path As String, ByVal VirtualDiskAccessMask As Long, ByVal Flags As Long, ByVal Parameters As Long, ByVal Handle As Long) As Long
Private Type GUID
 Data1 As Long
 Data2 As Integer
 Data3 As Integer
 Data4(7) As Byte
End Type
Private Type PVirtualStorageType
   DeviceId As Long
   VendorId As GUID
End Type
Const VIRTUAL_STORAGE_TYPE_DEVICE_UNKNOWN = 0
Const VIRTUAL_STORAGE_TYPE_DEVICE_ISO = 1
Const VIRTUAL_STORAGE_TYPE_DEVICE_VHD = 2
Const VIRTUAL_STORAGE_TYPE_DEVICE_VHDX = 3

  Const VIRTUAL_DISK_ACCESS_NONE = &H0
  Const VIRTUAL_DISK_ACCESS_ATTACH_RO = &H10000
  Const VIRTUAL_DISK_ACCESS_ATTACH_RW = &H20000
  Const VIRTUAL_DISK_ACCESS_DETACH = &H40000
  Const VIRTUAL_DISK_ACCESS_GET_INFO = &H80000
  Const VIRTUAL_DISK_ACCESS_CREATE = &H100000
  Const VIRTUAL_DISK_ACCESS_METAOPS = &H200000
  Const VIRTUAL_DISK_ACCESS_READ = &HD0000
  Const VIRTUAL_DISK_ACCESS_ALL = &H3F0000
  Const VIRTUAL_DISK_ACCESS_WRITABLE = &H320000
  
   Const OPEN_VIRTUAL_DISK_FLAG_NONE = &H0
  Const OPEN_VIRTUAL_DISK_FLAG_NO_PARENTS = &H1
  Const OPEN_VIRTUAL_DISK_FLAG_BLANK_FILE = &H2
  Const OPEN_VIRTUAL_DISK_FLAG_BOOT_DRIVE = &H4
  Const OPEN_VIRTUAL_DISK_FLAG_CACHED_IO = &H8
  Const OPEN_VIRTUAL_DISK_FLAG_CUSTOM_DIFF_CHAIN = &H10
Private Sub Form_Load()
Dim vst As PVirtualStorageType, hnd As Long
vst.DeviceId = VIRTUAL_STORAGE_TYPE_DEVICE_VHD
w = OpenVirtualDisk(vst, "E:\1.vhd", VIRTUAL_DISK_ACCESS_ATTACH_RW, OPEN_VIRTUAL_DISK_FLAG_CACHED_IO, 0&, hnd)
BUT I GOT ERROR 87 ERROR_INVALID_PARAMETER

ANY HELP PLEASE?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Facebook api vs Twitter api aspless Classic ASP Basics 4 September 11th, 2017 08:51 AM
Difference between lightweight BC api and the other normal API? boy18nj BOOK: Beginning Cryptography with Java 2 June 19th, 2011 08:13 PM
Vb.Net 2003 : How to Open and Read an XML File to TEXT File. Lennie VS.NET 2002/2003 0 February 12th, 2010 05:18 PM
Open the "Open File" dialogue box piratelordx Access VBA 4 March 14th, 2006 10:08 PM
How to open a file in c#? looooly C# 3 September 25th, 2004 03:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.