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?
> >
> >
> >
>