473,394 Members | 1,887 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

converting from header files to Win32API declare

hi,
I'm trying to convert some .h files to API Declaration to use the function
and structs.
one of it is this:
NTMS_GUID CurrentLibrary; // the current library

NTMS_GUID MediaPool; // media pool that the media belongs to

NTMS_GUID Location; // actual location of the media

DWORD LocationType;

NTMS_GUID MediaType;

NTMS_GUID HomeSlot; // home slot for online media

CHAR szBarCode[NTMS_BARCODE_LENGTH]; // bar code string

DWORD BarCodeState; // current state of the bar code

CHAR szSequenceNumber[NTMS_SEQUENCE_LENGTH];

DWORD MediaState; // current media state

DWORD dwNumberOfPartitions;

} NTMS_I1_PMIDINFORMATIONA;

which I've converted to this (vb.net):

<StructLayout(LayoutKind.Sequential)>

Private Structure NTMS_I1_PMIDINFORMATIONA

Public CurrentLibrary As NTMS_GUID ' // the current library

Public MediaPool As NTMS_GUID ' // media pool that the media belongs to

Public Location As NTMS_GUID ' // actual location of the media

Public LocationType As Int32

Public MediaType As NTMS_GUID

Public HomeSlot As NTMS_GUID ' // home slot for online media

Public szBarCode(NTMS_BARCODE_LENGTH) As Byte ' // bar code string

Public BarCodeState As Int32 ' // current state of the bar code

Public szSequenceNumber(NTMS_SEQUENCE_LENGTH) As Byte

Public MediaState As Int32 ' // current media state

Public dwNumberOfPartitions As Int32

End Structure

am I on the right track here and would you help me please converting this
struct:

typedef struct _NTMS_OBJECTINFORMATIONW {

DWORD dwSize;

DWORD dwType;

SYSTEMTIME Created;

SYSTEMTIME Modified;

NTMS_GUID ObjectGuid;

BOOL Enabled;

DWORD dwOperationalState;

WCHAR szName[NTMS_OBJECTNAME_LENGTH];

WCHAR szDescription[NTMS_DESCRIPTION_LENGTH];

#ifdef MIDL_PASS

[switch_is(dwType)] union {

[case(NTMS_DRIVE)] NTMS_DRIVEINFORMATIONW Drive;

[case(NTMS_DRIVE_TYPE)] NTMS_DRIVETYPEINFORMATIONW DriveType;

[case(NTMS_LIBRARY)] NTMS_LIBRARYINFORMATION Library;

[case(NTMS_CHANGER)] NTMS_CHANGERINFORMATIONW Changer;

[case(NTMS_CHANGER_TYPE)] NTMS_CHANGERTYPEINFORMATIONW ChangerType;

[case(NTMS_STORAGESLOT)] NTMS_STORAGESLOTINFORMATION StorageSlot;

[case(NTMS_IEDOOR)] NTMS_IEDOORINFORMATION IEDoor;

[case(NTMS_IEPORT)] NTMS_IEPORTINFORMATION IEPort;

[case(NTMS_PHYSICAL_MEDIA)] NTMS_PMIDINFORMATIONW PhysicalMedia;

[case(NTMS_LOGICAL_MEDIA)] NTMS_LMIDINFORMATION LogicalMedia;

[case(NTMS_PARTITION)] NTMS_PARTITIONINFORMATIONW Partition;

[case(NTMS_MEDIA_POOL)] NTMS_MEDIAPOOLINFORMATION MediaPool;

[case(NTMS_MEDIA_TYPE)] NTMS_MEDIATYPEINFORMATION MediaType;

[case(NTMS_LIBREQUEST)] NTMS_LIBREQUESTINFORMATIONW LibRequest;

[case(NTMS_OPREQUEST)] NTMS_OPREQUESTINFORMATIONW OpRequest;

[case(NTMS_COMPUTER)] NTMS_COMPUTERINFORMATION Computer;

[default] ;

} Info;

#else

union {

NTMS_DRIVEINFORMATIONW Drive;

NTMS_DRIVETYPEINFORMATIONW DriveType;

NTMS_LIBRARYINFORMATION Library;

NTMS_CHANGERINFORMATIONW Changer;

NTMS_CHANGERTYPEINFORMATIONW ChangerType;

NTMS_STORAGESLOTINFORMATION StorageSlot;

NTMS_IEDOORINFORMATION IEDoor;

NTMS_IEPORTINFORMATION IEPort;

NTMS_PMIDINFORMATIONW PhysicalMedia;

NTMS_LMIDINFORMATION LogicalMedia;

NTMS_PARTITIONINFORMATIONW Partition;

NTMS_MEDIAPOOLINFORMATION MediaPool;

NTMS_MEDIATYPEINFORMATION MediaType;

NTMS_LIBREQUESTINFORMATIONW LibRequest;

NTMS_OPREQUESTINFORMATIONW OpRequest;

NTMS_COMPUTERINFORMATION Computer;

} Info;

#endif // MIDL_PASS

} NTMS_OBJECTINFORMATIONW, *LPNTMS_OBJECTINFORMATIONW;

Thanks All

Majed
Nov 20 '05 #1
1 1192
hi

my post was missing the first line of the struct and here it is:

typedef struct _NTMS_I1_PMIDINFORMATIONA {

NTMS_GUID CurrentLibrary; // the current library

NTMS_GUID MediaPool; // media pool that the media belongs to

NTMS_GUID Location; // actual location of the media

DWORD LocationType;

NTMS_GUID MediaType;

NTMS_GUID HomeSlot; // home slot for online media

CHAR szBarCode[NTMS_BARCODE_LENGTH]; // bar code string

DWORD BarCodeState; // current state of the bar code

CHAR szSequenceNumber[NTMS_SEQUENCE_LENGTH];

DWORD MediaState; // current media state

DWORD dwNumberOfPartitions;

} NTMS_I1_PMIDINFORMATIONA;

I converted it to vb.net like this

<StructLayout(LayoutKind.Sequential)>

Private Structure NTMS_I1_PMIDINFORMATIONA

Public CurrentLibrary As NTMS_GUID ' // the current library

Public MediaPool As NTMS_GUID ' // media pool that the media belongs to

Public Location As NTMS_GUID ' // actual location of the media

Public LocationType As Int32

Public MediaType As NTMS_GUID

Public HomeSlot As NTMS_GUID ' // home slot for online media

Public szBarCode(NTMS_BARCODE_LENGTH) As Byte ' // bar code string

Public BarCodeState As Int32 ' // current state of the bar code

Public szSequenceNumber(NTMS_SEQUENCE_LENGTH) As Byte

Public MediaState As Int32 ' // current media state

Public dwNumberOfPartitions As Int32

End Structure

can you help converting this struct ,please.!

