When i call LineInitialize() in Vb.net in my program,the
NotSupported_Exception always occurs, don't know why.

The callback function is realized through "Delegate"


Declare Function lineInitialize Lib "coredll.dll" ( _
ByVal lphPhoneApp As Int32, _
ByVal hInstance As IntPtr, _
ByVal lpfnCallback As lineCallBack, _
ByVal lpszFriendlyAppName As String, _
ByVal lpdwNumDevs As Int32) As Int32

lineCallBack is a delegate function correctly defined and associated with
its implementation

if i replace the declaration of the line "ByVal lpfnCallback As
lineCallBack," to "ByVal lpfnCallback As intptr" and a intptr.zero is passed
to it as "NULL" for this param, the Function does work but returns a Result
of "Invalid_Pointer"

can someone help?

Re: Lineinitialize problem in Vb.net, some one can help? How to Initialize TAPI in VB.net? by Alex

Alex
Wed Apr 27 23:26:25 CDT 2005

It is not possible to use delegate as callback in CF 1.0. CF 2.0 adds
support for it.
An alternative is to use lineInitializeEx and choose event or window as the
means fo communications. Even simpler solution is to create a thread in
which keep calling lineGetMessage in a loop:

int dwApiVersion = 0x20000;
LINEINITIALIZEEXPARAMS initParams = new
LINEINITIALIZEEXPARAMS(IntPtr.Zero);

// Intialize TAPI app and throw an exception if failed
int ret = NativeTapi.lineInitializeEx(out m_hLineApp, IntPtr.Zero,
IntPtr.Zero, "MyApp", out dwNumDev, ref dwApiVersion, initParams);
Thread thTapi = new Thread(new ThreadStart(TapiThreadProc));
thTapi.Start();


private void TapiThreadProc()
{
while( !stop )
{
LINEMESSAGE msg;
if ( NativeTapi.lineGetMessage(m_hLineApp, out msg, -1) == 0 )
{
//Do Something
}
}
}

--
Alex Feinman
---
Visit http://www.opennetcf.org
"Xiaoyu" <xiaoyu@let.com.cn> wrote in message
news:ernmOy5SFHA.3344@TK2MSFTNGP12.phx.gbl...
> When i call LineInitialize() in Vb.net in my program,the
> NotSupported_Exception always occurs, don't know why.
>
> The callback function is realized through "Delegate"
>
>
> Declare Function lineInitialize Lib "coredll.dll" ( _
> ByVal lphPhoneApp As Int32, _
> ByVal hInstance As IntPtr, _
> ByVal lpfnCallback As lineCallBack, _
> ByVal lpszFriendlyAppName As String, _
> ByVal lpdwNumDevs As Int32) As Int32
>
> lineCallBack is a delegate function correctly defined and associated with
> its implementation
>
> if i replace the declaration of the line "ByVal lpfnCallback As
> lineCallBack," to "ByVal lpfnCallback As intptr" and a intptr.zero is
> passed
> to it as "NULL" for this param, the Function does work but returns a
> Result
> of "Invalid_Pointer"
>
> can someone help?
>
>
>


Re: Lineinitialize problem in Vb.net, some one can help? How to Initialize TAPI in VB.net? by Alex

Alex
Wed Apr 27 23:27:47 CDT 2005

In fact you might want to take a look at the whole TAPI wrapper:
http://www.alexfeinman.com/download.asp?doc=tapi1.1.zip

--
Alex Feinman
---
Visit http://www.opennetcf.org
"Xiaoyu" <xiaoyu@let.com.cn> wrote in message
news:ernmOy5SFHA.3344@TK2MSFTNGP12.phx.gbl...
> When i call LineInitialize() in Vb.net in my program,the
> NotSupported_Exception always occurs, don't know why.
>
> The callback function is realized through "Delegate"
>
>
> Declare Function lineInitialize Lib "coredll.dll" ( _
> ByVal lphPhoneApp As Int32, _
> ByVal hInstance As IntPtr, _
> ByVal lpfnCallback As lineCallBack, _
> ByVal lpszFriendlyAppName As String, _
> ByVal lpdwNumDevs As Int32) As Int32
>
> lineCallBack is a delegate function correctly defined and associated with
> its implementation
>
> if i replace the declaration of the line "ByVal lpfnCallback As
> lineCallBack," to "ByVal lpfnCallback As intptr" and a intptr.zero is
> passed
> to it as "NULL" for this param, the Function does work but returns a
> Result
> of "Invalid_Pointer"
>
> can someone help?
>
>
>


Re: Lineinitialize problem in Vb.net, some one can help? How to Initialize TAPI in VB.net? by Xiaoyu

Xiaoyu
Thu Apr 28 01:51:56 CDT 2005

thank you for your quick response,this helps a lot!!!
I also downloaded the wrapper and will have a look into it, thanx!



"Alex Feinman [MVP]" <public_news@alexfeinman.com> ????
news:efqRmp6SFHA.2520@TK2MSFTNGP09.phx.gbl...
> It is not possible to use delegate as callback in CF 1.0. CF 2.0 adds
> support for it.
> An alternative is to use lineInitializeEx and choose event or window as
the
> means fo communications. Even simpler solution is to create a thread in
> which keep calling lineGetMessage in a loop:
>
> int dwApiVersion = 0x20000;
> LINEINITIALIZEEXPARAMS initParams = new
> LINEINITIALIZEEXPARAMS(IntPtr.Zero);
>
> // Intialize TAPI app and throw an exception if failed
> int ret = NativeTapi.lineInitializeEx(out m_hLineApp, IntPtr.Zero,
> IntPtr.Zero, "MyApp", out dwNumDev, ref dwApiVersion, initParams);
> Thread thTapi = new Thread(new ThreadStart(TapiThreadProc));
> thTapi.Start();
>
>
> private void TapiThreadProc()
> {
> while( !stop )
> {
> LINEMESSAGE msg;
> if ( NativeTapi.lineGetMessage(m_hLineApp, out msg, -1) == 0 )
> {
> //Do Something
> }
> }
> }
>
> --
> Alex Feinman
> ---
> Visit http://www.opennetcf.org
> "Xiaoyu" <xiaoyu@let.com.cn> wrote in message
> news:ernmOy5SFHA.3344@TK2MSFTNGP12.phx.gbl...
> > When i call LineInitialize() in Vb.net in my program,the
> > NotSupported_Exception always occurs, don't know why.
> >
> > The callback function is realized through "Delegate"
> >
> >
> > Declare Function lineInitialize Lib "coredll.dll" ( _
> > ByVal lphPhoneApp As Int32, _
> > ByVal hInstance As IntPtr, _
> > ByVal lpfnCallback As lineCallBack, _
> > ByVal lpszFriendlyAppName As String, _
> > ByVal lpdwNumDevs As Int32) As Int32
> >
> > lineCallBack is a delegate function correctly defined and associated
with
> > its implementation
> >
> > if i replace the declaration of the line "ByVal lpfnCallback As
> > lineCallBack," to "ByVal lpfnCallback As intptr" and a intptr.zero is
> > passed
> > to it as "NULL" for this param, the Function does work but returns a
> > Result
> > of "Invalid_Pointer"
> >
> > can someone help?
> >
> >
> >
>



Re: Lineinitialize problem in Vb.net, some one can help? How to Initialize TAPI in VB.net? by Xiaoyu

Xiaoyu
Thu Apr 28 02:04:56 CDT 2005

OpenNETCF? you give your TAPI wrapper class the namespace of OpenNETCF
but my version of OpenNETCF that was recently downloaded from Opennetcf
homepage didn't include this class wrapper?


