Q&A

  • [급질문]소스와오류메세지를 올리겠습니다.봐주세요[급질문]
오류메세지는

=======================================================================

Project Project1.exe raised exception class EAccessViollation with message 'Access violation at address 0048436A in module 'Project1.exe'.

Read of address 00000008 Process stpped. Use Step or Run continue.

=======================================================================

이고요...

소스는

=============================================================================

unit Unit1;



interface



uses

Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

Psock, NMFtp, ComCtrls, StdCtrls, ExtCtrls, Db, DBTables, Buttons,FileCtrl;



type

TForm1 = class(TForm)

NMFTP1: TNMFTP;

StatusBar1: TStatusBar;

RichEdit1: TRichEdit;

DB1: TDatabase;

QueryTemp: TQuery;

TimerInterface: TTimer;

Panel1: TPanel;

Panel2: TPanel;

QueryHimss: TQuery;

QueryInterface: TQuery;

FTPTimer: TTimer;

TimerLogo: TTimer;

SpeedButton1: TSpeedButton;

SpeedButton2: TSpeedButton;

procedure NMFTP1Success(Trans_Type: TCmdType);

procedure NMFTP1Connect(Sender: TObject);

procedure FormShow(Sender: TObject);

procedure NMFTP1Failure(var Handled: Boolean; Trans_Type: TCmdType);

procedure NMFTP1Error(Sender: TComponent; Errno: Word; Errmsg: String);

procedure NMFTP1ListItem(Listing: String);

procedure TimerInterfaceTimer(Sender: TObject);

procedure Increase;

procedure SaveLog;

procedure TimerLogoTimer(Sender: TObject);

procedure SpeedButton1Click(Sender: TObject);

procedure SpeedButton2Click(Sender: TObject);

procedure FormClose(Sender: TObject; var Action: TCloseAction);

procedure DbTry;



private

{ Private declarations }

public

hcode,printset,checkset,license,name:string;//h_config 값 변수

scriptno,count:integer;

{ Public declarations }

end;



var

Form1: TForm1;

Reader:textfile;

Q,savecnt,count:Integer;

s,Listing:String;

juminno, m_name, m_dept, sujinno,to_date,ftpfile : string;

savedate :TDateTime;

path: array of String;

implementation



{$R *.DFM}



procedure TForm1.NMFTP1Success(Trans_Type: TCmdType);

begin

Case Trans_Type of

cmdCurrentDir: StatusBar1.SimpleText := 'CurrentDir success';

cmdChangeDir: StatusBar1.SimpleText := 'ChangeDir success';

cmdMakeDir: StatusBar1.SimpleText := 'MakeDir success';

cmdDelete: StatusBar1.SimpleText := 'Delete success';

cmdRemoveDir: StatusBar1.SimpleText := 'RemoveDir success';

cmdList: StatusBar1.SimpleText := 'List success';

cmdRename: StatusBar1.SimpleText := 'Rename success';

cmdUpRestore: StatusBar1.SimpleText := 'UploadRestore success';

cmdDownRestore: StatusBar1.SimpleText := 'DownloadRestore success';

cmdDownload: StatusBar1.SimpleText := 'Download success';

cmdUpload: StatusBar1.SimpleText := 'Upload success';

cmdAppend: StatusBar1.SimpleText := 'UploadAppend success';

cmdReInit: StatusBar1.SimpleText := 'ReInit success';

cmdAllocate: StatusBar1.SimpleText := 'Allocate success';

cmdNList: StatusBar1.SimpleText := 'NList success';

cmdDoCommand: StatusBar1.SimpleText := 'DoCommand success';

end;

end;







procedure TForm1.NMFTP1Connect(Sender: TObject);

begin

StatusBar1.SimpleText := 'Connected';

end;



procedure TForm1.NMFTP1Failure(var Handled: Boolean; Trans_Type: TCmdType);

begin

Case Trans_Type of

cmdCurrentDir: StatusBar1.SimpleText := 'CurrentDir failure';

cmdChangeDir: StatusBar1.SimpleText := 'ChangeDir failure';

cmdMakeDir: StatusBar1.SimpleText := 'MakeDir failure';

cmdDelete: StatusBar1.SimpleText := 'Delete failure';

cmdRemoveDir: StatusBar1.SimpleText := 'RemoveDir failure';

cmdList: StatusBar1.SimpleText := 'List failure';

cmdRename: StatusBar1.SimpleText := 'Rename failure';

cmdUpRestore: StatusBar1.SimpleText := 'UploadRestore failure';

cmdDownRestore: StatusBar1.SimpleText := 'DownloadRestore failure';

cmdDownload: StatusBar1.SimpleText := 'Download failure';

cmdUpload: StatusBar1.SimpleText := 'Upload failure';

