Форум: "Начинающим";
Текущий архив: 2007.09.09;
Скачать: [xml.tar.bz2];
Внизперевод строки в ip. Найти похожие ветки
← →
VitV © (2007-08-15 12:01) [0]function NetSend(Dest, Source, Msg: string): Longint;
type
TNetMessageBufferSendFunction = function(servername,
msgname,
fromname: PWideChar;
buf: PWideChar;
buflen: Cardinal): Longint; stdcall;
var
NetMessageBufferSend: TNetMessageBufferSendFunction;
SourceWideChar: PWideChar;
DestWideChar: PWideChar;
MessagetextWideChar: PWideChar;
Handle: THandle;
begin
Handle := LoadLibrary("NETAPI32.DLL");
if Handle = 0 then
begin
Result := GetLastError;
Exit;
end;
@NetMessageBufferSend := GetProcAddress(Handle, "NetMessageBufferSend");
if @NetMessageBufferSend = nil then
begin
Result := GetLastError;
Exit;
end;
MessagetextWideChar := nil;
try
GetMem(MessagetextWideChar, Length(Msg) * SizeOf(WideChar) + 1);
GetMem(DestWideChar, 20 * SizeOf(WideChar) + 1);
StringToWideChar(Msg, MessagetextWideChar, Length(Msg) * SizeOf(WideChar) + 1);
StringToWideChar(Dest, DestWideChar, 20 * SizeOf(WideChar) + 1);
if Source = "" then
Result := NetMessageBufferSend(nil, DestWideChar, nil,MessagetextWideChar, Length(Msg) * SizeOf(WideChar) + 1)
else
begin
GetMem(SourceWideChar, 20 * SizeOf(WideChar) + 1);
StringToWideChar(Source, SourceWideChar, 20 * SizeOf(WideChar) + 1);
Result := NetMessageBufferSend(nil, DestWideChar, SourceWideChar,
MessagetextWideChar, Length(Msg) * SizeOf(WideChar) + 1);
FreeMem(SourceWideChar);
end;
finally
FreeMem(MessagetextWideChar);
FreeLibrary(Handle);
end;
end;
NetSend("komp1","komp2","string");
NetSend(1.0.0.1,1.0.0.2,"string");-не работает...как перевести строку в ип?
← →
umbra © (2007-08-15 12:36) [1]
> как перевести строку в ип?
>uses WinSock
var
ipaddr: LongInt;
IPaddr := inet_addr("127.0.0.1");
← →
vitv © (2007-08-15 14:02) [2]Спасибо за помощь!
п.с.Но тогда надо функцию переписывать.
Страницы: 1 вся ветка
Форум: "Начинающим";
Текущий архив: 2007.09.09;
Скачать: [xml.tar.bz2];
Память: 0.44 MB
Время: 0.048 c