Click here to Skip to main content
15,886,919 members
Home / Discussions / C#
   

C#

 
GeneralRe: necessity to cast return value to nullable in lambda expression ? Pin
Richard Deeming16-Oct-14 8:49
mveRichard Deeming16-Oct-14 8:49 
AnswerRe: necessity to cast return value to nullable in lambda expression ? Pin
Pete O'Hanlon16-Oct-14 8:13
mvePete O'Hanlon16-Oct-14 8:13 
GeneralRe: necessity to cast return value to nullable in lambda expression ? Pin
BillWoodruff16-Oct-14 8:44
professionalBillWoodruff16-Oct-14 8:44 
QuestionHow to read tables in Excel Worksheet witc C# and XML Pin
Member 1110881716-Oct-14 3:13
Member 1110881716-Oct-14 3:13 
AnswerRe: How to read tables in Excel Worksheet witc C# and XML Pin
BillWoodruff16-Oct-14 5:25
professionalBillWoodruff16-Oct-14 5:25 
GeneralRe: How to read tables in Excel Worksheet witc C# and XML Pin
Member 1110881716-Oct-14 21:14
Member 1110881716-Oct-14 21:14 
AnswerRe: How to read tables in Excel Worksheet witc C# and XML Pin
Eddy Vluggen16-Oct-14 9:05
professionalEddy Vluggen16-Oct-14 9:05 
QuestionC#/C wrapper Pin
Nikolaj jensen16-Oct-14 2:39
Nikolaj jensen16-Oct-14 2:39 
I'm implementing some additional features from an already working API for a SignalHound USB Spectrum Analyzer (SA124B).

My code is C#, and i have the SH_API.dll (c or c++).

SHAPI_GetSerNum() & SHAPI_Initialize() are both working.
C#
int initResult = Dll.SHAPI_Initialize();
uint ser = Dll.SHAPI_GetSerNum(0);

However SHAPI_GetSA123CalData is not !
C#
string fileName = "";
int CalDataResult = -1;
CalDataResult = Dll.SHAPI_GetSA124CalData(fileName, 0);

No matter what i set "FileName" to i get the response "0" to CalDataResult. It seems i have some sort of connection to the method in the dll, but there is something going on with this "LPCSTR" filename parameter, that i don't understand !

Can anyone help - how do i sent a LCPSTR from C# to C/C++
-------------------------
The documentation says:
extern "C" __declspec( dllimport ) int SHAPI_GetSA124CalData(LPCSTR filename,int deviceNum=0); //Returns -1 on error

My Wrapper code -----------------------------------
C#
[DllImport("SH_API.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public static extern Int SHAPI_GetSA124CalData(string FileName, int deviceNum=0);

// extern "C" __declspec( dllimport ) int SHAPI_Initialize();
[DllImport("SH_API.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern uint SHAPI_GetSerNum(int deviceNum=0);

// extern "C" __declspec( dllimport ) int SHAPI_Initialize();
[DllImport("SH_API.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int SHAPI_Initialize();

----------------------------------------------------------
AnswerRe: C#/C wrapper Pin
Richard MacCutchan16-Oct-14 2:59
mveRichard MacCutchan16-Oct-14 2:59 
GeneralRe: C#/C wrapper Pin
Nikolaj jensen16-Oct-14 3:52
Nikolaj jensen16-Oct-14 3:52 
GeneralRe: C#/C wrapper Pin
Richard MacCutchan16-Oct-14 3:56
mveRichard MacCutchan16-Oct-14 3:56 
GeneralRe: C#/C wrapper Pin
Nikolaj jensen16-Oct-14 21:43
Nikolaj jensen16-Oct-14 21:43 
QuestionHow to convert HTML Form data into RTF File Pin
mukulsharma114616-Oct-14 1:37
mukulsharma114616-Oct-14 1:37 
AnswerRe: How to convert HTML Form data into RTF File Pin
Richard MacCutchan16-Oct-14 2:55
mveRichard MacCutchan16-Oct-14 2:55 
AnswerRe: How to convert HTML Form data into RTF File Pin
Eddy Vluggen16-Oct-14 9:07
professionalEddy Vluggen16-Oct-14 9:07 
GeneralRe: How to convert HTML Form data into RTF File Pin
mukulsharma114616-Oct-14 19:56
mukulsharma114616-Oct-14 19:56 
AnswerRe: How to convert HTML Form data into RTF File Pin
BillWoodruff16-Oct-14 10:11
professionalBillWoodruff16-Oct-14 10:11 
QuestionHow to draw small circle in rectangle c# Pin
Member 1115802716-Oct-14 0:52
Member 1115802716-Oct-14 0:52 
AnswerRe: How to draw small circle in rectangle c# Pin
Richard MacCutchan16-Oct-14 1:32
mveRichard MacCutchan16-Oct-14 1:32 
GeneralRe: How to draw small circle in rectangle c# Pin
harold aptroot16-Oct-14 1:54
harold aptroot16-Oct-14 1:54 
GeneralRe: How to draw small circle in center rectangle c# Pin
Member 1115802716-Oct-14 23:37
Member 1115802716-Oct-14 23:37 
Questionhaw to upload image in c# code? Pin
biruk-bk16-Oct-14 0:03
biruk-bk16-Oct-14 0:03 
QuestionRe: uploading image in c# Pin
Eddy Vluggen16-Oct-14 0:26
professionalEddy Vluggen16-Oct-14 0:26 
Questionabout c# command for oralce Pin
yuscq15-Oct-14 18:26
professionalyuscq15-Oct-14 18:26 
QuestionRe: about c# command for oralce Pin
Eddy Vluggen16-Oct-14 0:27
professionalEddy Vluggen16-Oct-14 0:27 

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.