一个关于DLL中使用变量的问题的问题(50分)

  • 主题发起人 主题发起人 cjsyf
  • 开始时间 开始时间
C

cjsyf

Unregistered / Unconfirmed
GUEST, unregistred user!
function RemoveFolder(FolderName:PChar
bDeleteReadOnly:boolean
bDeleteFolder:boolean): boolean
stdcall;
var
bSuccess:boolean;
begin
bSuccess := true
//这一句出错
CleanFolder(FolderName,bDeleteReadOnly,bSuccess);
if bDeleteFolder = true then
begin
RemoveFolder := RemoveDirectory(FolderName);
exit;
end;
RemoveFolder := bSuccess;
end;
这段代码运行时一直发生这样的错误:
Access violation at address 00235569 ....Read of address 0000005C.
调试时发现是赋值语句出错。请问如何改
 
该句不可能出错吧,可能DLL未初始化好。
 
重新启动计算机,再试一下,这句没问题了
 
这是程序中调用的部分,我以前也这么用没有问题
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);

private
{ Private declarations }
public
{ Public declarations }
end;
function RemoveFolder(FolderName:PChar;bDeleteReadOnly:boolean;bDeleteFolder:boolean):boolean;stdcall;external 'FileIO.dll';
var
Form1: TForm1;

implementation
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
后退
顶部