Click here to Skip to main content
15,888,968 members
Home / Discussions / C#
   

C#

 
AnswerRe: how to restart application after updating version Pin
N a v a n e e t h4-Jul-08 2:10
N a v a n e e t h4-Jul-08 2:10 
GeneralRe: how to restart application after updating version Pin
asma_panjabi4-Jul-08 2:13
asma_panjabi4-Jul-08 2:13 
GeneralRe: how to restart application after updating version Pin
leppie4-Jul-08 4:33
leppie4-Jul-08 4:33 
GeneralRe: how to restart application after updating version Pin
N a v a n e e t h4-Jul-08 17:49
N a v a n e e t h4-Jul-08 17:49 
GeneralRe: how to restart application after updating version Pin
leppie4-Jul-08 18:19
leppie4-Jul-08 18:19 
GeneralRe: how to restart application after updating version Pin
N a v a n e e t h4-Jul-08 18:32
N a v a n e e t h4-Jul-08 18:32 
GeneralRe: how to restart application after updating version Pin
asma_panjabi6-Jul-08 19:55
asma_panjabi6-Jul-08 19:55 
QuestionProblem With Structure Access Pin
cristi_alonso4-Jul-08 1:24
cristi_alonso4-Jul-08 1:24 
<pre> I am trying to access a C DLL from C# .The problem i am facing when i pass a structure to the C dll function .I am passing the structure by out Keyword.here is the code

--------------------------------------------------OneStruct .dll----------------------------------------------------------------


#include<iostream.h>
#include<conio.h>
#include<malloc.h>
#include<string.h>

extern "C"
{


typedef struct
{
unsigned long * var1;
float * var2;
}Esp;


typedef struct
{
char * var3;
char * var4;

}Real;


__declspec(dllexport) void GetValue(Esp * villa,Real * rud) //when function gets called i added the watch on villa and it shows me that CXX0017:Error:Symbol 'villa' not found
{

rud->var3 = (char*)malloc(50);
memset(rud->var3, 0x00, 50);

rud->var4= (char*)malloc(50);
memset(rud->var4, 0x00, 50);

strcpy(rud->var3, "robhino");
strcpy(rud->var4,"zidane");





unsigned long a=9999;
villa->var1=&a;

float b=15.6f;
villa->var2=&b;







}
}



--------------------------------------------------------------------------------------------------------------------------------


----------------------------------HandleOneStruct----------------------------------------------------------------------


using System;

using System.Collections.Generic;

using System.Text;

using System.Runtime.InteropServices;

namespace HandleOneStruct

{

[StructLayout(LayoutKind.Sequential)]

public struct Esp

{

public IntPtr var1;

public IntPtr var2;



}

[StructLayout(LayoutKind.Sequential)]

public struct Real

{

public string var3;

public string var4;




}

class LibWrap

{

[DllImport("OneStruct.dll")]

public static extern void GetValue(out Esp villa,out Real rud);

}

class Program

{

static void Main(string[] args)

{

Esp villa;

Real rud;


//villa.var1=Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof (Esp)));

//villa.var2 =Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(Esp)));

//villa.var1 = new IntPtr(11);

//villa.var2 = new IntPtr(19);

LibWrap.GetValue(out villa,out rud);

Console.WriteLine(rud.var3);

Console.WriteLine(rud.var4);

Console.Read();






}

}

}
---------------------------------------------------------------------------------

When i debugg this code i am getting value of rud structre variable as robhino zidane correctly but the value of villa structre varibale are 12345,12346(some address i guess).where as i want the value villa->var1=9999 and villa->var2=15.6f.i really don't know how to get the values of var1=9999 and var2=15.6f .can anyone guide me how to get the desired result.what i need to do to run this code successfully .Is there any other way to run this code please tell me.
Give me usefull link for this topic if possible ?One more thing if i want to intialize IntPtr varible with long value or long * then how can i do this?


Any help Appreciated.
Thanks in Advance. Smile | :)
</pre>
AnswerRe: Problem With Structure Access Pin
leppie4-Jul-08 2:05
leppie4-Jul-08 2:05 
QuestionWinDbg and C# application Pin
George_George4-Jul-08 0:46
George_George4-Jul-08 0:46 
AnswerRe: WinDbg and C# application Pin
Christian Graus4-Jul-08 1:02
protectorChristian Graus4-Jul-08 1:02 
GeneralRe: WinDbg and C# application Pin
George_George4-Jul-08 1:04
George_George4-Jul-08 1:04 
GeneralRe: WinDbg and C# application Pin
Simon P Stevens4-Jul-08 1:15
Simon P Stevens4-Jul-08 1:15 
GeneralRe: WinDbg and C# application Pin
George_George4-Jul-08 1:21
George_George4-Jul-08 1:21 
GeneralRe: WinDbg and C# application Pin
Simon P Stevens4-Jul-08 3:12
Simon P Stevens4-Jul-08 3:12 
GeneralRe: WinDbg and C# application Pin
George_George6-Jul-08 2:18
George_George6-Jul-08 2:18 
GeneralRe: WinDbg and C# application Pin
Simon P Stevens8-Jul-08 2:45
Simon P Stevens8-Jul-08 2:45 
GeneralRe: WinDbg and C# application Pin
George_George8-Jul-08 15:54
George_George8-Jul-08 15:54 
QuestionDataGridView, CheckBoxes and ThreeState Pin
Steven Kirk4-Jul-08 0:43
Steven Kirk4-Jul-08 0:43 
QuestionUnique Problem, Connecting to web service using credentials fail for 1 user only, works for all. Pin
Rizwan Bashir4-Jul-08 0:21
Rizwan Bashir4-Jul-08 0:21 
AnswerRe: Unique Problem, Connecting to web service using credentials fail for 1 user only, works for all. Pin
leppie4-Jul-08 0:31
leppie4-Jul-08 0:31 
GeneralRe: Unique Problem, Connecting to web service using credentials fail for 1 user only, works for all. Pin
Rizwan Bashir4-Jul-08 1:07
Rizwan Bashir4-Jul-08 1:07 
GeneralRe: Unique Problem, Connecting to web service using credentials fail for 1 user only, works for all. Pin
leppie4-Jul-08 2:07
leppie4-Jul-08 2:07 
GeneralRe: Unique Problem, Connecting to web service using credentials fail for 1 user only, works for all. Pin
Rizwan Bashir4-Jul-08 2:17
Rizwan Bashir4-Jul-08 2:17 
GeneralRe: Unique Problem, Connecting to web service using credentials fail for 1 user only, works for all. Pin
Rizwan Bashir4-Jul-08 4:24
Rizwan Bashir4-Jul-08 4: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.