typedef struct _NTMS_OBJECTINFORMATIONW {

DWORD dwSize;

DWORD dwType;

SYSTEMTIME Created;

SYSTEMTIME Modified;

NTMS_GUID ObjectGuid;

BOOL Enabled;

DWORD dwOperationalState;

WCHAR szName[NTMS_OBJECTNAME_LENGTH];

WCHAR szDescription[NTMS_DESCRIPTION_LENGTH];

#ifdef MIDL_PASS

[switch_is(dwType)] union {

[case(NTMS_DRIVE)] NTMS_DRIVEINFORMATIONW Drive;

[case(NTMS_DRIVE_TYPE)] NTMS_DRIVETYPEINFORMATIONW DriveType;

[case(NTMS_LIBRARY)] NTMS_LIBRARYINFORMATION Library;

[case(NTMS_CHANGER)] NTMS_CHANGERINFORMATIONW Changer;

[case(NTMS_CHANGER_TYPE)] NTMS_CHANGERTYPEINFORMATIONW ChangerType;

[case(NTMS_STORAGESLOT)] NTMS_STORAGESLOTINFORMATION StorageSlot;

[case(NTMS_IEDOOR)] NTMS_IEDOORINFORMATION IEDoor;

[case(NTMS_IEPORT)] NTMS_IEPORTINFORMATION IEPort;

[case(NTMS_PHYSICAL_MEDIA)] NTMS_PMIDINFORMATIONW PhysicalMedia;

[case(NTMS_LOGICAL_MEDIA)] NTMS_LMIDINFORMATION LogicalMedia;

[case(NTMS_PARTITION)] NTMS_PARTITIONINFORMATIONW Partition;

[case(NTMS_MEDIA_POOL)] NTMS_MEDIAPOOLINFORMATION MediaPool;

[case(NTMS_MEDIA_TYPE)] NTMS_MEDIATYPEINFORMATION MediaType;

[case(NTMS_LIBREQUEST)] NTMS_LIBREQUESTINFORMATIONW LibRequest;

[case(NTMS_OPREQUEST)] NTMS_OPREQUESTINFORMATIONW OpRequest;

[case(NTMS_COMPUTER)] NTMS_COMPUTERINFORMATION Computer;

[default] ;

} Info;

#else

union {

NTMS_DRIVEINFORMATIONW Drive;

NTMS_DRIVETYPEINFORMATIONW DriveType;

NTMS_LIBRARYINFORMATION Library;

NTMS_CHANGERINFORMATIONW Changer;

NTMS_CHANGERTYPEINFORMATIONW ChangerType;

NTMS_STORAGESLOTINFORMATION StorageSlot;

NTMS_IEDOORINFORMATION IEDoor;

NTMS_IEPORTINFORMATION IEPort;

NTMS_PMIDINFORMATIONW PhysicalMedia;

NTMS_LMIDINFORMATION LogicalMedia;

NTMS_PARTITIONINFORMATIONW Partition;

NTMS_MEDIAPOOLINFORMATION MediaPool;

NTMS_MEDIATYPEINFORMATION MediaType;

NTMS_LIBREQUESTINFORMATIONW LibRequest;

NTMS_OPREQUESTINFORMATIONW OpRequest;

NTMS_COMPUTERINFORMATION Computer;

} Info;

#endif // MIDL_PASS

} NTMS_OBJECTINFORMATIONW, *LPNTMS_OBJECTINFORMATIONW;
Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Majed | last post by:
hi, I'm trying to convert some .h files to API Declaration to use the function and structs. one of it is this: NTMS_GUID CurrentLibrary; // the current library NTMS_GUID MediaPool; // media...
1
by: Maurice Mertens | last post by:
Hello, I'm having troubles with saving a tiff-file with a certain compression and colordepth. This is the code I use: ----------------------------------------------------------------------...
11
by: Steven T. Hatton | last post by:
In the past there have been lengthy discussiions regarding the role of header files in C++. People have been very adamat about header files serving as in interface to the implementation. I do...
12
by: blueblueblue2005 | last post by:
Hi, here is an example I copied from Deitel C++ book. but when I compile it, always get the above compilation error, no matter how I change the include order, please help. here is the files:...
2
by: Nurchi BECHED | last post by:
Hello, my dearest respected brother, All! How do you make calls to Win32Api functions from C# I have an old example in Visual FoxPro... Kind of need to do the same in C# now... I need to get...
9
by: chat | last post by:
Hi, every body. I have 3 files like this: -------------------------------------------------------- file name : header.h #ifndef TEST_H #define TEST_H int a=1; double b=0.5;
4
by: Christoph Scholtes | last post by:
Hi, I have some questions about header files: Say I have a file functions.c which contains a couple of functions. I have declared some structs in this file too. The structs are defined in...
5
by: redeagle | last post by:
In VB6, the code for a structure is Structure zFuheader Dim Id1(80) As Byte Dim Id2(80) As Byte End Structure However, in .NET, it doesn't let you declare the array size in the structure.
8
by: Eric | last post by:
I am writing a program with several header files. I would like for some of them to be aware of others. Here is a small example of my problem in three different files: //// main.c++ #include...
1
RRick
by: RRick | last post by:
I have a unix C++ project that needs to be converted over to windows visual studio. I'm not sure of the exact version of VS, but it's a recent version, probabIy 2003 or 2005. I would like the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.