Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Kako u C#-u pozvati funkciju iz Win32 DLL-a

[es] :: .NET :: Kako u C#-u pozvati funkciju iz Win32 DLL-a

[ Pregleda: 1252 | Odgovora: 0 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

djuka233
Beograd

Član broj: 29259
Poruke: 7
*.dynamic.isp.telekom.rs.



Profil

icon Kako u C#-u pozvati funkciju iz Win32 DLL-a28.05.2010. u 13:47 - pre 169 meseci
DLL je napravljen u Delphi-u, i kao parametre u funkciji koristi Custom Delphi type-ove.

Definicija funkcije:
Code:

function GetAttrbControls(    Code     : PChar;
                              InputList: TItemList;
                              var Values   : TValArray): Boolean; stdcall; export;


Definicija tipova:
Code:

type
  TItem = packed record
    Code : PChar;
    ItemValue: Variant;
  end;

TItemList = array of TItem;

TValArray = array of PChar;



Trebalo bi da je nekako ovako, ali nešto je pogrešno:
Code:

[StructLayout(LayoutKind.Sequential)]
 public class Input
 {
     public string Code;
     public object ItemValue;
 };


[DllImport("Filename.dll", EntryPoint = "GetValues", CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
    public static extern bool GetValues(string Code, Input[] InputList, ref StringBuilder[] Values);
 
Odgovor na temu

[es] :: .NET :: Kako u C#-u pozvati funkciju iz Win32 DLL-a

[ Pregleda: 1252 | Odgovora: 0 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.