Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / December 2004

Tip: Looking for answers? Try searching our database.

C# Passing UINT_PTR * to the Platform SDK

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
HarveyB - 07 Dec 2004 00:47 GMT
I am trying to call a Multimedia Function:

MMRESULT mixerGetID(
 HMIXEROBJ  hmxobj,  
 UINT_PTR * puMxId,  
 DWORD      fdwId    
);

Where puMxId is described as a 'Pointer to a variable that receives the
mixer device identifier.'

If I understand this correctly, 'UINT_PTR *'  is just a pointer to a uint.  
I base this on:

typedef  DWORD  LPVOID;
typedef   LPVOID  UINT_PTR;

So is the correct parameter call of the form 'ref uint'?
Mattias Sj?gren - 07 Dec 2004 22:40 GMT
>If I understand this correctly, 'UINT_PTR *'  is just a pointer to a uint.  

Not quite, it's a pointer to an unsigned pointer-sized integer.

>I base this on:
>
>typedef  DWORD  LPVOID;
>typedef   LPVOID  UINT_PTR;

Where did you find that? They aren't correct.

>So is the correct parameter call of the form 'ref uint'?

I'd use "out IntPtr".

Mattias

Signature

Mattias Sjögren [MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

HarveyB - 08 Dec 2004 22:45 GMT
I got the typdefs out of Windows.h in Visual Studio 6.  Are these definitions
obsolete?  They are contemporaneous with the most recent release of the
Platform SDK from which I am implementing some low level Audio functions.

"Mattias Sjögren" wrote:

> >If I understand this correctly, 'UINT_PTR *'  is just a pointer to a uint.  
>
[quoted text clipped - 12 lines]
>
> Mattias
Lau Lei Cheong - 09 Dec 2004 02:10 GMT
There is usually two suitation where an API will try to accept pointer to
primitive type as parameter:
1) the parameter is an array of the primitive type; or
2) the parameter is to be a by-reference type variable that the function
will write data in.
Obviously the puMxId should not be an array so your assumption is correct.

LPVOID just states that the pointer is to be a 32-bit pointer and nothing
else, it can be pointed to anything.

> Not quite, it's a pointer to an unsigned pointer-sized integer
it's correct but the "ref uint" will do too.

> I am trying to call a Multimedia Function:
>
[quoted text clipped - 14 lines]
>
> So is the correct parameter call of the form 'ref uint'?

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.