Форум: "Начинающим";
Текущий архив: 2009.07.26;
Скачать: [xml.tar.bz2];
Внизотправить значение буквы в стороннее приложение Найти похожие ветки
← →
sotrudnik1 (2009-06-01 08:54) [0]собственно:
1. есть сторонее приложение, с заголовком допустим "каракат"
2. в нем существует хот-кей привязанный к букве "V"
как отправить средствами дельфей это значение в вышеуказанное приложение при условии что окно не активно или свернуто
P.S. если не сложно с примером
← →
sotrudnik1 (2009-06-01 11:34) [1]подскажите пожалуйста!
← →
clickmaker © (2009-06-01 11:41) [2]WM_KEYDOWN
← →
sotrudnik1 (2009-06-01 11:56) [3]огромная просьба содержимое юнита скинуть!
Заранее спасибо!
← →
clickmaker © (2009-06-01 12:02) [4]какого юнита?
← →
sotrudnik1 (2009-06-01 13:05) [5]содержащего код вышеназванных действий.
Заранее спасибо!
← →
clickmaker © (2009-06-01 13:24) [6]там на целый юнит не наберется, к сожалению.
2 строчки:
FindWindow
PostMessage
← →
sotrudnik1 (2009-06-01 13:35) [7]сейчас попробую! спасибо еще раз!
← →
sotrudnik1 (2009-06-01 13:57) [8]огромная просьба привести пример!
заголовок окна "freename"
отпровляемое значение в него "B"...
Заранее спасибо!
← →
clickmaker © (2009-06-01 14:03) [9]что именно не понятно?
← →
sotrudnik1 (2009-06-01 14:10) [10]procedure TForm1.Button1Click(Sender: TObject);
Var
Men :HMenu;
Hnd,HndDialog,HndControl,HndAsc,HndBtn :HWnd;
HndMen,HndSMen :HMenu;
StrClass :PChar;
StrBase :string;
IdBtn,idMen :integer;
begin
Hnd:=FindWindow(nil, "Fragoria");
if Hnd <>0 then begin
windows.SetForegroundWindow(Hnd);
PostMessage ???????????? <-вот что тут забивать непонятно((((
end;
end;
← →
clickmaker © (2009-06-01 14:14) [11]> PostMessage ???????????? <-вот что тут забивать непонятно((((
Hnd, WM_CHAR и код нужной буквы
← →
sotrudnik1 (2009-06-01 14:19) [12]PostMessage (Hnd, WM_CHAR, "V");
несовместимые типы Integer и Char
← →
sotrudnik1 (2009-06-01 14:33) [13]в чем ошибка???
← →
Игорь Шевченко © (2009-06-01 15:27) [14]
> несовместимые типы Integer и Char
> в чем ошибка???
В этом
← →
Andy BitOff © (2009-06-01 15:46) [15]Fragoria - absolutely NEW MMORPG with amazing quality of graphics and deep world structure developed with new technology.
Кулхацкеров развелось. Уже пишут...
← →
sotrudnik1 (2009-06-01 15:46) [16]PostMessage (Hnd, WM_CHAR, INT("v");
PostMessage (Hnd, WM_CHAR, CHAR("v");
как сделать-то???
← →
sotrudnik1 (2009-06-01 15:48) [17]
> Fragoria - absolutely NEW MMORPG with amazing quality of
> graphics and deep world structure developed with new technology.
>
>
> Кулхацкеров развелось. Уже пишут...
что за бред??? просто в свернутом окне хочется касты кидать и при этом работать в другом софте...
← →
Игорь Шевченко © (2009-06-01 16:34) [18]
> как сделать-то???
как в справке написано
← →
sotrudnik1 (2009-06-01 17:28) [19]
> Игорь Шевченко © (01.06.09 16:34) [18]
буду очень признателен если поможете разобраться...
← →
sotrudnik1 (2009-06-01 17:31) [20]The PostMessage function places (posts) a message in the message queue associated with the thread that created the specified window and then returns without waiting for the thread to process the message. Messages in a message queue are retrieved by calls to the GetMessage or PeekMessage function.
BOOL PostMessage(
HWND hWnd, // handle of destination window
UINT Msg, // message to post
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);
Parameters
hWnd
Identifies the window whose window procedure is to receive the message. Two values have special meanings:
Value Meaning
HWND_BROADCAST The message is posted to all top-level windows in the system, including disabled or invisible unowned windows, overlapped windows, and pop-up windows. The message is not posted to child windows.
NULL The function behaves like a call to PostThreadMessage with the dwThreadId parameter set to the identifier of the current thread.
Msg
Specifies the message to be posted.
wParam
Specifies additional message-specific information.
lParam
Specifies additional message-specific information.
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Remarks
Applications that need to communicate using HWND_BROADCAST should use the RegisterWindowMessage function to obtain a unique message for inter-application communication.
If you send a message in the range below WM_USER to the asynchronous message functions (PostMessage, SendNotifyMessage, and SendMessageCallback), make sure that the message parameters do not include pointers. Otherwise, the functions will return before the receiving thread has had a chance to process the message and the sender will free the memory before it is used.
See Also
GetMessage, PeekMessage, SendMessageCallback, SendNotifyMessage
← →
sotrudnik1 (2009-06-01 17:32) [21]вот и все что мне пишет в справке... и ни одного примера!!! что так сложно подсказать???
← →
clickmaker © (2009-06-01 17:42) [22]http://www.google.ru/search?hl=ru&newwindow=1&q=postmessage+wm_char&btnG=%D0%9F%D0%BE%D0%B8%D1%81%D0%BA&lr=&aq=f&oq=
← →
Andy BitOff © (2009-06-01 23:31) [23]> sotrudnik1 (01.06.09 17:32) [21]
Меня убивает твоя твердая уверянность в том, что тебе ОБЯЗАНЫ помочь, хотя сам ты для решения проблемы не собираешься напрягаться.
← →
@!!ex © (2009-06-01 23:33) [24]> [20] sotrudnik1 (01.06.09 17:31)
Тут ВСЕ написано. Информации более чем достаточно для того, чтобы понять как, куда и что передавать.
ord еще вспомните, если не знаете.
← →
turbouser © (2009-06-02 00:13) [25]
> sotrudnik1 (01.06.09 17:32) [21]
Было бы не сложно подсказать, будь это для чего-то полезного.. а так.. самообразование рулит :)
← →
sotrudnik1 (2009-06-02 18:53) [26]windows.SetForegroundWindow(Hnd);
PostMessage(Hnd, WM_KEYDOWN, "x", 0);
ну почему???? почему несовместимость типов????
← →
Игорь Шевченко © (2009-06-02 18:57) [27]
> ну почему????
в посте [20] написано, что тип никак не Char, а
> WPARAM wParam, // first message parameter
Тебе тут подсказали слово Ord зачем-то.
← →
sotrudnik1 (2009-06-02 19:10) [28]windows.SetForegroundWindow(Hnd);
PostMessage(Hnd, WM_KEYDOWN, ord("x"), 0);
и ноль эмоций... мало того что свернутое окно разворачивает, дак еще и значение не отправляет((((
← →
sotrudnik1 (2009-06-02 19:36) [29]
> Игорь Шевченко © (02.06.09 18:57) [27]
стучусь к Вам в аську за помощью... заранее спасибо за понимание...
← →
Andy BitOff © (2009-06-02 20:51) [30]> стучусь к Вам в аську за помощью...
Всё, доигрался Игорь =)))
← →
Игорь Шевченко © (2009-06-02 21:05) [31]Обещанный пример:
Есть приложение, которое реагирует на комбинацию Alt+C (конкретно закрывается). Вот его форма:object Form1: TForm1
Left = 0
Top = 0
Caption = "Form1"
ClientHeight = 286
ClientWidth = 426
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = "Tahoma"
Font.Style = []
Menu = MainMenu1
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object ActionList1: TActionList
Left = 32
Top = 36
object Action1: TAction
Caption = "&Close"
OnExecute = Action1Execute
end
end
object MainMenu1: TMainMenu
Left = 72
Top = 40
object Close1: TMenuItem
Action = Action1
end
end
end
И код:unit main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ActnList, Menus;
type
TForm1 = class(TForm)
ActionList1: TActionList;
Action1: TAction;
MainMenu1: TMainMenu;
Close1: TMenuItem;
procedure Action1Execute(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Action1Execute(Sender: TObject);
begin
Close;
end;
end.
Есть приложение, которое его убивает путем имитации нажатия комбинации клавиш Alt+Cunit KillerApp;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TtfKiller = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
end;
var
tfKiller: TtfKiller;
implementation
{$R *.dfm}
procedure TtfKiller.Button1Click(Sender: TObject);
var
Victim: HWND;
begin
Victim := FindWindow("TForm1", "Form1");
if IsWindow(Victim) then
begin
SetForegroundWindow(Victim);
keybd_event(VK_MENU, 0, 0, 0);
keybd_event(Ord("C"), 0, 0, 0);
keybd_event(Ord("C"), 0, KEYEVENTF_KEYUP, 0);
keybd_event(VK_MENU, 0, 0, KEYEVENTF_KEYUP);
end;
end;
end.
Причем, вполне реально убивает.
Дальнейшие действия состоят в подборе вариантов клавиш, необходимых для получения желаемого эффекта.
← →
@!!ex © (2009-06-02 21:10) [32]> [30] Andy BitOff © (02.06.09 20:51)
> Всё, доигрался Игорь =)))
Ко мне тоже стучался. Читер.
← →
sotrudnik1 (2009-06-02 21:24) [33]Удалено модератором
Страницы: 1 вся ветка
Форум: "Начинающим";
Текущий архив: 2009.07.26;
Скачать: [xml.tar.bz2];
Память: 0.53 MB
Время: 0.007 c