Click here to Skip to main content
15,892,059 members
Home / Discussions / C#
   

C#

 
GeneralRe: Text file encoding... Pin
Luca Leonardo Scorcia4-Oct-02 9:59
professionalLuca Leonardo Scorcia4-Oct-02 9:59 
GeneralRe: Text file encoding... Pin
leppie4-Oct-02 12:36
leppie4-Oct-02 12:36 
GeneralRe: Text file encoding... Pin
Paul Riley4-Oct-02 13:18
Paul Riley4-Oct-02 13:18 
GeneralRe: Text file encoding... Pin
Luca Leonardo Scorcia5-Oct-02 7:07
professionalLuca Leonardo Scorcia5-Oct-02 7:07 
GeneralRe: Text file encoding... Pin
Paul Riley5-Oct-02 7:33
Paul Riley5-Oct-02 7:33 
GeneralAutomatically have a certain tab selected when a tree control node is selected. Pin
Derek Smigelski4-Oct-02 6:23
Derek Smigelski4-Oct-02 6:23 
GeneralMDI application lost focus when GroupBox has button control in it Pin
Zaharang3-Oct-02 20:59
Zaharang3-Oct-02 20:59 
GeneralLegacy dll interoperability problem Pin
Adam Plucinski3-Oct-02 20:20
Adam Plucinski3-Oct-02 20:20 
Hello,
I write program which uses some functions from legacy dll written in Delphi.
The problem is that Delphi have type "shortstring" which is very specific for this language and I can't marshal this type.

Pascal code:
<br />
...<br />
type<br />
  TDLLIn = record<br />
   ....<br />
    Typekey: shortstring;<br />
  end;<br />
<br />
<br />
  function Init(dllIn: TDLLIn): integer;<br />
  begin<br />
  ....<br />
  end;<br />



C# code:

<br />
public struct TDLLIn<br />
{<br />
    ....<br />
    <big>[MarshalAs(UnmanagedType.AnsiBStr)]</big><br />
    public string Typekey;<br />
}<br />
<br />
public class Wrapper<br />
{<br />
   ....<br />
    [DllImport("DelphiDLL.dll", CallingConvention=CallingConvention.StdCall, EntryPoint="Init")]<br />
    static extern int Init(TDLLIn dllIn);<br />
}<br />


I've tried marshal as AnsiBStr, as byte array (MarshalAs(UnmanagedType.ByValArray, SizeConst = 256, ArraySubType = UnmanagedType.U1)) and many others ways but still no success.

Marshaling Pascal shortstring is impossible for me.

If anyone found a way to do this please inform me.

Best regards

Adam Plucinski
GeneralRe: Legacy dll interoperability problem Pin
Stephane Rodriguez.3-Oct-02 21:40
Stephane Rodriguez.3-Oct-02 21:40 
GeneralRe: Legacy dll interoperability problem Pin
Adam Plucinski3-Oct-02 22:44
Adam Plucinski3-Oct-02 22:44 
GeneralRe: Legacy dll interoperability problem Pin
Stephane Rodriguez.3-Oct-02 23:20
Stephane Rodriguez.3-Oct-02 23:20 
GeneralRe: Legacy dll interoperability problem Pin
Adam Plucinski3-Oct-02 23:50
Adam Plucinski3-Oct-02 23:50 
GeneralRe: Legacy dll interoperability problem Pin
Stephane Rodriguez.4-Oct-02 0:01
Stephane Rodriguez.4-Oct-02 0:01 
GeneralRe: Legacy dll interoperability problem Pin
Adam Plucinski4-Oct-02 0:37
Adam Plucinski4-Oct-02 0:37 
GeneralRe: Legacy dll interoperability problem Pin
Stephane Rodriguez.4-Oct-02 0:46
Stephane Rodriguez.4-Oct-02 0:46 
QuestionArrayList Problem? Pin
Nick Parker3-Oct-02 18:19
protectorNick Parker3-Oct-02 18:19 
AnswerRe: ArrayList Problem? Pin
Stephane Rodriguez.3-Oct-02 18:40
Stephane Rodriguez.3-Oct-02 18:40 
GeneralRe: ArrayList Problem? Pin
David Stone3-Oct-02 18:50
sitebuilderDavid Stone3-Oct-02 18:50 
GeneralRe: ArrayList Problem? Pin
Nick Parker4-Oct-02 13:01
protectorNick Parker4-Oct-02 13:01 
GeneralRe: ArrayList Problem? Pin
Paul Riley4-Oct-02 13:23
Paul Riley4-Oct-02 13:23 
GeneralStill having problems with IActiveDesktop Pin
Wjousts3-Oct-02 16:38
Wjousts3-Oct-02 16:38 
GeneralRe: Still having problems with IActiveDesktop Pin
David Stone3-Oct-02 16:46
sitebuilderDavid Stone3-Oct-02 16:46 
GeneralRe: Still having problems with IActiveDesktop Pin
Wjousts4-Oct-02 1:54
Wjousts4-Oct-02 1:54 
GeneralRe: Still having problems with IActiveDesktop Pin
David Stone4-Oct-02 10:40
sitebuilderDavid Stone4-Oct-02 10:40 
GeneralRe: Still having problems with IActiveDesktop Pin
Stephane Rodriguez.3-Oct-02 18:43
Stephane Rodriguez.3-Oct-02 18:43 

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.