"Alex Feinman [MVP]" <public_news@alexfeinman.com> ????
news:%23c8JXq6SFHA.3652@TK2MSFTNGP15.phx.gbl...
> In fact you might want to take a look at the whole TAPI wrapper:
> http://www.alexfeinman.com/download.asp?doc=tapi1.1.zip
>
> --
> Alex Feinman
> ---
> Visit http://www.opennetcf.org
> "Xiaoyu" <xiaoyu@let.com.cn> wrote in message
> news:ernmOy5SFHA.3344@TK2MSFTNGP12.phx.gbl...
> > When i call LineInitialize() in Vb.net in my program,the
> > NotSupported_Exception always occurs, don't know why.
> >
> > The callback function is realized through "Delegate"
> >
> >
> > Declare Function lineInitialize Lib "coredll.dll" ( _
> > ByVal lphPhoneApp As Int32, _
> > ByVal hInstance As IntPtr, _
> > ByVal lpfnCallback As lineCallBack, _
> > ByVal lpszFriendlyAppName As String, _
> > ByVal lpdwNumDevs As Int32) As Int32
> >
> > lineCallBack is a delegate function correctly defined and associated
with
> > its implementation
> >
> > if i replace the declaration of the line "ByVal lpfnCallback As
> > lineCallBack," to "ByVal lpfnCallback As intptr" and a intptr.zero is
> > passed
> > to it as "NULL" for this param, the Function does work but returns a
> > Result
> > of "Invalid_Pointer"
> >
> > can someone help?
> >
> >
> >
>



Re: Lineinitialize problem in Vb.net, some one can help? How to Initialize TAPI in VB.net? by Alex

Alex
Thu Apr 28 09:55:09 CDT 2005

I never got around to actually including it into the library - mostly
because of lack of feedback

--
Alex Feinman
---
Visit http://www.opennetcf.org
"Xiaoyu" <xiaoyu@let.com.cn> wrote in message
news:up27tG8SFHA.612@TK2MSFTNGP12.phx.gbl...
> OpenNETCF? you give your TAPI wrapper class the namespace of OpenNETCF
> but my version of OpenNETCF that was recently downloaded from Opennetcf
> homepage didn't include this class wrapper?
>
>
> "Alex Feinman [MVP]" <public_news@alexfeinman.com> ????
> news:%23c8JXq6SFHA.3652@TK2MSFTNGP15.phx.gbl...
>> In fact you might want to take a look at the whole TAPI wrapper:
>> http://www.alexfeinman.com/download.asp?doc=tapi1.1.zip
>>
>> --
>> Alex Feinman
>> ---
>> Visit http://www.opennetcf.org
>> "Xiaoyu" <xiaoyu@let.com.cn> wrote in message
>> news:ernmOy5SFHA.3344@TK2MSFTNGP12.phx.gbl...
>> > When i call LineInitialize() in Vb.net in my program,the
>> > NotSupported_Exception always occurs, don't know why.
>> >
>> > The callback function is realized through "Delegate"
>> >
>> >
>> > Declare Function lineInitialize Lib "coredll.dll" ( _
>> > ByVal lphPhoneApp As Int32, _
>> > ByVal hInstance As IntPtr, _
>> > ByVal lpfnCallback As lineCallBack, _
>> > ByVal lpszFriendlyAppName As String, _
>> > ByVal lpdwNumDevs As Int32) As Int32
>> >
>> > lineCallBack is a delegate function correctly defined and associated
> with
>> > its implementation
>> >
>> > if i replace the declaration of the line "ByVal lpfnCallback As
>> > lineCallBack," to "ByVal lpfnCallback As intptr" and a intptr.zero is
>> > passed
>> > to it as "NULL" for this param, the Function does work but returns a
>> > Result
>> > of "Invalid_Pointer"
>> >
>> > can someone help?
>> >
>> >
>> >
>>
>
>


Another Problem Derived from your Reply by Xiaoyu

Xiaoyu
Wed May 04 00:30:14 CDT 2005

Where to get cf.net 2.0? and will cf.net 2.0 be integrated in new version of
Pocket PC sys?



