AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Read Error bei dll

Ein Thema von sharkx · begonnen am 2. Nov 2003 · letzter Beitrag vom 4. Nov 2003
Antwort Antwort
Seite 1 von 3  1 23      
sharkx

Registriert seit: 24. Feb 2003
Ort: St. Ingbert
211 Beiträge
 
Delphi 7 Enterprise
 
#1

Read Error bei dll

  Alt 2. Nov 2003, 20:38
Hallo, ich bekomme bei der ausführung dieser Function einen Read Error.

Delphi-Quellcode:
var
  FPath: string;
  Source, SPath: string;
  Target, TPath: string;
  Release: string;
  FQF: string;
  IFQF: string;

type
  TShellexecute = function(hWnd: HWND; Operation, FileName, Parameters,
    Directory: PChar; ShowCmd: Integer): HINST; stdcall;


function WriteFQF( mWnd: hWnd; aWnd: hWnd; Data: PChar; Parms: PChar;
Show: Boolean; NoPause: Boolean ): Integer; export; stdcall;
var
  FileName: PAnsiChar;
  dump: TStringList;
  i: Integer;
  MyShellExecute: TShellexecute;
begin
  FileName := PChar(FQF);
  dump := TStringList.Create;
    with dump do
     begin
      dump.Add('10' + Source + '' + Target + '' + Release + '/4096');
      for i := dump.Count -1 to StrToInt(IFQF) do
      begin
       if FileExists(FileName) = true then
        DeleteFile(PChar(FileName))
        else
          begin
          dump.SaveToFile(PChar(FileName));
          end;
     end;
      dump.Free;
      MyShellexecute(0, 'open', 'FlashFXP.exe', PChar(FPath), PChar('-c3 -tray' + ' ' + FQF), SW_NORMAL);
      Result := 3;
      end;
  end;
end;


exports
  WriteFQF;


begin
  FPath := ParamStr(1);
  Source := ParamStr(2);
  Spath := ParamStr(3);
  Target := ParamStr(4);
  TPath := ParamStr(5);
  Release := ParamStr(6);
  FQF := ParamStr(7);
  IFQF := ParamStr(8);
end.
Woran liegt das bzw was ist falsch?

die dll wird von mIRc dynamisch geladen bzw angesprochen. mIRC möchte immer als Result nen Integer wert haben, laut Hilfe ..
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)

Allerdings stürzt mIRC dann immer mit einem Read Error ab. Wäre super wenn wer rat weiß :))


merci :)
Programming today is a race between Software Engineers striving to build bigger and better idiot-proof Programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning!
  Mit Zitat antworten Zitat
sharkx

Registriert seit: 24. Feb 2003
Ort: St. Ingbert
211 Beiträge
 
Delphi 7 Enterprise
 
#2

Re: Read Error bei dll

  Alt 2. Nov 2003, 21:59
The DLL can return an integer to indicate what it wants mIRC to do:
0 means that mIRC should /halt processing
1 means that mIRC should continue processing
2 means that it has filled the data variable with a command which it wants mIRC to perform, and has filled parms with the parameters to use, if any, when performing the command.
3 means that the DLL has filled the data variable with the result that $dll() as an identifier should return.


ich habs mit allen 4 als result getestet, nix :/



[Edit] Ich hab mal alles auskommentiert bis auf die StringListe, und trotzdem fliegt mIRC weg. Ich seh aber definitiv keinen fehler. Ich hoffe es kann mir wer helfen :/ [/Edit]
Programming today is a race between Software Engineers striving to build bigger and better idiot-proof Programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning!
  Mit Zitat antworten Zitat
sharkx

Registriert seit: 24. Feb 2003
Ort: St. Ingbert
211 Beiträge
 
Delphi 7 Enterprise
 
#3

Re: Read Error bei dll

  Alt 3. Nov 2003, 13:38
Niemand ne Idee? Ich sitz da echt fest :/
Programming today is a race between Software Engineers striving to build bigger and better idiot-proof Programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning!
  Mit Zitat antworten Zitat
Christian Seehase
(Co-Admin)

Registriert seit: 29. Mai 2002
Ort: Hamburg
11.105 Beiträge
 
Delphi 11 Alexandria
 
#4

Re: Read Error bei dll

  Alt 3. Nov 2003, 21:01
Moin Sharkx,

und wo implementierst Du TShellExecute?
Oder wird die Funktion irgendwo dynamisch importiert?
Tschüss Chris
Die drei Feinde des Programmierers: Sonne, Frischluft und dieses unerträgliche Gebrüll der Vögel.
Der Klügere gibt solange nach bis er der Dumme ist
  Mit Zitat antworten Zitat
mr2

Registriert seit: 3. Mai 2003
140 Beiträge
 
Delphi 2006 Enterprise
 
#5

Re: Read Error bei dll

  Alt 3. Nov 2003, 21:53
wie wärs wenn Du ShellExecute aus der ShellAPI.pas verwendest?
Delphi-Quellcode:
uses
  ShellAPI;

