Click here to Skip to main content
15,887,214 members
Home / Discussions / C#
   

C#

 
GeneralRe: is C# in .Net 3.5 slower than C# in .Net 1.1 Pin
Luc Pattyn10-Sep-10 5:53
sitebuilderLuc Pattyn10-Sep-10 5:53 
GeneralRe: is C# in .Net 3.5 slower than C# in .Net 1.1 Pin
RugbyLeague10-Sep-10 5:55
RugbyLeague10-Sep-10 5:55 
GeneralRe: is C# in .Net 3.5 slower than C# in .Net 1.1 Pin
Luc Pattyn10-Sep-10 6:02
sitebuilderLuc Pattyn10-Sep-10 6:02 
Questionchar[] to string conversion Pin
Chesnokov Yuriy10-Sep-10 1:57
professionalChesnokov Yuriy10-Sep-10 1:57 
AnswerRe: char[] to string conversion Pin
Kubajzz10-Sep-10 2:04
Kubajzz10-Sep-10 2:04 
AnswerRe: char[] to string conversion Pin
OriginalGriff10-Sep-10 2:31
mveOriginalGriff10-Sep-10 2:31 
QuestionHow to call the function in cellcore.dll? Pin
whiteclouds9-Sep-10 22:52
whiteclouds9-Sep-10 22:52 
AnswerRe: How to call the function in cellcore.dll? Pin
DaveyM699-Sep-10 23:42
professionalDaveyM699-Sep-10 23:42 
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 use SetLastError so you can get the last error from the system when thing go bang!
C#
        /* 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, 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)



GeneralRe: How to call the function in cellcore.dll? Pin
whiteclouds10-Sep-10 0:09
whiteclouds10-Sep-10 0:09 
GeneralRe: How to call the function in cellcore.dll? Pin
DaveyM6910-Sep-10 0:20
professionalDaveyM6910-Sep-10 0:20 
GeneralRe: How to call the function in cellcore.dll? Pin
Luc Pattyn10-Sep-10 1:26
sitebuilderLuc Pattyn10-Sep-10 1:26 
GeneralRe: How to call the function in cellcore.dll? Pin
DaveyM6910-Sep-10 1:41
professionalDaveyM6910-Sep-10 1:41 
GeneralRe: How to call the function in cellcore.dll? Pin
Luc Pattyn10-Sep-10 1:59
sitebuilderLuc Pattyn10-Sep-10 1:59 
GeneralRe: How to call the function in cellcore.dll? Pin
DaveyM6910-Sep-10 2:09
professionalDaveyM6910-Sep-10 2:09 
GeneralRe: How to call the function in cellcore.dll? Pin
Luc Pattyn10-Sep-10 2:17
sitebuilderLuc Pattyn10-Sep-10 2:17 
GeneralRe: How to call the function in cellcore.dll? Pin
DaveyM6910-Sep-10 2:19
professionalDaveyM6910-Sep-10 2:19 
GeneralRe: How to call the function in cellcore.dll? Pin
DaveyM6910-Sep-10 0:28
professionalDaveyM6910-Sep-10 0:28 
GeneralRe: How to call the function in cellcore.dll? Pin
whiteclouds10-Sep-10 0:33
whiteclouds10-Sep-10 0:33 
GeneralRe: How to call the function in cellcore.dll? Pin
DaveyM6911-Sep-10 22:25
professionalDaveyM6911-Sep-10 22:25 
GeneralRe: How to call the function in cellcore.dll? [modified] Pin
whiteclouds12-Sep-10 17:45
whiteclouds12-Sep-10 17:45 
GeneralRe: How to call the function in cellcore.dll? Pin
DaveyM6913-Sep-10 12:52
professionalDaveyM6913-Sep-10 12:52 
GeneralRe: How to call the function in cellcore.dll? Pin
whiteclouds13-Sep-10 15:33
whiteclouds13-Sep-10 15:33 
GeneralRe: How to call the function in cellcore.dll? Pin
DaveyM6914-Sep-10 8:25
professionalDaveyM6914-Sep-10 8:25 
GeneralRe: How to call the function in cellcore.dll? Pin
whiteclouds14-Sep-10 17:00
whiteclouds14-Sep-10 17:00 
GeneralRe: How to call the function in cellcore.dll? Pin
DaveyM6914-Sep-10 21:41
professionalDaveyM6914-Sep-10 21:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.