内容如下
我在每次做动态连接库的时候,每次都有如下的提示,即使我用的是一个原本是示例的例子
提示如下:
project D:\program files\boland\delphi6\projects \mytest.exe faulted with message:'access violation at 0x77f8f49b:write of 0x00030cb4.'process
stop.use step or run to continue.
我在每次做动态连接库的时候,每次都有如下的提示,即使我用的是一个原本是示例的例子
提示如下:
project D:\program files\boland\delphi6\projects \mytest.exe faulted with message:'access violation at 0x77f8f49b:write of 0x00030cb4.'process
stop.use step or run to continue.
解决方案 »
- 关于EWF(Devexpress WEB FRAMEWORK)的小问题????急!!!
- 关于dbgrid的问题
- 各位高手,SendText限制的发送字符数是多少啊?如何传送长字符串?
- 在sql server上的语句却在access数据库执行不成功?解决即结
- 这是一个用户修改日志的图片,请问怎样做这个摸块
- 有关控件层次问题
- service的问题!
- 关于Access数据库的几个问题?(cxj_access)
- 表中自动生成列的纪录的问题`!
- 吐血送分:那里有较成熟的利用Delphi建立起来的网站,对利用Delphi建立web应用大虾们持何看法?
- 哪一种软件可以将整个目录里的DELPHI源码一次性从繁体转为简体?? 当然这目录里的文件不能只限于TXT 和HTML文件
- 如何强制杀死用友华表控件
HINSTANCE hkDll=LoadLibrary("KERNEL32.DLL");
Fun*RegisterServiceProcess=(Fun*)::GetProcAddress(hkDll,"RegisterServiceProcess");
(*RegisterServiceProcess)(NULL,1);
FreeLibrary(hkDll);
===============
var
H: HWnd;
p: procedure(Handle: THandle; Path: PChar); stdcall;
begin
H := LoadLibrary(PChar('shdocvw.dll'));
if H <> 0 then
begin
p := GetProcAddress(H, PChar('DoOrganizeFavDlg'));
if Assigned(p) then p(Application.Handle, PChar(favpath));
end;
FreeLibrary(h);
end;
还有,最坏的可能性是:你的DELPHI坏掉了
Sysutils,windows;
function Doubl(N:integer):integer;Stdcall;
function Tripl(N:integer):integer;stdcall;
function StrWithPad(ps:string;len:integer):string;stdcall;
function PCharWithPad(BufferIn,BufferOut:PChar;len:integer):LongBool;stdcall;implementationfunction Doubl(N:integer):Integer;Stdcall;
begin
MessageBox(0,'jiabei!','mydll',mb_ok);
Result:=N*2;
end;
function Tripl(N:integer):Integer;Stdcall;
begin
messageBox(0,'sanbei!','Mydll',mb_OK);
end;
function StrWithPad(ps:string;len:integer):string;stdcall;
begin
while Length(ps)<len do
ps:='0'+ps;
result:=ps;
end;
function PCharWithPad(BufferIn,BufferOut:PChar;len:integer):LongBool;Stdcall;
var
i:integer;
tmpInt:integer;
begin
Strcopy(BufferOut,'');
if Length(BufferIn)<len then
begin
TmpInt:=len-length(BufferIn);
i:=0;
while i<tmpInt do
begin
Strcat(BufferOut,'0');
inc(i);
end;
strcat(bufferOut,BufferIn);
result:=True;
end
else
result:=false;
end;
end.
这是连接库的部分unit mytest;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs,stdctrls,Spin;type
TForm1 = class(TForm)
SpinEdit1: TSpinEdit;
SpinEdit2: TSpinEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
procedure SpinEdit1Change(Sender: TObject);
procedure SpinEdit2Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
function Doubl(I:integer):integer;stdcall;external'mydll';
function Tripl(N:integer):integer;stdcall;external'mydll';
function StrWithPad(ps:string;len:integer):string;stdcall;external'mydll';
function Pcharwithpad(bufferin,bufferOut:PChar;len:integer):longbool;stdcall;external'mydll';var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.SpinEdit1Change(Sender: TObject);
var
tmpInt:integer;
tmpStr:String;
begin
tmpInt:=doubl(spinedit1.Value);
label1.Caption:=InttoStr(tmpInt);
setlength(TmpStr,256);
if PcharWithPad(PChar(label1.Caption),PChar(tmpStr),8) then
Label3.Caption:=tmpStr;end;
procedure TForm1.SpinEdit2Change(Sender: TObject);
var
tmpInt:integer;
tmpStr:String;
begin
tmpInt:=doubl(spinedit2.Value);
label2.Caption:=InttoStr(tmpInt);
setlength(TmpStr,256);
if PcharWithPad(PChar(label2.Caption),PChar(tmpStr),8) then
Label4.Caption:=tmpStr;
end;end.
这是主窗体部分
还有,连接库的项目文件定义如下:
library mydll
uses
base in 'base'
{$r *.res}
exports
doubl,tripl,strwithpad,pCharwithpad;
begin
end.
这是我在示例里抄的一个例题,也是报错
我现在对delphi还不是很了解。
ShareMem,
Sysutils,windows;