"Alex Feinman [MVP]" <public_news@alexfeinman.com> ????
news:efqRmp6SFHA.2520@TK2MSFTNGP09.phx.gbl...
> It is not possible to use delegate as callback in CF 1.0. CF 2.0 adds
> support for it.
> An alternative is to use lineInitializeEx and choose event or window as
the
> means fo communications. Even simpler solution is to create a thread in
> which keep calling lineGetMessage in a loop:
>
> int dwApiVersion = 0x20000;
> LINEINITIALIZEEXPARAMS initParams = new
> LINEINITIALIZEEXPARAMS(IntPtr.Zero);
>
> // Intialize TAPI app and throw an exception if failed
> int ret = NativeTapi.lineInitializeEx(out m_hLineApp, IntPtr.Zero,
> IntPtr.Zero, "MyApp", out dwNumDev, ref dwApiVersion, initParams);
> Thread thTapi = new Thread(new ThreadStart(TapiThreadProc));
> thTapi.Start();
>
>
> private void TapiThreadProc()
> {
> while( !stop )
> {
> LINEMESSAGE msg;
> if ( NativeTapi.lineGetMessage(m_hLineApp, out msg, -1) == 0 )
> {
> //Do Something
> }
> }
> }
>
> --
> Alex Feinman
> ---
> Visit http://www.opennetcf.org
> "Xiaoyu" <xiaoyu@let.com.cn> wrote in message
> news:ernmOy5SFHA.3344@TK2MSFTNGP12.phx.gbl...
> > When i call LineInitialize() in Vb.net in my program,the
> > NotSupported_Exception always occurs, don't know why.
> >
> > The callback function is realized through "Delegate"
> >
> >
> > Declare Function lineInitialize Lib "coredll.dll" ( _
> > ByVal lphPhoneApp As Int32, _
> > ByVal hInstance As IntPtr, _
> > ByVal lpfnCallback As lineCallBack, _
> > ByVal lpszFriendlyAppName As String, _
> > ByVal lpdwNumDevs As Int32) As Int32
> >
> > lineCallBack is a delegate function correctly defined and associated
with
> > its implementation
> >
> > if i replace the declaration of the line "ByVal lpfnCallback As
> > lineCallBack," to "ByVal lpfnCallback As intptr" and a intptr.zero is
> > passed
> > to it as "NULL" for this param, the Function does work but returns a
> > Result
> > of "Invalid_Pointer"
> >
> > can someone help?
> >
> >
> >
>



Derived Problem: lineinitializeexparams structure problem in VB, how to implement Union?! by Xiaoyu

Xiaoyu
Wed May 04 00:57:40 CDT 2005

I try to use this lineinitializeexparams for LineInitializeEx(), but
NotSupportException still shows off.

Dim iPhone as New PhoneDevice ' PhoneDevice is the API Wrapper
Dim LineInitExParam As New PhoneDevice.lineinitializeexparams
LineInitExParam.dwTotalSize =
System.Runtime.InteropServices.Marshal.SizeOf(LineInitExParam)
LineInitExParam.dwNeededSize = 0
LineInitExParam.dwUsedSize = 0
LineInitExParam.dwOptions = iPhone.LINEINITIALIZEEXOPTION_USEEVENT
LineInitExParam.hEvent = 0
LineInitExParam.dwCompletionKey = 0

HResult = iPhone.lineInitializeEx(hPhoneApp, hInstance, IntPtr.Zero,
AppName, numDevice, 0, LineInitExParam)

How to make it work? i noticed that <FieldOffset> attribute is not supported
in Compact Framework .net, which is known to be a way to implement Union.




"Alex Feinman [MVP]" <public_news@alexfeinman.com> ????
news:efqRmp6SFHA.2520@TK2MSFTNGP09.phx.gbl...
> It is not possible to use delegate as callback in CF 1.0. CF 2.0 adds
> support for it.
> An alternative is to use lineInitializeEx and choose event or window as
the
> means fo communications. Even simpler solution is to create a thread in
> which keep calling lineGetMessage in a loop:
>
> int dwApiVersion = 0x20000;
> LINEINITIALIZEEXPARAMS initParams = new
> LINEINITIALIZEEXPARAMS(IntPtr.Zero);
>
> // Intialize TAPI app and throw an exception if failed
> int ret = NativeTapi.lineInitializeEx(out m_hLineApp, IntPtr.Zero,
> IntPtr.Zero, "MyApp", out dwNumDev, ref dwApiVersion, initParams);
> Thread thTapi = new Thread(new ThreadStart(TapiThreadProc));
> thTapi.Start();
>
>
> private void TapiThreadProc()
> {
> while( !stop )
> {
> LINEMESSAGE msg;
> if ( NativeTapi.lineGetMessage(m_hLineApp, out msg, -1) == 0 )
> {
> //Do Something
> }
> }
> }
>
> --
> Alex Feinman
> ---
> Visit http://www.opennetcf.org
> "Xiaoyu" <xiaoyu@let.com.cn> wrote in message
> news:ernmOy5SFHA.3344@TK2MSFTNGP12.phx.gbl...
> > When i call LineInitialize() in Vb.net in my program,the
> > NotSupported_Exception always occurs, don't know why.
> >
> > The callback function is realized through "Delegate"
> >
> >
> > Declare Function lineInitialize Lib "coredll.dll" ( _
> > ByVal lphPhoneApp As Int32, _
> > ByVal hInstance As IntPtr, _
> > ByVal lpfnCallback As lineCallBack, _
> > ByVal lpszFriendlyAppName As String, _
> > ByVal lpdwNumDevs As Int32) As Int32
> >
> > lineCallBack is a delegate function correctly defined and associated
with
> > its implementation
> >
> > if i replace the declaration of the line "ByVal lpfnCallback As
> > lineCallBack," to "ByVal lpfnCallback As intptr" and a intptr.zero is
> > passed
> > to it as "NULL" for this param, the Function does work but returns a
> > Result
> > of "Invalid_Pointer"
> >
> > can someone help?
> >
> >
> >
>



