For Programmers: Free Programming Magazines  


Home > Archive > Smartphone Developer Forum > January 2006 > lineGetDevCaps not supported on SP5 Smartphone?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author lineGetDevCaps not supported on SP5 Smartphone?
Stig Tollefsen

2006-01-18, 7:07 pm

I'm developing a telephony application in C# using TAPI (coredll.dll) on
an HTC i-mate SP5. I'm declaring the call to lineGetDevCaps like this:

[DllImport("coredll.dll", EntryPoint="lineGetDevCapsW", CharSet =
CharSet.Auto, SetLastError = true)]
internal static extern LineErrReturn lineGetDevCaps(IntPtr hLineApp,
uint dwDeviceID, uint dwAPIVersion, uint dwExtVersion, IntPtr
lpLineDevCaps);

I'm allocating space for lpLineDevCaps manually. When calling the
function, I get a NotSupportedException. Previous call to
lineInitializeEx returns as expected. Removing the EntryPoint
declaration yields the same result.

As far as I can see, the signature for lineGetDevCaps is correct. Is
there a version of Dumpbin I can use to validate that the function is
present in the dll? What if it isn't? What's wrong here? Answers are
appreciated!

Stig Tollefsen
Antares Mobile
Peter Foot [MVP]

2006-01-18, 7:07 pm

I assume your LineErrReturn is an enumeration - is this based on a 32 bit
type (int/uint)? have you tried changing the return to an int/uint?

Peter

--
Peter Foot
Windows Embedded MVP
www.peterfoot.net | www.inthehand.com

"Stig Tollefsen" <sto@antares.no> wrote in message
news:eQh$VMEHGHA.216@TK2MSFTNGP15.phx.gbl...
> I'm developing a telephony application in C# using TAPI (coredll.dll) on
> an HTC i-mate SP5. I'm declaring the call to lineGetDevCaps like this:
>
> [DllImport("coredll.dll", EntryPoint="lineGetDevCapsW", CharSet =
> CharSet.Auto, SetLastError = true)]
> internal static extern LineErrReturn lineGetDevCaps(IntPtr hLineApp, uint
> dwDeviceID, uint dwAPIVersion, uint dwExtVersion, IntPtr lpLineDevCaps);
>
> I'm allocating space for lpLineDevCaps manually. When calling the
> function, I get a NotSupportedException. Previous call to lineInitializeEx
> returns as expected. Removing the EntryPoint declaration yields the same
> result.
>
> As far as I can see, the signature for lineGetDevCaps is correct. Is there
> a version of Dumpbin I can use to validate that the function is present in
> the dll? What if it isn't? What's wrong here? Answers are appreciated!
>
> Stig Tollefsen
> Antares Mobile



Stig Tollefsen

2006-01-19, 4:10 am

Peter Foot [MVP] wrote:
> I assume your LineErrReturn is an enumeration - is this based on a 32 bit
> type (int/uint)? have you tried changing the return to an int/uint?
>
> Peter
>


Yes, it's an enum. Changing the return to a uint/int/ulong/long makes no
difference.

Stig
Alex Feinman [MVP]

2006-01-24, 3:59 am

NotSupportedException is thrown by Marshaller. It does not mean that the
call is not supported on the platform, simply that your P/Invoke definition
is not supported by marshaller.

Here is a definition that I know to work:
[DllImport("coredll")]
extern static public int lineGetDevCaps(IntPtr m_hLineApp,
int dwDeviceID,
int dwAPIVersion,
int dwExtVersion,
byte[] lpLineDevCaps
);

I'm not sure off the top of my head what's wrong with yours. Is this CF2?

"Stig Tollefsen" <sto@antares.no> wrote in message
news:eQh$VMEHGHA.216@TK2MSFTNGP15.phx.gbl...
> I'm developing a telephony application in C# using TAPI (coredll.dll) on
> an HTC i-mate SP5. I'm declaring the call to lineGetDevCaps like this:
>
> [DllImport("coredll.dll", EntryPoint="lineGetDevCapsW", CharSet =
> CharSet.Auto, SetLastError = true)]
> internal static extern LineErrReturn lineGetDevCaps(IntPtr hLineApp, uint
> dwDeviceID, uint dwAPIVersion, uint dwExtVersion, IntPtr lpLineDevCaps);
>
> I'm allocating space for lpLineDevCaps manually. When calling the
> function, I get a NotSupportedException. Previous call to lineInitializeEx
> returns as expected. Removing the EntryPoint declaration yields the same
> result.
>
> As far as I can see, the signature for lineGetDevCaps is correct. Is there
> a version of Dumpbin I can use to validate that the function is present in
> the dll? What if it isn't? What's wrong here? Answers are appreciated!
>
> Stig Tollefsen
> Antares Mobile


Stig Tollefsen

2006-01-26, 7:06 pm

Alex Feinman [MVP] wrote:
> NotSupportedException is thrown by Marshaller. It does not mean that the
> call is not supported on the platform, simply that your P/Invoke
> definition is not supported by marshaller.
>
> Here is a definition that I know to work:
> [DllImport("coredll")]
> extern static public int lineGetDevCaps(IntPtr m_hLineApp,
> int dwDeviceID,
> int dwAPIVersion,
> int dwExtVersion,
> byte[] lpLineDevCaps
> );
>
> I'm not sure off the top of my head what's wrong with yours. Is this CF2?
>


Yes, it's CF2. I found out what was wrong: the Marshaller call I had
used _true_ for fDeleteOld; this is not accepted. Using _false_ works
fine (but may cause a memory leak according to the docs?). I was
by Visual Studio reporting the error on the wrong line.

Stig
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com