Click here to Skip to main content
15,921,351 members
Home / Discussions / C#
   

C#

 
GeneralRe: A question of a Game Pin
Christian Graus1-Apr-04 15:53
protectorChristian Graus1-Apr-04 15:53 
GeneralRe: A question of a Game Pin
CWIZO2-Apr-04 2:42
CWIZO2-Apr-04 2:42 
GeneralRe: A question of a Game Pin
lajiyo2-Apr-04 23:01
lajiyo2-Apr-04 23:01 
GeneraldataSet, combobox Pin
DougW481-Apr-04 14:53
DougW481-Apr-04 14:53 
GeneralRe: dataSet, combobox Pin
Anonymous1-Apr-04 16:47
Anonymous1-Apr-04 16:47 
GeneralC# Whidbey Language Changes Pin
Eric Gunnerson (msft)1-Apr-04 13:57
Eric Gunnerson (msft)1-Apr-04 13:57 
GeneralRe: C# Whidbey Language Changes Pin
CWIZO2-Apr-04 2:46
CWIZO2-Apr-04 2:46 
Generalstruct conversion(VB->C#) problem Pin
Member 6548331-Apr-04 13:21
Member 6548331-Apr-04 13:21 
hello, all.
I am trying to convert a struct from VB to c# in order to use an old DLL. Here is the definition in VB

Public Type CHost
Host As String * 60
Port As String * 5
Info As String * 120 'Inof returned from host
Timeout As String * 10
End Type

In the sample VB code:
Public Declare Function CConnect Lib "OLDDLL.DLL" (Host As CHost) As Integer
iError = CConnect(TheHost)

and then the CHost.Info was set by the remote host.



I converted it to(C#)

public struct CHost
{

[System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr,SizeConst=60)]
public string Host; //host name

[System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr,SizeConst=5)]
public string Port; //host port

[System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr,SizeConst=120)]
public string Info; //Info returned from remote host

[System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr,SizeConst=5)]
public string Timeout; //timeout
};

in my c# code.
[DllImport("OLDDLL",EntryPoint="CConnect")]
public static extern short CConnect(ref CHost Host);

short ierror = CConnect(ref theHost);

I can connect to the remote host but the theHost.Info was not set.

Could anybody let me know what I was doing wrong and what is the right way to do it?


GeneralC# . Question on "Microsoft Data Access Application Block" Pin
abidkayani11-Apr-04 12:30
abidkayani11-Apr-04 12:30 
GeneralC# problem .. SQLParameters Pin
abidkayani11-Apr-04 12:25
abidkayani11-Apr-04 12:25 
GeneralRe: C# problem .. SQLParameters Pin
Charlie Williams1-Apr-04 13:25
Charlie Williams1-Apr-04 13:25 
GeneralChild windows opening outside the screen! Pin
Carl Mercier1-Apr-04 12:04
Carl Mercier1-Apr-04 12:04 
GeneralRe: Child windows opening outside the screen! Pin
Dave Kreskowiak1-Apr-04 13:10
mveDave Kreskowiak1-Apr-04 13:10 
GeneralRe: Child windows opening outside the screen! Pin
Carl Mercier1-Apr-04 17:03
Carl Mercier1-Apr-04 17:03 
GeneralRe: Child windows opening outside the screen! Pin
Dave Kreskowiak2-Apr-04 4:56
mveDave Kreskowiak2-Apr-04 4:56 
GeneralRe: Child windows opening outside the screen! Pin
Carl Mercier2-Apr-04 6:12
Carl Mercier2-Apr-04 6:12 
GeneralRe: Child windows opening outside the screen! Pin
Dave Kreskowiak2-Apr-04 6:22
mveDave Kreskowiak2-Apr-04 6:22 
GeneralRe: Child windows opening outside the screen! Pin
Carl Mercier2-Apr-04 6:35
Carl Mercier2-Apr-04 6:35 
GeneralProblem with web browser control in Windows Form Pin
Tim Kohler1-Apr-04 11:23
Tim Kohler1-Apr-04 11:23 
GeneralComboBox on a ToolBar Menu Pin
adam.southerland@oscn.net1-Apr-04 11:22
adam.southerland@oscn.net1-Apr-04 11:22 
Generalproblem with the project reference Pin
dizzyha1-Apr-04 10:35
dizzyha1-Apr-04 10:35 
GeneralRe: problem with the project reference Pin
Heath Stewart1-Apr-04 10:40
protectorHeath Stewart1-Apr-04 10:40 
GeneralCreateGraphics Problem Pin
Tristan Rhodes1-Apr-04 10:25
Tristan Rhodes1-Apr-04 10:25 
GeneralRe: CreateGraphics Problem Pin
Heath Stewart1-Apr-04 10:39
protectorHeath Stewart1-Apr-04 10:39 
GeneralRe: CreateGraphics Problem Pin
Tristan Rhodes1-Apr-04 10:50
Tristan Rhodes1-Apr-04 10:50 

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.