C# and Windows API

U

Usman

Hi !
I am working over windows API but i am stuck with few structs of win
dll's that how can i use them using PInvoke (as i cant use Interop so i
have to go with PInvoke).
The problem is that how can i convert Windows Struct and deffinations
into C# deffinations to delcare them atleast.
Can some one reffer me any article or suggest me how to do.
Regards,
Usman Bashir
 
J

Jared Parsons

Hello Usman,

Your best bet is to check out www.pinvoke.net. The have a lot of the Win32
API definitions in C#. If you have specific structs you need that aren't
published there post back with those and we'll try to help you out.
 
U

Usman

Jared said:
Hello Usman,

Your best bet is to check out www.pinvoke.net. The have a lot of the
Win32 API definitions in C#. If you have specific structs you need that
aren't published there post back with those and we'll try to help you out.
Thanks Parsons!
i did check the site but unable to find the required method there too.
Actually i m working with MAPI32 and i need this method to get the list
of messages. The declaration in mapi32 and my suggested declartion is
given below;
{windows Declartion)
HRESULT HrQueryAllRows(
LPMAPITABLE ptable,
LPSPropTagArray ptaga,
LPSRestriction pres,
LPSSortOrderSet psos,
LONG crowsMax,
LPSRowSet FAR * pprows
);

(my proposed)
[DllImport("MAPI32.DLL", CharSet = CharSet.Ansi, EntryPoint =
"MAPIFreeBuffer@4")]
private static extern int HrQueryAllRows(IntPtr pTable,IntPtr
pProp,IntPtr pRest, IntPtr pSort,long wCount,IntPtr lpRows);

//But again i m not sure how to use it after getting the interface
pointer. i do have samples in C++ but surelly it become ambigous while
casting them in C#.
Thanks in advance.
Regards,
Usman Bashir
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

Usman said:
Thanks Parsons!
i did check the site but unable to find the required method there too.
Actually i m working with MAPI32 and i need this method to get the list of
messages. The declaration in mapi32 and my suggested declartion is given
below;

If you did not find it there try looking for it in the newsgroups archives,
if you find your solution, PLEASE update pinvoke.net so the next one will
save time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top