Текущий архив: 2002.08.29;
Скачать: CL | DM;
ВнизМожно ли с помощью Sendmessage Найти похожие ветки
← →
SergeyDon (2002-05-23 14:47) [0]передать не только 2*integer а текст?
или что нибуть аналогичное может есть? надо чтобы компанент получал сообщения.
← →
Song (2002-05-23 14:48) [1]Передавайте pointer строки
← →
Alx2 (2002-05-23 15:14) [2]Если в другой процесс, то wm_copydata спасет отца русской демократии :)
← →
SergeyDon (2002-05-23 15:24) [3]wm_copydata не нахожу в справке можно конкретней
← →
Alx2 (2002-05-23 15:28) [4]Windows SDK:
The WM_COPYDATA message is sent when an application passes data to another application.
WM_COPYDATA
wParam = (WPARAM) (HWND) hwnd; // handle of sending window
lParam = (LPARAM) (PCOPYDATASTRUCT) pcds; // pointer to structure with data
Parameters
hwnd
Identifies the window passing the data.
pcds
Points to a COPYDATASTRUCT structure that contains the data to be passed.
Return Values
If the receiving application processes this message, it should return TRUE; otherwise, it should return FALSE.
Remarks
An application must use the SendMessage function to send this message, not the PostMessage function.
The data being passed must not contain pointers or other references to objects not accessible to the application receiving the data.
While this message is being sent, the referenced data must not be changed by another thread of the sending process.
The receiving application should consider the data read-only. The pcds parameter is valid only during the processing of the message. The receiving application should not free the memory referenced by pcds. If the receiving application must access the data after SendMessage returns, it must copy the data into a local buffer.
See Also
PostMessage, SendMessage, COPYDATASTRUCT
← →
Yuri Btr (2002-05-24 09:30) [5]SendMessage(hand,WM_CHAR,LongInt(Pchar("a")),1);
← →
SPeller (2002-05-24 13:19) [6]Передать можно что угодно, надо только передать указатель на некую структуру, массив и т.п.
← →
Alx2 (2002-05-24 14:12) [7]>SPeller © (24.05.02 13:19)
Дополню: только внутри своего процесса.
Для чужих процессов - MMF и конструкции на их основе, например, тот же wm_copydata.
← →
StAL (2002-05-24 17:33) [8]ПРИЛОЖЕНИЕ 1
...
type
PStrMsg = ^TStrMsg;
TStrMsg = record
S : PChar;
end;
var
MMFHandle: THandle;
StrMsg: PStrMsg;
...
procedure Form1Create(...);
begin
MMFHandle := CreateFileMapping(...); //см. WinSDK
StrMsg := MapViewOfFile(...);
end;
procedure Form1Close(...);
begin
UnMapViewOfFile(StrMsg);
CloseHandle(MMFHandle);
end;
procedure SendToProc2(str: PChar);
begin
StrMsg^.s := str;
SendMessage (HandleOfProc2, wm_msgsent, 0, 0);
end;
............
ПРИЛОЖЕНИЕ 2
//такое же объеявление типа, создание файла и разрушение
procedure OnMsgSent(var Msg: TMessage);
begin
form2.caption:=strpas(StrMsg^.s);
end;
ОБЯЗАТЕЛЬНО создавай файлы в памяти с одинаковым именем!
← →
HighWay (2002-06-25 19:56) [9]Пробовал пример - delphi ругается на wm_msgsent.
Если можно, скиньте мне в качестве примера рабочий проект.
Спасибо.
Страницы: 1 вся ветка
Текущий архив: 2002.08.29;
Скачать: CL | DM;
Память: 0.46 MB
Время: 0.007 c