![]() |
Problem mit TClientSocket (nonVCL)
Hallo,
kann mir bitte jemand sagen, was daran falsch ist?
Delphi-Quellcode:
Ich habe Delphi 7 Professional. Wenn ich das Programm starte kommt immer der Fehler.
program test;
uses windows,scktcomp; type TApp = class(TObject) Client: TClientSocket; Public procedure Start(Sender: TObject); end; var App: TApp; procedure TApp.Start(Sender: Tobject); begin try App.Client.Create(nil); except messagebox(0,'Fehler','Fehler',16); App.Client.Free; end; end; begin App.Start(App); end. Danke für die Antworten :spin2: mfg, Torpedo |
Re: Problem mit TClientSocket (nonVCL)
Zitat:
Etwas genauer? Es wird die Exception geworfen oder was ist "der Fehler"? |
Re: Problem mit TClientSocket (nonVCL)
der fehler:
messagebox(0,'Fehler','Fehler',16); :roll: bzw: Exception EAccessViolation in module test.exe at 00011ECE. Access violation at adress 00411ECE in module 'test.exe'. Read of address 00000004. |
Re: Problem mit TClientSocket (nonVCL)
Delphi-Quellcode:
Das kann nicht gehen. Du musst, wenn du eine Instanz einer Klasse erstellst, selbige einer Variablen vom Typ der Klasse zu weisen.
App.Client.Create(nil);
Delphi-Quellcode:
Bzw. bei dir sowas in der Art:
var
MyButton: TButton; begin MyButton := TButon.Craete; ...; ...;
Delphi-Quellcode:
program Project2;
{$APPTYPE CONSOLE} uses Windows, ScktComp; type TApp = class private FClient: TClientSocket; public procedure Start; end; var App: TApp; Client: TClientSocket; procedure TApp.Start; begin App := TApp.Create; Client := App.FClient.Create(nil); end; begin App.Start; readln; end. |
Re: Problem mit TClientSocket (nonVCL)
Danke, jetzt funktionierts, aber nur wenn ich eine Konsolenanwendung daraus mache.
Kann man das auch irgendwie hinkriegen, ohne dass sich eine Konsole öffnet? (soll im Hintergrund laufen und nur bei bestimmten Befehlen vom Server eine Fehlermeldung erzeugen) Edit Das Beispiel von oben funktioniert leider doch nicht. In der Konsole erscheint die Meldung: Exception EAccessViolation in module test.exe at 0001230F. Access violation at address 0041230F in module 'test.exe'. Read of address 00000000. EDIT 2 Ich habe das Problem gelöst. Ich weiß zwar nicht wie, aber jetzt funktionierts. :lol: |
Re: Problem mit TClientSocket (nonVCL)
kannst du bitte mal den code posten?
ich wollte auch mal sowas schreiben aber des hat dann nur scheiße gemacht und dann bin ich ausgerastet und habs gelöscht... |
Alle Zeitangaben in WEZ +1. Es ist jetzt 12:53 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz