Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Wert über dll aus registry bekommen (https://www.delphipraxis.net/13026-wert-ueber-dll-aus-registry-bekommen.html)

Pseudemys Nelsoni 9. Dez 2003 16:31


Wert über dll aus registry bekommen
 
Moin,

ich möchte aus der registry einen string holen, da mirc das nicht kann (nur über $dll), möcht ich das über eine dll machen, aus der mirc-hilfe habe ich folgendes:

Zitat:

/dll <filename> <procname> [data]
$dll(filename, procname, data)

$dllcall(filename, alias, procname, data)


The above open a DLL, call the procname routine, and send it the specified data. The only difference is that $dll() can return a value, like all other identifiers.

$dllcall() is multi-threaded so it will not halt the script and will call the specified alias once the call returns.

Technical notes
This section contains technical information for programmers who want to create DLLs for use with mIRC.

The routine in the DLL being called must be of the form:

int __stdcall procname(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause)

mWnd is the handle to the main mIRC window.

aWnd is the handle of the window in which the command is being issued, this might not be the currently active window if the command is being called by a remote script.

data is the information that you wish to send to the DLL. On return, the DLL can fill this variable with the command it wants mIRC to perform if any.

parms is filled by the DLL on return with parameters that it wants mIRC to use when performing the command that it returns in the data variable.

Note: The data and parms variables can each hold 900 chars maximum.

verstehen tu ichs nicht ganz, wie geb ich denn das ergebnis aus meiner dll an mirc? bzw wie müssen die proceduren/functionen in der dll denn aussehen?

choose 9. Dez 2003 17:09

Re: Wert über dll aus registry bekommen
 
Zitat:

parms is filled by the DLL on return with parameters that it wants mIRC to use when performing the command that it returns in the data variable.
Offensichtlich soll das Ergebnis in einen String geschrieben werden, auf den Du eine Refezenz in Form eines Pointers (PChar) übergeben bekommst. Leider kenne ich die Schnittstelle zu mirc nicht, kann Dir deshalb nicht sagen, wie Du sicherstellen kannst, dass Du nicht zu viele Bytes in diesen Puffer schreibst (bei anderen APIs wird hier häufig ein weiterer Int mit der maximalen Länge übergeben).

Wenn ich die Doku richtig interpretiere, sollte die Signatur der Funktion wie folgt aussehen:
Delphi-Quellcode:
function ProcName(MWnd, AWnd: HWND; Data, Parms: PChar;
  Show, NoPause: Boolean): Integer; stdcall;

Pseudemys Nelsoni 9. Dez 2003 18:10

Re: Wert über dll aus registry bekommen
 
danke :)

choose 10. Dez 2003 14:37

Re: Wert über dll aus registry bekommen
 
ich habe gerade von Robert Marquardt die Nachricht erhalten, dass statt Boolean lieber LongBool verwendet werden sollte. Der Compiler interpretiert diesen Datentyp etwas anders, so dass es, wie in diesem Thread zu sehen, zu einer Änderung der Programmablaufs führen kann...

Die Deklaration der Funktion sollte deshalb wie folgt lauten:
Delphi-Quellcode:
function ProcName(MWnd, AWnd: HWND; Data, Parms: PChar;
  Show, NoPause: LongBool): Integer; stdcall;
Danke, Robert!

Pseudemys Nelsoni 10. Dez 2003 15:20

Re: Wert über dll aus registry bekommen
 
habs bis jetzt noch nicht probiert, gut das du das noch gepostet hast :) danke


Alle Zeitangaben in WEZ +1. Es ist jetzt 01:25 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz