Этот баннер — требование Роскомнадзора для исполнения 152 ФЗ.
«На сайте осуществляется обработка файлов cookie, необходимых для работы сайта, а также для анализа использования сайта и улучшения предоставляемых сервисов с использованием метрической программы Яндекс.Метрика. Продолжая использовать сайт, вы даёте согласие с использованием данных технологий».
Политика конфиденциальности
|
|
|
Параметры SendMessage
|
|||
|---|---|---|---|
|
#18+
Собственно в хелпе написано : Код: plaintext 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. А вот где узнать какие значения Msg, wParam и lParam для чего используются не пойму. В частности мне нужно послать сообщение окну, что нажата такая-то клавиша. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 19.11.2003, 15:39 |
|
||
|
Параметры SendMessage
|
|||
|---|---|---|---|
|
#18+
В частности: WM_KEYDOWN The WM_KEYDOWN message is posted to the window with the keyboard focus when a nonsystem key is pressed. A nonsystem key is a key that is pressed when the ALT key is not pressed. A window receives this message through its WindowProc function. LRESULT CALLBACK WindowProc( HWND hwnd, // handle to window UINT uMsg, // WM_KEYDOWN WPARAM wParam, // virtual-key code LPARAM lParam // key data ); Parameters wParam Specifies the virtual-key code of the nonsystem key. lParam Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table. Value Description 0–15 Specifies the repeat count for the current message. The value is the number of times the keystroke is autorepeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative. 16–23 Specifies the scan code. The value depends on the original equipment manufacturer (OEM). 24 Specifies whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0. 25–28 Reserved; do not use. 29 Specifies the context code. The value is always 0 for a WM_KEYDOWN message. 30 Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is zero if the key is up. 31 Specifies the transition state. The value is always zero for a WM_KEYDOWN message. Return Values An application should return zero if it processes this message. Remarks If the F10 key is pressed, the DefWindowProc function sets an internal flag. When DefWindowProc receives the WM_KEYUP message, the function checks whether the internal flag is set and, if so, sends a WM_SYSCOMMAND message to the top-level window. The wParam parameter of the message is set to SC_KEYMENU. Because of the autorepeat feature, more than one WM_KEYDOWN message may be posted before a WM_KEYUP message is posted. The previous key state (bit 30) can be used to determine whether the WM_KEYDOWN message indicates the first down transition or a repeated down transition. For enhanced 101- and 102-key keyboards, extended keys are the right ALT and CTRL keys on the main section of the keyboard; the INS, DEL, HOME, END, PAGE UP, PAGE DOWN, and arrow keys in the clusters to the left of the numeric keypad; and the divide (/) and ENTER keys in the numeric keypad. Other keyboards may support the extended-key bit in the lParam parameter. Windows 2000 or later: Applications must pass wParam to TranslateMessage without altering it at all. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 19.11.2003, 15:45 |
|
||
|
Параметры SendMessage
|
|||
|---|---|---|---|
|
#18+
WM_KEYDOWN nVirtKey = (int) wParam; // virtual-key code lKeyData = lParam; // key data Открой Win32.hlp и набери в Index WM_ ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 19.11.2003, 15:45 |
|
||
|
Параметры SendMessage
|
|||
|---|---|---|---|
|
#18+
А примерчик например для клавиши "К"? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 19.11.2003, 16:15 |
|
||
|
Параметры SendMessage
|
|||
|---|---|---|---|
|
#18+
Написал для Enter: SendMessage(handle,WM_KEYDOWN,VK_RETURN,0); SendMessage(handle,WM_KEYUP,VK_RETURN,1); Правильно ли? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 19.11.2003, 16:22 |
|
||
|
Параметры SendMessage
|
|||
|---|---|---|---|
|
#18+
Вроде SendMessage работает. Появился еще вопросик: автор писал: var h:HWND; .... ShellExecute(h,'open',PChar('Project1.exe'),nil,nil,SW_SHOW); SendMessage(h,WM_KEYDOWN,VK_RETURN,0); SendMessage(h,WM_KEYUP,VK_RETURN,1); Так правильно делать (что-то не работает)? По-моему я с handle что-то неправильно делаю. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 19.11.2003, 16:43 |
|
||
|
Параметры SendMessage
|
|||
|---|---|---|---|
|
#18+
Sorry за невнятные вопросы. Начнем все с начала. У меня есть прога, назовем ее Prog1, которую я запускаю из своей проги. После запуска Prog1 мне нужно в нее передать сообщение, что нажата клавиша Enter. Пробовал передавать сообщения в приложении от одного окна к другому (этого же приложения) - все работает. Пробовал запускать Prog1 и передавать ему сообщение о нажатии Enter - не пашет: Код: plaintext 1. 2. 3. 4. Что я неправильно делаю? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 20.11.2003, 11:10 |
|
||
|
Параметры SendMessage
|
|||
|---|---|---|---|
|
#18+
>>SendMessage(h, Так ты посылаешь сообщение не какому-либо окну Project1.exe а некоемому parent window Если у тебя есть в Project1.exe скажем форма TMyMainForm-GUID то используй hWindow := FindWindow('TMyMainForm-GUID',nil) и если hWindow > 0 то и SendMessage(hWindow, ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 20.11.2003, 11:20 |
|
||
|
Параметры SendMessage
|
|||
|---|---|---|---|
|
#18+
Ааа... Оказывается у приложения и у окна разные handle! Как же тогда узнать handle окна? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 20.11.2003, 11:25 |
|
||
|
Параметры SendMessage
|
|||
|---|---|---|---|
|
#18+
Ты вообще ответы читаешь? Тебе же написали: hWindow := FindWindow('TMyMainForm-GUID',nil) Вот именно так и получай ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 20.11.2003, 11:36 |
|
||
|
Параметры SendMessage
|
|||
|---|---|---|---|
|
#18+
автор писал:Ты вообще ответы читаешь? Читаю. Просто я набрал ответ, потом меня отвлекли на пару минут, а потом я нажал кнопку опубликовать. Да и иннет у меня тормозной (потому что халявный). А что делать, если я не знаю "имя" окна? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 20.11.2003, 11:45 |
|
||
|
Параметры SendMessage
|
|||
|---|---|---|---|
|
#18+
А как передать сообщение консольному приложению? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 20.11.2003, 14:33 |
|
||
|
Параметры SendMessage
|
|||
|---|---|---|---|
|
#18+
С консольными помойму все позаковырестее будет но гдето в инете я это видел , всмусле на этот вопрос ну если я вообще ничего не путаю :) _____________ __ ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 20.11.2003, 14:37 |
|
||
|
Параметры SendMessage
|
|||
|---|---|---|---|
|
#18+
Вот тут нашел : http://www.sources.ru/delphi/system/delphi_pipes.shtml Буду разбираться... ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 20.11.2003, 14:56 |
|
||
|
|

start [/forum/topic.php?fid=58&msg=32329847&tid=2115826]: |
0ms |
get settings: |
8ms |
get forum list: |
15ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
55ms |
get topic data: |
9ms |
get forum data: |
2ms |
get page messages: |
50ms |
get tp. blocked users: |
1ms |
| others: | 221ms |
| total: | 367ms |

| 0 / 0 |
