How to call the function in cellcore.dll?
-
Hi, everyone! Now I am developing an application using TAPI. I want to import some functions from cellcore.dll. But I don't know how to write the prototype of these functions. The functions I want to import are: lineInitializeEx, lineNegotiateAPIVersion, lineOpen, lineSetEquipmentState, lineGetEquipmentState, lineRegister, lineClose and lineShutdown. For example, I try to import lineInitializeEx with the code below:
\[DllImport("cellcore.dll")\] private static extern long lineInitializeEx(ref uint phLineApp,IntPtr hInstance,IntPtr CallBackFunc,string strAppName, ref uint dwDevNum,ref uint pdwApiVersion,ref LINEINITIALIZEEXPARAMS lineParams);
I had declare LINEINITIALIZEEXPARAMS struct previous. It can compiled. But can't be executed. The error message say it can't find the entry point for this function. I wonder the prototype is wrong. How to write it? Thx!
There is some white cloud floating on the blue sky. That's the landscape I like.
-
Hi, everyone! Now I am developing an application using TAPI. I want to import some functions from cellcore.dll. But I don't know how to write the prototype of these functions. The functions I want to import are: lineInitializeEx, lineNegotiateAPIVersion, lineOpen, lineSetEquipmentState, lineGetEquipmentState, lineRegister, lineClose and lineShutdown. For example, I try to import lineInitializeEx with the code below:
\[DllImport("cellcore.dll")\] private static extern long lineInitializeEx(ref uint phLineApp,IntPtr hInstance,IntPtr CallBackFunc,string strAppName, ref uint dwDevNum,ref uint pdwApiVersion,ref LINEINITIALIZEEXPARAMS lineParams);
I had declare LINEINITIALIZEEXPARAMS struct previous. It can compiled. But can't be executed. The error message say it can't find the entry point for this function. I wonder the prototype is wrong. How to write it? Thx!
There is some white cloud floating on the blue sky. That's the landscape I like.
-
Hi, everyone! Now I am developing an application using TAPI. I want to import some functions from cellcore.dll. But I don't know how to write the prototype of these functions. The functions I want to import are: lineInitializeEx, lineNegotiateAPIVersion, lineOpen, lineSetEquipmentState, lineGetEquipmentState, lineRegister, lineClose and lineShutdown. For example, I try to import lineInitializeEx with the code below:
\[DllImport("cellcore.dll")\] private static extern long lineInitializeEx(ref uint phLineApp,IntPtr hInstance,IntPtr CallBackFunc,string strAppName, ref uint dwDevNum,ref uint pdwApiVersion,ref LINEINITIALIZEEXPARAMS lineParams);
I had declare LINEINITIALIZEEXPARAMS struct previous. It can compiled. But can't be executed. The error message say it can't find the entry point for this function. I wonder the prototype is wrong. How to write it? Thx!
There is some white cloud floating on the blue sky. That's the landscape I like.
You may have some errors in what you've shown and what you have elsewhere. For example,
CallBackFunc
generally would be a delegate on the managed side and you are returning long - LONG in C/C++ is an int/uint in C#. I've never used the library, but from looking at MSDN, this is how I'd attempt it and tweak where needed. Always useSetLastError
so you can get the last error from the system when thing go bang!/\* http://msdn.microsoft.com/en-us/library/ms893424.aspx
VOID FAR PASCAL lineCallbackFunc(
DWORD hDevice,
DWORD dwMsg,
DWORD dwCallbackInstance,
DWORD dwParam1,
DWORD dwParam2,
DWORD dwParam3
);*/
private delegate void lineCallbackFunc(
uint hDevice,
uint dwMsg,
uint dwCallbackInstance,
uint dwParam1,
uint dwParam2,
uint dwParam3);/\* http://msdn.microsoft.com/en-us/library/ms894378.aspx
typedef struct lineinitializeexparams_tag {
DWORD dwTotalSize;
DWORD dwNeededSize;
DWORD dwUsedSize;
DWORD dwOptions;
union {
HANDLE hEvent;
HANDLE hCompletionPort;
} Handles;
DWORD dwCompletionKey;
} LINEINITIALIZEEXPARAMS, FAR* LPLINEINITIALIZEEXPARAMS;*/\[StructLayout(LayoutKind.Sequential)\] private struct LINEINITIALIZEEXPARAMS { public uint dwTotalSize; public uint dwNeededSize; public uint dwUsedSize; public uint dwOptions; public IntPtr hEvent; public IntPtr hCompletionPort; public uint dwCompletionKey; } /\* http://msdn.microsoft.com/en-us/library/ms894370.aspx
LONG WINAPI lineInitializeEx(
LPHLINEAPP lphLineApp,
HINSTANCE hInstance,
LINECALLBACK lpfnCallback,
LPCWSTR lpszFriendlyAppName,
LPDWORD lpdwNumDevs,
LPDWORD lpdwAPIVersion,
LPLINEINITIALIZEEXPARAMS lpLineInitializeExParams
);*/
[DllImport("cellcore.dll", SetLastError = true)]
private static extern uint lineInitializeEx(
out IntPtr lphLineApp, // edit: this is a pointer to a handle so added 'out'
IntPtr hInstance,
lineCallbackFunc lpfnCallback,
StringBuilder lpszFriendlyAppName,
out uint lpdwNumDevs,
out uint lpdwAPIVersion,
ref LINEINITIALIZEEXPARAMS lpLineInitializeExParams
);Dave
Binging is like googling, i -
You may have some errors in what you've shown and what you have elsewhere. For example,
CallBackFunc
generally would be a delegate on the managed side and you are returning long - LONG in C/C++ is an int/uint in C#. I've never used the library, but from looking at MSDN, this is how I'd attempt it and tweak where needed. Always useSetLastError
so you can get the last error from the system when thing go bang!/\* http://msdn.microsoft.com/en-us/library/ms893424.aspx
VOID FAR PASCAL lineCallbackFunc(
DWORD hDevice,
DWORD dwMsg,
DWORD dwCallbackInstance,
DWORD dwParam1,
DWORD dwParam2,
DWORD dwParam3
);*/
private delegate void lineCallbackFunc(
uint hDevice,
uint dwMsg,
uint dwCallbackInstance,
uint dwParam1,
uint dwParam2,
uint dwParam3);/\* http://msdn.microsoft.com/en-us/library/ms894378.aspx
typedef struct lineinitializeexparams_tag {
DWORD dwTotalSize;
DWORD dwNeededSize;
DWORD dwUsedSize;
DWORD dwOptions;
union {
HANDLE hEvent;
HANDLE hCompletionPort;
} Handles;
DWORD dwCompletionKey;
} LINEINITIALIZEEXPARAMS, FAR* LPLINEINITIALIZEEXPARAMS;*/\[StructLayout(LayoutKind.Sequential)\] private struct LINEINITIALIZEEXPARAMS { public uint dwTotalSize; public uint dwNeededSize; public uint dwUsedSize; public uint dwOptions; public IntPtr hEvent; public IntPtr hCompletionPort; public uint dwCompletionKey; } /\* http://msdn.microsoft.com/en-us/library/ms894370.aspx
LONG WINAPI lineInitializeEx(
LPHLINEAPP lphLineApp,
HINSTANCE hInstance,
LINECALLBACK lpfnCallback,
LPCWSTR lpszFriendlyAppName,
LPDWORD lpdwNumDevs,
LPDWORD lpdwAPIVersion,
LPLINEINITIALIZEEXPARAMS lpLineInitializeExParams
);*/
[DllImport("cellcore.dll", SetLastError = true)]
private static extern uint lineInitializeEx(
out IntPtr lphLineApp, // edit: this is a pointer to a handle so added 'out'
IntPtr hInstance,
lineCallbackFunc lpfnCallback,
StringBuilder lpszFriendlyAppName,
out uint lpdwNumDevs,
out uint lpdwAPIVersion,
ref LINEINITIALIZEEXPARAMS lpLineInitializeExParams
);Dave
Binging is like googling, iI am pleasure to see your answer. Thank you! But I have still a problem. As the code you show, the struct LINEINITIALIZEEXPARAMS has two elements: hEvent and hCompletionPort. But in C++, this struct has a union. The element in it have the same name as your code. I know the keyword "union" isn't exist in C#. But I think this struct shouldn't be declare as this. Additional, I can't still execute this program. The error is still "No entry point found for lineInitializeEx". I hope you can help me again. Thx!
There is some white cloud floating on the blue sky. That's the landscape I like.
-
I am pleasure to see your answer. Thank you! But I have still a problem. As the code you show, the struct LINEINITIALIZEEXPARAMS has two elements: hEvent and hCompletionPort. But in C++, this struct has a union. The element in it have the same name as your code. I know the keyword "union" isn't exist in C#. But I think this struct shouldn't be declare as this. Additional, I can't still execute this program. The error is still "No entry point found for lineInitializeEx". I hope you can help me again. Thx!
There is some white cloud floating on the blue sky. That's the landscape I like.
You are correct about the struct - I missed the union :doh:
[StructLayout(LayoutKind.Explict)]
private struct LINEINITIALIZEEXPARAMS
{
[FieldOffset(0)]
public uint dwTotalSize;
[FieldOffset(4)]
public uint dwNeededSize;
[FieldOffset(8)]
public uint dwUsedSize;
[FieldOffset(12)]
public IntPtr hEvent;
public IntPtr hCompletionPort;
[FieldOffset(12)]
public uint dwCompletionKey;
}Are you sure you have the dll installed as it seems windows can't find it? If it's on your system, try using an absolute path.
Dave
Binging is like googling, it just feels dirtier. Please take your VB.NET out of our nice case sensitive forum. Astonish us. Be exceptional. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) -
I am pleasure to see your answer. Thank you! But I have still a problem. As the code you show, the struct LINEINITIALIZEEXPARAMS has two elements: hEvent and hCompletionPort. But in C++, this struct has a union. The element in it have the same name as your code. I know the keyword "union" isn't exist in C#. But I think this struct shouldn't be declare as this. Additional, I can't still execute this program. The error is still "No entry point found for lineInitializeEx". I hope you can help me again. Thx!
There is some white cloud floating on the blue sky. That's the landscape I like.
According to P/Invoke.net, lineInitializeEx is in
coredll.dll
NOT cellcore.dllDave
Binging is like googling, it just feels dirtier. Please take your VB.NET out of our nice case sensitive forum. Astonish us. Be exceptional. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) -
According to P/Invoke.net, lineInitializeEx is in
coredll.dll
NOT cellcore.dllDave
Binging is like googling, it just feels dirtier. Please take your VB.NET out of our nice case sensitive forum. Astonish us. Be exceptional. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Yes, you are right. I had success to execute it now. Thank you very much! :laugh:
There is some white cloud floating on the blue sky. That's the landscape I like.
-
You are correct about the struct - I missed the union :doh:
[StructLayout(LayoutKind.Explict)]
private struct LINEINITIALIZEEXPARAMS
{
[FieldOffset(0)]
public uint dwTotalSize;
[FieldOffset(4)]
public uint dwNeededSize;
[FieldOffset(8)]
public uint dwUsedSize;
[FieldOffset(12)]
public IntPtr hEvent;
public IntPtr hCompletionPort;
[FieldOffset(12)]
public uint dwCompletionKey;
}Are you sure you have the dll installed as it seems windows can't find it? If it's on your system, try using an absolute path.
Dave
Binging is like googling, it just feels dirtier. Please take your VB.NET out of our nice case sensitive forum. Astonish us. Be exceptional. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Excellent thread, except:
DaveyM69 wrote:
[FieldOffset(12)] public uint dwCompletionKey;
IMO it is either 16 (Win32) or 20 (Win64). :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
-
Excellent thread, except:
DaveyM69 wrote:
[FieldOffset(12)] public uint dwCompletionKey;
IMO it is either 16 (Win32) or 20 (Win64). :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
I'm never 100% sure about unions not being a C guy. I believe that at byte 12 will be either
hEvent
ORdwCompletionKey
. The way I understand it is that if the handles aren't used then thesize
of the struct will be 16 bytes, if the handles aren't are used, then thesize
will be 20 bytes if Win32 or 28 if Win64. The location ofdwCompletionKey
/hEvent
will always be 12 and only the size of the struct will be different. Please correct me if I'm wrong!Dave
Binging is like googling, it just feels dirtier. Please take your VB.NET out of our nice case sensitive forum. Astonish us. Be exceptional. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) -
I'm never 100% sure about unions not being a C guy. I believe that at byte 12 will be either
hEvent
ORdwCompletionKey
. The way I understand it is that if the handles aren't used then thesize
of the struct will be 16 bytes, if the handles aren't are used, then thesize
will be 20 bytes if Win32 or 28 if Win64. The location ofdwCompletionKey
/hEvent
will always be 12 and only the size of the struct will be different. Please correct me if I'm wrong!Dave
Binging is like googling, it just feels dirtier. Please take your VB.NET out of our nice case sensitive forum. Astonish us. Be exceptional. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Hi Dave, This is the original definition from MSDN:
typedef struct lineinitializeexparams_tag {
DWORD dwTotalSize;
DWORD dwNeededSize;
DWORD dwUsedSize;
DWORD dwOptions;
union {
HANDLE hEvent;
HANDLE hCompletionPort;
} Handles;
DWORD dwCompletionKey;
} LINEINITIALIZEEXPARAMS, *LPLINEINITIALIZEEXPARAMS;in C/C++ every struct member that is not inside a union block will be layed out sequentially; and everything inside a union block will share the same memory (and needs the size of the largest item), so here hEvent and hCompletionPort are overlapping, however dwCompletionKey (not being part of the union) must be at the next suitable address following the union, hence at start of union item plus 4 ot 8 depending on pointer sizes. BTW: there seems to be a dwOptions member too, which hasn't been mentioned before! :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
-
Hi Dave, This is the original definition from MSDN:
typedef struct lineinitializeexparams_tag {
DWORD dwTotalSize;
DWORD dwNeededSize;
DWORD dwUsedSize;
DWORD dwOptions;
union {
HANDLE hEvent;
HANDLE hCompletionPort;
} Handles;
DWORD dwCompletionKey;
} LINEINITIALIZEEXPARAMS, *LPLINEINITIALIZEEXPARAMS;in C/C++ every struct member that is not inside a union block will be layed out sequentially; and everything inside a union block will share the same memory (and needs the size of the largest item), so here hEvent and hCompletionPort are overlapping, however dwCompletionKey (not being part of the union) must be at the next suitable address following the union, hence at start of union item plus 4 ot 8 depending on pointer sizes. BTW: there seems to be a dwOptions member too, which hasn't been mentioned before! :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
Hmm... intersting. The only time I've written code requiring it was for MMTIME[^] which I have like this :confused:
/* http://msdn.microsoft.com/en-us/library/dd757347(v=VS.85).aspx
typedef struct mmtime_tag {
UINT wType;
union {
DWORD ms;
DWORD sample;
DWORD cb;
DWORD ticks;
struct {
BYTE hour;
BYTE min;
BYTE sec;
BYTE frame;
BYTE fps;
BYTE dummy;
BYTE pad[2];
} smpte;
struct {
DWORD songptrpos;
} midi;
} u;
} MMTIME, *PMMTIME, *LPMMTIME; */
/// <summary>
/// Contains timing information for different types of multimedia data.
/// </summary>
[StructLayout(LayoutKind.Explicit)]
internal struct MMTIME
{
/// <summary>
/// Time format.
/// </summary>
[FieldOffset(0)]
public uint wType;
/// <summary>
/// Number of milliseconds.
/// Used when wType is TIME_MS.
/// </summary>
[FieldOffset(4)]
public uint ms;
/// <summary>
/// Number of samples.
/// Used when wType is TIME_SAMPLES.
/// </summary>
[FieldOffset(4)]
public uint sample;
/// <summary>
/// Byte count.
/// Used when wType is TIME_BYTES.
/// </summary>
[FieldOffset(4)]
public uint cb;
/// <summary>
/// Ticks in MIDI stream.
/// Used when wType is TIME_TICKS.
/// </summary>
[FieldOffset(4)]
public uint ticks;
/// <summary>
/// Hours.
/// Used when wType is TIME_SMPTE.
/// </summary>
[FieldOffset(4)]
public byte hour;
/// <summary>
/// Minutes.
/// Used when wType is TIME_SMPTE.
/// </summary>
[FieldOffset(5)]
public byte min;
/// <summary>
/// Seconds.
/// Used when wType is TIME_SMPTE.
/// </summar -
Hmm... intersting. The only time I've written code requiring it was for MMTIME[^] which I have like this :confused:
/* http://msdn.microsoft.com/en-us/library/dd757347(v=VS.85).aspx
typedef struct mmtime_tag {
UINT wType;
union {
DWORD ms;
DWORD sample;
DWORD cb;
DWORD ticks;
struct {
BYTE hour;
BYTE min;
BYTE sec;
BYTE frame;
BYTE fps;
BYTE dummy;
BYTE pad[2];
} smpte;
struct {
DWORD songptrpos;
} midi;
} u;
} MMTIME, *PMMTIME, *LPMMTIME; */
/// <summary>
/// Contains timing information for different types of multimedia data.
/// </summary>
[StructLayout(LayoutKind.Explicit)]
internal struct MMTIME
{
/// <summary>
/// Time format.
/// </summary>
[FieldOffset(0)]
public uint wType;
/// <summary>
/// Number of milliseconds.
/// Used when wType is TIME_MS.
/// </summary>
[FieldOffset(4)]
public uint ms;
/// <summary>
/// Number of samples.
/// Used when wType is TIME_SAMPLES.
/// </summary>
[FieldOffset(4)]
public uint sample;
/// <summary>
/// Byte count.
/// Used when wType is TIME_BYTES.
/// </summary>
[FieldOffset(4)]
public uint cb;
/// <summary>
/// Ticks in MIDI stream.
/// Used when wType is TIME_TICKS.
/// </summary>
[FieldOffset(4)]
public uint ticks;
/// <summary>
/// Hours.
/// Used when wType is TIME_SMPTE.
/// </summary>
[FieldOffset(4)]
public byte hour;
/// <summary>
/// Minutes.
/// Used when wType is TIME_SMPTE.
/// </summary>
[FieldOffset(5)]
public byte min;
/// <summary>
/// Seconds.
/// Used when wType is TIME_SMPTE.
/// </summarThat looks OK; there is one union, all its members are starting at the same offset (4), and nothing is following the union (both inner structs are inside the union, the union is the last member of the outer struct). :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
-
That looks OK; there is one union, all its members are starting at the same offset (4), and nothing is following the union (both inner structs are inside the union, the union is the last member of the outer struct). :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
:thumbsup:
Dave
Binging is like googling, it just feels dirtier. Please take your VB.NET out of our nice case sensitive forum. Astonish us. Be exceptional. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) -
I am pleasure to see your answer. Thank you! But I have still a problem. As the code you show, the struct LINEINITIALIZEEXPARAMS has two elements: hEvent and hCompletionPort. But in C++, this struct has a union. The element in it have the same name as your code. I know the keyword "union" isn't exist in C#. But I think this struct shouldn't be declare as this. Additional, I can't still execute this program. The error is still "No entry point found for lineInitializeEx". I hope you can help me again. Thx!
There is some white cloud floating on the blue sky. That's the landscape I like.
Following the discussion I had with Luc, I've done some investigation into the way uinions work, and he is correct, the parameters inside the union block start at the same place in memory - in otherwords, the struct will contain one of the handles but not both so the best way to declare it is:
[StructLayout(LayoutKind.Sequential)]
private struct LINEINITIALIZEEXPARAMS
{
public uint dwTotalSize;
public uint dwNeededSize;
public uint dwUsedSize;
public uint dwOptions;
public IntPtr handle; // Will be either hEvent OR hCompletionPort
public uint dwCompletionKey;
}Dave
Binging is like googling, it just feels dirtier. Please take your VB.NET out of our nice case sensitive forum. Astonish us. Be exceptional. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) -
Following the discussion I had with Luc, I've done some investigation into the way uinions work, and he is correct, the parameters inside the union block start at the same place in memory - in otherwords, the struct will contain one of the handles but not both so the best way to declare it is:
[StructLayout(LayoutKind.Sequential)]
private struct LINEINITIALIZEEXPARAMS
{
public uint dwTotalSize;
public uint dwNeededSize;
public uint dwUsedSize;
public uint dwOptions;
public IntPtr handle; // Will be either hEvent OR hCompletionPort
public uint dwCompletionKey;
}Dave
Binging is like googling, it just feels dirtier. Please take your VB.NET out of our nice case sensitive forum. Astonish us. Be exceptional. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)I'm glad to see your answer. But now I meet a new problem, that I can't get HINSTANCE. I had find some ways in MSDN. But no available way I found. Could you be kind to help me again? Thank you! :)
There is some white cloud floating on the blue sky. That's the landscape I like.
modified on Monday, September 13, 2010 2:03 AM
-
I'm glad to see your answer. But now I meet a new problem, that I can't get HINSTANCE. I had find some ways in MSDN. But no available way I found. Could you be kind to help me again? Thank you! :)
There is some white cloud floating on the blue sky. That's the landscape I like.
modified on Monday, September 13, 2010 2:03 AM
MSDN says: "Instance handle of the client application or DLL. The application or DLL can pass NULL for this parameter, in which case TAPI uses the module handle of the root executable of the process (for purposes of identifying call handoff targets and media mode priorities). The clue is "can pass NULL", which in the case of PInvoke handles is
IntPtr.Zero
. That should work. If not, have a look at the Process.Handle[^] property - perhaps this will work?IntPtr hInstance = System.Diagnostics.Process.GetCurrentProcess().Handle;
and pass hInstance as the parameter..., I prefer
IntPtr.Zero
though!Dave
Binging is like googling, it just feels dirtier. Please take your VB.NET out of our nice case sensitive forum. Astonish us. Be exceptional. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) -
MSDN says: "Instance handle of the client application or DLL. The application or DLL can pass NULL for this parameter, in which case TAPI uses the module handle of the root executable of the process (for purposes of identifying call handoff targets and media mode priorities). The clue is "can pass NULL", which in the case of PInvoke handles is
IntPtr.Zero
. That should work. If not, have a look at the Process.Handle[^] property - perhaps this will work?IntPtr hInstance = System.Diagnostics.Process.GetCurrentProcess().Handle;
and pass hInstance as the parameter..., I prefer
IntPtr.Zero
though!Dave
Binging is like googling, it just feels dirtier. Please take your VB.NET out of our nice case sensitive forum. Astonish us. Be exceptional. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)I had tested the code above. I feel sorry that it can't work. Because I am developing application for Windows Mobile. The property
System.Diagnostics.Process.GetCurrentProcess().Handle
can't be get in Mobile. I had try to give hInstance with the value ofnew IntPtr(GetModuleHandle(new IntPtr(0)).ToInt32())
. But when I call lineInitializeEx with it, the return value is an error code. That tell me the value of handle is invalid(0x80000035). Base of all, I think I can't call lineInitializeEx with C# at all. Isn't it?There is some white cloud floating on the blue sky. That's the landscape I like.
-
I had tested the code above. I feel sorry that it can't work. Because I am developing application for Windows Mobile. The property
System.Diagnostics.Process.GetCurrentProcess().Handle
can't be get in Mobile. I had try to give hInstance with the value ofnew IntPtr(GetModuleHandle(new IntPtr(0)).ToInt32())
. But when I call lineInitializeEx with it, the return value is an error code. That tell me the value of handle is invalid(0x80000035). Base of all, I think I can't call lineInitializeEx with C# at all. Isn't it?There is some white cloud floating on the blue sky. That's the landscape I like.
Have you tried with
IntPtr.Zero
ornew IntPtr(0)
What is the error code? It should be one of these:/// <summary> /// No error. /// </summary> public const uint LINEERR\_NOERROR = 0x00000000; /// <summary> /// Invalid application name. /// </summary> public const uint LINEERR\_INVALAPPNAME = 0x80000015; /// <summary> /// The INI file is corrupted. /// </summary> public const uint LINEERR\_INIFILECORRUPT = 0x8000000E; /// <summary> /// Invalid parameter. /// </summary> public const uint LINEERR\_INVALPARAM = 0x80000032; /// <summary> /// Invalid pointer. /// </summary> public const uint LINEERR\_INVALPOINTER = 0x80000035; /// <summary> /// No memory available. /// </summary> public const uint LINEERR\_NOMEM = 0x80000044; /// <summary> /// The operation failed. /// </summary> public const uint LINEERR\_OPERATIONFAILED = 0x80000048; /// <summary> /// The application attempted to initialize TAPI twice. /// </summary> public const uint LINEERR\_REINIT = 0x80000052;
If the version of WinMob you're targetting supports TAPI then it will work once you get it just right! Maybe post your
lineInitializeEx
andLINEINITIALIZEEXPARAMS
...Dave
Binging is like googling, it just feels dirtier. Please take your VB.NET out of our nice case sensitive forum. Astonish us. Be exceptional. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) -
Have you tried with
IntPtr.Zero
ornew IntPtr(0)
What is the error code? It should be one of these:/// <summary> /// No error. /// </summary> public const uint LINEERR\_NOERROR = 0x00000000; /// <summary> /// Invalid application name. /// </summary> public const uint LINEERR\_INVALAPPNAME = 0x80000015; /// <summary> /// The INI file is corrupted. /// </summary> public const uint LINEERR\_INIFILECORRUPT = 0x8000000E; /// <summary> /// Invalid parameter. /// </summary> public const uint LINEERR\_INVALPARAM = 0x80000032; /// <summary> /// Invalid pointer. /// </summary> public const uint LINEERR\_INVALPOINTER = 0x80000035; /// <summary> /// No memory available. /// </summary> public const uint LINEERR\_NOMEM = 0x80000044; /// <summary> /// The operation failed. /// </summary> public const uint LINEERR\_OPERATIONFAILED = 0x80000048; /// <summary> /// The application attempted to initialize TAPI twice. /// </summary> public const uint LINEERR\_REINIT = 0x80000052;
If the version of WinMob you're targetting supports TAPI then it will work once you get it just right! Maybe post your
lineInitializeEx
andLINEINITIALIZEEXPARAMS
...Dave
Binging is like googling, it just feels dirtier. Please take your VB.NET out of our nice case sensitive forum. Astonish us. Be exceptional. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)I had try to use the value of
IntPtr.Zero
andnew IntPtr(0)
before. The return value is error too. In all cases, the error code returned is stillpublic const uint LINEERR_INVALPOINTER = 0x80000035;
. I am sure my Window Mobile support TAPI. I had developed a TAPI application with C++. Thank you!There is some white cloud floating on the blue sky. That's the landscape I like.
-
I had try to use the value of
IntPtr.Zero
andnew IntPtr(0)
before. The return value is error too. In all cases, the error code returned is stillpublic const uint LINEERR_INVALPOINTER = 0x80000035;
. I am sure my Window Mobile support TAPI. I had developed a TAPI application with C++. Thank you!There is some white cloud floating on the blue sky. That's the landscape I like.
Can you post your function and struct declarations?
Dave
Binging is like googling, it just feels dirtier. Please take your VB.NET out of our nice case sensitive forum. Astonish us. Be exceptional. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)