Форум: "Основная";
Текущий архив: 2002.01.17;
Скачать: [xml.tar.bz2];
ВнизПомогите пожалуйста с импортом DLL Найти похожие ветки
← →
USAtyj (2001-12-29 14:03) [7]
type
TForm1 = class(TForm)
...............
function NetSend(Host,Msg: String):boolean;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
NetMessageBufferSend: function (ServerName,
MsgName,FromName:PWideChar;
Buf:Pointer;BufLen:DWord):word; stdcall;
implementation
......
function TForm1.NetSend(Host,Msg: String):boolean;
var
HLib:HModule;
PWCHost,PWCMsg: PWideChar;
begin
@NetMessageBufferSend:=nil;
HLib:=LoadLibrary("netapi32.dll");
if HLib<>0 then
begin
@NetMessageBufferSend:=GetProcAddress(HLib,"NetMessageBufferSend");
if @NetMessageBufferSend<>nil then
begin
try
Error:=1;
GetMem(PWCHost, 2*Length(Host)+2);
GetMem(PWCMsg, 2*Length(Msg)+2);
StringToWideChar(Host, PWCHost, Length(Host)+2);
StringToWideChar(Msg, PWCMsg, Length(Msg)+2);
Error:=NetMessageBufferSend(nil, PWCHost,nil,PWCMsg,2*Length(Msg));
finally
FreeMem(PWCHost);
FreeMem(PWCMsg);
Result := (Error=0);
end;
end;
FreeLibrary(HLib);
end;
end;
end.
Страницы: 1 вся ветка
Форум: "Основная";
Текущий архив: 2002.01.17;
Скачать: [xml.tar.bz2];
Память: 0.44 MB
Время: 0.004 c