![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Как вызвать функцию API NetMessageBufferSend?? [D6, Win2k]
nikulin © (2002-04-10 19:28:00)Помогите обьясните пож-ста как вызвать ф-ю?
Как эти параметры LPTSTR и т.д. обьявлять ??
NET_API_STATUS NetMessageBufferSend(
LPTSTR servername,
LPTSTR msgname,
LPTSTR fromname,
LPBYTE buf,
DWORD buflen
);
Yuri Btr (2002-04-11 12:10:00) [1]Сорри...
добавить в раздел var:
HostName,RName, SName: LPCWSTR;
buf: Pointer;
size: Integer;
Yuri Btr (2002-04-11 12:03:00) [2]var
Form1: TForm1;
Function NetMessageBufferSend (servername: LPCWSTR; msgname: LPCWSTR; fromname: LPCWSTR; buf: Pointer; buflen: DWORD): longint; stdcall; external "netapi32.dll";
implementation
----------------------------------------------------------------
procedure *************
var
s, text:string;
begin
HostName:=nil;
SName := nil;
s:="RecepientName";
size := SizeOf(WideChar)*Length(s)+1;
GetMem (buf, Size);
RName := StringToWideChar (s, buf, Length (s) + 1);
s:="Hello";
size := SizeOf(WideChar)*Length(s)+1;
GetMem (buf, Size);
text := StringToWideChar (s, buf, Length (s) + 1);
size := SizeOf(WideChar)*Length(text)+1;
GetMem (buf, Size);
PWideChar (Buf) := StringToWideChar (text, buf, Length (text)+1);
If NetMessageBufferSend (HostName, RName, SName, buf, size) <> NO_ERROR
then ShowMessage ("Ошибка!");
end;
Tosov (2002-04-10 22:59:00) [3]Функция будет выглядеть примерно так:
Function NetMessageBufferSend (
servername: LPCWSTR;
msgname: LPCWSTR;
fromname: LPCWSTR;
buf: Pointer;
buflen: DWORD
): longint; stdcall; external "netapi32.dll";
Пример использования - http://delphi.xonix.ru/faq/show.php?m=lan&n=2
PS.А в MSDN параметры типа LPCWSTR (PWideChar), а не LPTSTR (PChar)