cmdAppend: StatusBar1.SimpleText := 'UploadAppend failure';

cmdReInit: StatusBar1.SimpleText := 'ReInit failure';

cmdAllocate: StatusBar1.SimpleText := 'Allocate failure';

cmdNList: StatusBar1.SimpleText := 'NList failure';

cmdDoCommand: StatusBar1.SimpleText := 'DoCommand failure';

end;

end;



procedure TForm1.NMFTP1Error(Sender: TComponent; Errno: Word;

Errmsg: String);

begin

ShowMessage('Error '+IntToStr(Errno)+': '+Errmsg);

end;



procedure TForm1.FormShow(Sender: TObject);

begin

//FTPTimer.Enabled := False;

//FTPTimer.Interval:= 1000; //30초 단위

to_date := formatdatetime('yyyymmdd',now);

ftpfile:= to_date + IntToStr(count);

NMFTP1.Host := '203.251.174.14';

NMFTP1.Port := 21;

NMFTP1.Timeout := 360000;

NMFTP1.UserID := 'guest';

NMFTP1.Password := 'guestcare';

try

NMFTP1.Connect;



except

On E:Exception do

if E.message='something'

then writeln('poo');

end;



NMFTP1.list;

//FTPTimer.Enabled :=True;

end;



procedure TForm1.NMFTP1ListItem(Listing: String);

begin

RichEdit1.Lines.Add(Listing);

end;



procedure TForm1.TimerInterfaceTimer(Sender: TObject);

var

license,name: String;

count: Integer;

begin

FTPTimer.Enabled := False;

FTPTimer.Interval:= 1000; //30초 단위

TimerInterface.Enabled :=false;

TimerInterface.Interval := 10000; //30초 단위

to_date := formatdatetime('yyyymmdd',now);

panel2.Caption := ' '+formatdatetime('yyyy-mm-dd(ddd)',now);

QueryTemp.Close ;

QueryTemp.sql.Clear;

QueryTemp.SQL.Add ('select hospicode,Printfnyn,Confifnyn,'+

' hp_licens,hp_histna from h_config');



QueryTemp.Open ;



hcode :=QueryTemp.FieldByName('hospicode').asstring;

printset:=QueryTemp.FieldByName('printfnyn').asstring;

checkset:=QueryTemp.FieldByName('confifnyn').asstring;

license :=QueryTemp.FieldByName('hp_licens').asstring;

name :=QueryTemp.FieldByName('hp_histna').asstring;



RichEdit1.SelText :='========================================================================'+chr(13)+chr(10);



//count := 0;

ftpfile:= to_date + IntToStr(count);

{While not FileExists('C:A' + (to_date + IntToStr(count))+ '.txt') = True do

begin

NMFTP1.Download((to_date + IntToStr(count)+'.txt'), ('C:A' + (to_date + IntToStr(count))+ '.txt'));

end;}

for count:= 0 to nmftp1.FTPDirectoryList.name.Count-1 do <<<====이부분에서 넘어갈때오류메세지가 뜹니다... ㅜ.ㅜ;;

begin

If not FileExists('C:A' + (to_date + IntToStr(count))+'.txt') = True Then

begin

NMFTP1.Download((to_date + IntToStr(count)+'.txt'), ('C:A' + (to_date + IntToStr(count))+ '.txt'));

DbTry;

end

else If FileExists('C:A' + (to_date + IntToStr(count)+IntToStr(1))+'.txt') = True Then

FTPTimer.Enabled := False;

FTPTimer.Interval:= 30000; //30초 단위

TimerInterface.Enabled :=false;

TimerInterface.Interval := 30000; //30초 단위

FTPTimer.Enabled := True;

TimerInterface.Enabled :=True;

//end;

// break;

//end; //While FileExists('C:A' + (to_date + IntToStr(count))+ '.txt') = True do ~

end; // For~

Increase; // Increase 프로시져 호출

TimerInterface.Enabled :=True;

Richedit1.seltext :='================================================================'

end;//procedure TForm1.TimerInterfaceTimer(Sender: TObject);



===================================================================================

이 밑으로 소스가 더 있으나 많은 관계로 일단 부분만 올립니다...

제발 좀 봐주세요!!!

글구요...이플그램의 .exe 를 실행 시키면 폼이 보이질 않아요....... ㅜ.ㅜ;;

엊그제만 해도 폼이 보였는데........ 어제부터 보이질 않아서 미치것 같아요....

폼의 속성에서도 visiable도 true로 하고 포지션도 센터로 해보고 그래도 안되네요....

고수님들 좀만 도와 주세요.... ㅜ.ㅜ;;

이렇게 초보의 길은 멀고도 험하단 말입니까???

올바른 길로 갈수 있도록 구보 살피소서!!!!

금 즐거운 주말 되세요....





0  COMMENTS