Click here to Skip to main content
15,885,546 members
Home / Discussions / C#
   

C#

 
GeneralUsing SHFILEINFO to retrieve Special Folder Icons Pin
Drakkhen31-Jan-05 13:20
Drakkhen31-Jan-05 13:20 
GeneralRe: Using SHFILEINFO to retrieve Special Folder Icons Pin
Heath Stewart31-Jan-05 13:48
protectorHeath Stewart31-Jan-05 13:48 
Generalevent invocation Pin
cchere31-Jan-05 12:59
cchere31-Jan-05 12:59 
GeneralRe: event invocation Pin
Heath Stewart31-Jan-05 13:28
protectorHeath Stewart31-Jan-05 13:28 
GeneralRe: event invocation Pin
cchere31-Jan-05 18:05
cchere31-Jan-05 18:05 
GeneralRe: event invocation Pin
Heath Stewart1-Feb-05 6:10
protectorHeath Stewart1-Feb-05 6:10 
GeneralRe: event invocation Pin
cchere4-Feb-05 4:34
cchere4-Feb-05 4:34 
Generalcalling C++ dll function in C# Pin
isamir31-Jan-05 12:25
isamir31-Jan-05 12:25 
Hi,

I am trying to calling Visual C++ dll function in C#.

This is function I am trying to call from dll.

float CMD_RD(int port, int address, int *err_type, int *err_attr)

Here is my code.

public class OmegaBusWrap
{
[DllImport("C:\\work\\Eco-now\\Code\\OmegaBus\\OmegaLib\\cmd_dll.DLL",
EntryPoint="CMD_RD", SetLastError=true,
CharSet=CharSet.Auto, ExactSpelling=true,
CallingConvention=CallingConvention.StdCall)]
public static extern float CMD_RD(int port, int ddress,IntPtr
err_type, IntPtr err_attr);
}

Here I am calling this function in my code

IntPtr err_type = new IntPtr(0);
IntPtr err_att = new IntPtr(0);

float fvalue;

try
{
fvalue = OmegaBusWrap.CMD_RD(m_PortNo,1,err_type,err_att);
}
catch(Exception e)
{
Debug.WriteLine(e.ToString());
}


I got exception this exception

System.NullReferenceException: Object reference not set to an instance of an object.
at OmegaBusSerial.OmegaBusWrap.CMD_RD(Int32 port, Int32 address, IntPtr err_type, IntPtr err_attr)

What I am doing wrong, How can I solve this problem.

Thanks.
GeneralRe: calling C++ dll function in C# Pin
Heath Stewart31-Jan-05 13:14
protectorHeath Stewart31-Jan-05 13:14 
GeneralRotate Flip Image isn't working Pin
adonisv31-Jan-05 12:17
adonisv31-Jan-05 12:17 
GeneralRe: Rotate Flip Image isn't working Pin
Charlie Williams31-Jan-05 12:32
Charlie Williams31-Jan-05 12:32 
GeneralAhhhhhh Sank you sahh! Pin
adonisv31-Jan-05 16:11
adonisv31-Jan-05 16:11 
GeneralProgram crashes.... Pin
Christian Graus31-Jan-05 12:13
protectorChristian Graus31-Jan-05 12:13 
GeneralRe: Program crashes.... Pin
Heath Stewart31-Jan-05 13:19
protectorHeath Stewart31-Jan-05 13:19 
GeneralRe: Program crashes.... Pin
Christian Graus31-Jan-05 13:27
protectorChristian Graus31-Jan-05 13:27 
GeneralRe: Program crashes.... Pin
Heath Stewart31-Jan-05 13:36
protectorHeath Stewart31-Jan-05 13:36 
GeneralRe: Program crashes.... Pin
Christian Graus31-Jan-05 13:50
protectorChristian Graus31-Jan-05 13:50 
GeneralRe: Program crashes.... Pin
Heath Stewart31-Jan-05 13:56
protectorHeath Stewart31-Jan-05 13:56 
GeneralRe: Program crashes.... Pin
Christian Graus31-Jan-05 14:03
protectorChristian Graus31-Jan-05 14:03 
GeneralRe: Program crashes.... Pin
Heath Stewart1-Feb-05 6:20
protectorHeath Stewart1-Feb-05 6:20 
GeneralRe: Program crashes.... Pin
Christian Graus1-Feb-05 9:05
protectorChristian Graus1-Feb-05 9:05 
GeneralCompare a mask to a filename or path Pin
Guinness4Strength31-Jan-05 12:01
Guinness4Strength31-Jan-05 12:01 
GeneralRe: Compare a mask to a filename or path Pin
Christian Graus31-Jan-05 12:15
protectorChristian Graus31-Jan-05 12:15 
GeneralIs there something better than this... Pin
Member 9631-Jan-05 10:40
Member 9631-Jan-05 10:40 
GeneralRe: Is there something better than this... Pin
Christian Graus31-Jan-05 11:24
protectorChristian Graus31-Jan-05 11:24 

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.