...
var
// MyShellExecute: TShellexecute;
begin
...
  ShellExecute(0, 'open', 'FlashFXP.exe', PChar(FPath), PChar('-c3 -tray' + ' ' + FQF), SW_NORMAL);
...
CU mr2
  Mit Zitat antworten Zitat
sharkx

Registriert seit: 24. Feb 2003
Ort: St. Ingbert
211 Beiträge
 
Delphi 7 Enterprise
 
#6

Re: Read Error bei dll

  Alt 3. Nov 2003, 22:14
Hallo,

Habe den fehler gefunden, nachdem ich etliche male die function im ersten Tread neu geschrieben habe.

Der fehler liegt darin das die variablen nicht übernommen werden.

Übernehmen tu ich sie eigentlich so ..

Delphi-Quellcode:
begin
  V := pchar('0.01');
  FPath := ParamStr(1);
  Source := ParamStr(2);
  Spath := ParamStr(3);
  Target := ParamStr(4);
  TPath := ParamStr(5);
  Release := ParamStr(6);
  FQF := ParamStr(7);
  IFQF := ParamStr(8);
end.
Aber mag irgendwie nich, wenn ich mi die Variablen mit ShowMessage dann schauen will, sind diese leer :/
Programming today is a race between Software Engineers striving to build bigger and better idiot-proof Programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning!
  Mit Zitat antworten Zitat
scp

Registriert seit: 31. Okt 2003
1.120 Beiträge
 
Delphi 7 Personal
 
#7

Re: Read Error bei dll

  Alt 4. Nov 2003, 01:08
ParamStr(1) Eine DLL hat für gewöhnlich keine Parameter, evtl. schaust du dir mal
Parms: PChar; mit ShowMessage an, da sind doch bestimmt die Parameter drin.

[edit]
PS:

dump.Add('10' + Source + '' + Target + '' + Release + '/4096'); würde ich so schreiben:

Delphi-Quellcode:
dump.Add(#$31#$01#$30
       + #$01#$02#$7F + Source
       + #$01#$02#$7F + Target
       + #$01 + Release
       + #$2F#$01 + '4096');
Das schützt davor, das die Sonderzeichen unfreiwillig konvertiert werden.

[/edit]
  Mit Zitat antworten Zitat
sharkx

Registriert seit: 24. Feb 2003
Ort: St. Ingbert
211 Beiträge
 
Delphi 7 Enterprise
 
#8

Re: Read Error bei dll

  Alt 4. Nov 2003, 09:18
Hallo,

Ich habe mir mal mit ShowMessage die Variablen angeschaut. Die sind leer :-/

scp: Was meinst du mit hat gewöhnlich keine Parameter?
Programming today is a race between Software Engineers striving to build bigger and better idiot-proof Programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning!
  Mit Zitat antworten Zitat
Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#9

Re: Read Error bei dll

  Alt 4. Nov 2003, 09:24
Man kann eien DLL nicht so mit Parametern "starten" wie eine Anwendung. Eine DLL braucht immer eine Host-Anwendung.
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat
sharkx

Registriert seit: 24. Feb 2003
Ort: St. Ingbert
211 Beiträge
 
Delphi 7 Enterprise
 
#10

Re: Read Error bei dll

  Alt 4. Nov 2003, 09:27
Luckie, die hat sie ja ... mIRC.
Meine Functionen funktionieren auch wenn ich die Variablen in der dll gleich fest belege. Nur wenn ich sie von mIRC aus übergebe kommt nix an :/

Delphi-Quellcode:
function ShowMSG( mWnd: hWnd; aWnd: hWnd; Data: PChar; Parms: PChar;
Show: Boolean; NoPause: Boolean ): Integer; export; stdcall;
var
  i: Integer;
begin
    for i := 1 to ParamCount do
    begin
      if (ParamStr(i) = '-FPath') then
        FPath := PChar(ParamStr(i+1));
      if (ParamStr(i) = '-Source') then
        Source := PChar(ParamStr(i+1));
      if (ParamStr(i) = '-SPath') then
        SPath := PChar(ParamStr(i+1));
      if (ParamStr(i) = '-Target') then
        Target := PChar(ParamStr(i+1));
      if (ParamStr(i) = '-TPath') then
        TPath := PChar(ParamStr(i+1));
      if (ParamStr(i) = '-Release') then
        Release := PChar(ParamStr(i+1));
      if (ParamStr(i) = '-FQF') then
        FQF := PChar(ParamStr(i+1));
      if (ParamStr(i) = '-IFQF') then
        IFQF := PChar(ParamStr(i+1));
    end;
 ShowMessage('FQF ' + ' ' + FQF + 'Source ' + Source + ' ' + 'SPath ' + SPath + ' ' + 'Target ' + Target + ' ' + 'TPath ' + TPath + ' ' + 'Release ' + Release + ' ' + 'IFQF ' + IFQF + ' ' + 'FPath ' + FPath);
 Result := 0;
end;
Übergeben wird es so.

//dll meine.dll dieFunction dieParameter
Programming today is a race between Software Engineers striving to build bigger and better idiot-proof Programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning!
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 1 von 3  1 23      


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 15:59 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