External:SIGSEGV错误

Caibird1 2011-09-06 12:43:42
下面的代码是哪里有问题?我是newbie,刚刚接触delphi而已..
unit MemoryClass;


{$mode objfpc}{$H+}


interface


uses
Classes, SysUtils,Windows,jwatlhelp32;
//TlHelp32=jwatlhelp32.pas
type CMemory=class(TObject)
private
{ private declarations }
ProcessId:DWORD;
public
procedure FindWindow(clsname:pwidechar;windowname:pwidechar);
Constructor Create();
{ public declarations }
end;
implementation


Constructor CMemory.Create();
begin
ProcessId:=0;
end;


procedure CMemory.FindWindow(clsname:pwidechar;windowname:pwidechar);
var temphwnd:hwnd;
begin
temphwnd:=FindWindowW(clsname,windowname);
if(temphwnd<>0) then
begin
GetWindowThreadProcessID(temphwnd,@ProcessId);
end
else
ProcessId:=0;//调用后提示在这里出错...
end;



调用..
var
CMem1:CMemory;
begin
CMem1:=CMem1.Create();
CMem1.FindWindow('Kernel Class',nil);
end;
...全文
327 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
李秋步 2011-12-26
  • 打赏
  • 举报
回复
我也遇到类似问题:看看这个呢
http://hi.baidu.com/frank_hz_jiang/blog/item/065d9dfa9078581d6d22eba4.html
爱蹄子的羊头 2011-09-22
  • 打赏
  • 举报
回复
没有问题啊..我XE 通过了
Caibird1 2011-09-21
  • 打赏
  • 举报
回复
顶起来看看,这个问题已经很多天了...

1,184

社区成员

发帖
与我相关
我的任务
社区描述
Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