Re: Another Problem Derived from your Reply by Daniel

Daniel
Wed May 04 02:54:44 CDT 2005

CF 2.0 is part of the public Beta 2 of Visual Studio 2005 or the .NET SDK

Cheers
Daniel
--
http://www.danielmoth.com/Blog/


"Xiaoyu" <xiaoyu@let.com.cn> wrote in message
news:%239rUUsGUFHA.548@tk2msftngp13.phx.gbl...
> Where to get cf.net 2.0? and will cf.net 2.0 be integrated in new version
> of
> Pocket PC sys?
>
>
>
> "Alex Feinman [MVP]" <public_news@alexfeinman.com> ????
> news:efqRmp6SFHA.2520@TK2MSFTNGP09.phx.gbl...
>> It is not possible to use delegate as callback in CF 1.0. CF 2.0 adds
>> support for it.
>> An alternative is to use lineInitializeEx and choose event or window as
> the
>> means fo communications. Even simpler solution is to create a thread in
>> which keep calling lineGetMessage in a loop:
>>
>> int dwApiVersion = 0x20000;
>> LINEINITIALIZEEXPARAMS initParams = new
>> LINEINITIALIZEEXPARAMS(IntPtr.Zero);
>>
>> // Intialize TAPI app and throw an exception if failed
>> int ret = NativeTapi.lineInitializeEx(out m_hLineApp, IntPtr.Zero,
>> IntPtr.Zero, "MyApp", out dwNumDev, ref dwApiVersion, initParams);
>> Thread thTapi = new Thread(new ThreadStart(TapiThreadProc));
>> thTapi.Start();
>>
>>
>> private void TapiThreadProc()
>> {
>> while( !stop )
>> {
>> LINEMESSAGE msg;
>> if ( NativeTapi.lineGetMessage(m_hLineApp, out msg, -1) == 0 )
>> {
>> //Do Something
>> }
>> }
>> }
>>
>> --
>> Alex Feinman
>> ---
>> Visit http://www.opennetcf.org
>> "Xiaoyu" <xiaoyu@let.com.cn> wrote in message
>> news:ernmOy5SFHA.3344@TK2MSFTNGP12.phx.gbl...
>> > When i call LineInitialize() in Vb.net in my program,the
>> > NotSupported_Exception always occurs, don't know why.
>> >
>> > The callback function is realized through "Delegate"
>> >
>> >
>> > Declare Function lineInitialize Lib "coredll.dll" ( _
>> > ByVal lphPhoneApp As Int32, _
>> > ByVal hInstance As IntPtr, _
>> > ByVal lpfnCallback As lineCallBack, _
>> > ByVal lpszFriendlyAppName As String, _
>> > ByVal lpdwNumDevs As Int32) As Int32
>> >
>> > lineCallBack is a delegate function correctly defined and associated
> with
>> > its implementation
>> >
>> > if i replace the declaration of the line "ByVal lpfnCallback As
>> > lineCallBack," to "ByVal lpfnCallback As intptr" and a intptr.zero is
>> > passed
>> > to it as "NULL" for this param, the Function does work but returns a
>> > Result
>> > of "Invalid_Pointer"
>> >
>> > can someone help?
>> >
>> >
>> >
>>
>
>