]、。·ˉˇ¨〃々—~‖…’”〕〉》」』〗】∶!"'),.:;?]` uses cpl,ctlpanel;
procedure TForm1.Button1Click(Sender: TObject);
var
Proc : TCPlApplet;
Info : TNewCplInfo;
Mo : THandle;
begin
MO:=LoadLibrary('Desk.cpl');
@Proc := GetProcAddress(mo,'CPlApplet');
{取得的@Proc始终为nil,请帮我看看是哪里错了,现在这个问题应该不是很难吧}
if @Proc<>nil then
begin
Proc(Handle,CPL_NEWINQUIRE,0,LongInt(@Info));
Image1.Picture.Icon.Handle:=Info.hIcon;
Label1.caption:=Info.szName;
Label2.caption:=Info.szInfo;
end;
FreeLibrary(Mo);
end;
实际上,以上的方法还是
有问题。(我只测试了Desk.cpl便以为通过了),但当我测试这几项时,便不行了,
请有兴趣的朋友看看:
Sysdm.cpl,netcpl.cpl,modem.cpl,inetcpl.cpl,appwiz.cpl,odbc32.cpl,bde admin.cpl
其中sysdm,netcpl,在LoadLibrary时失败,
我用GetlastError检查,提示为“与系统连接的设备不能正常运转”,而剩余的几个则LoadLibrary可以通过,但提出来的szInfo以及szName全是乱码,解决方法如下:
procedure TForm1.Button1Click(Sender: TObject);
var
Proc : TCPlApplet;
Info : TNewCplInfo;
Mo : THandle;
buf:pchar;
info2:cplinfo;
begin
getmem(buf,255);
MO:=LoadLibrary('inetcpl.cpl');
// showmessage(GetErrorMessage(255));
@Proc := GetProcAddress(mo,'CPlApplet');
if @Proc<>nil then
begin
proc(handle,CPL_INIT,0,0);
proc(handle,CPL_GETCOUNT,0,0);
proc(handle,CPL_INQUIRE,0,integer(@info2));
loadstring(mo,info2.idName,buf,255);
label3.Caption:=buf;
loadstring(mo,info2.idInfo,buf,255);
label4.Caption:=buf;
image2.Picture.Icon.Handle:=loadicon(mo,MAKEINTRESOURCE(info2.idIcon));
Proc(Handle,CPL_NEWINQUIRE,0,integer(@Info));
Image1.Picture.Icon.Handle:=Info.hIcon;
Label1.caption:=Info.szName;
Label2.caption:=Info.szInfo;
end;
freemem(buf);
FreeLibrary(Mo);
end;