Armenian Knowledge Base  

Go Back   Armenian Knowledge Base > Technical sections > Languages, Compilers, Interpreters
Register

Reply
 
LinkBack Thread Tools
Old 12.02.2002, 18:55   #1
Студент
 
Join Date: 01 2002
Location: Yerevan, Armenia
Age: 37
Posts: 282
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Question Generate click of mouse at the specified point ???

hi All

i want to generate mouse click at the specified point in the window, but i don't know exactly on which contol i'm clicking.

i mean i don't know is it a button or panel, or menu items. i only know window's handle, clicked point and that's all.


waiting for U, Great All <img src="smooch-1.gif" border="0">
__________________
Сколько времени и сил должен потратить мужчина,
Чтобы воспользоваться минутной слабостью женщины
Reply With Quote
Old 12.02.2002, 19:27   #2
Младенец
 
Join Date: 10 2001
Location: Yerevan
Posts: 55
Downloads: 7
Uploads: 0
Reputation: 8 | 0
Post

es lav chgitem c/c++, bayc kporcem qez tetev orinak cuyc tal te inchpes stanal cankacac pahin mouse-i taki exac objekti handle(classname ev windowpoc)-@...

MOUSEHOOK_:MOUSEHOOKSTRUCT
WM_MOUSEHOOK=WM_USER+6
hHook,handle <img src="biggrin2.gif" border="0"> WORD;

procedure MouseHook(nCode,wParam,lParam);
begin
CallNextHookEx(hHook,nCode,wParam,lParam);
handle:=WindowFromPoint(MOUSEHOOK_.pt.x,MOUSEHOOK_.pt.y);
PostMessage(hWnd,WM_MOUSEHOOK,handle,0);
procedure InstallHook (hwnd <img src="biggrin2.gif" border="0"> WORD);
begin
hHook:=SetWindowsHookEx(WH_MOUSE,addr MouseProc, hInstance, NULL);
end;

procedure UninstallHook;
begin
UnhookWindowsHookEx(hHook);
end;

classname ev windowproc-@ karox es gtnel
GetClassName, GetClassLong funkcianerov <img src="smooch-1.gif" border="0">
husov em orinak@ qez kogni...
__________________
http://freenet.am/~softland
Reply With Quote
Old 12.02.2002, 19:52   #3
Студент
 
Join Date: 01 2002
Location: Yerevan, Armenia
Age: 37
Posts: 282
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Post

thx for reply. i know about hooks.

but in my case, i have to do another thing, i don't want to know on which contol, i'm clicking on. i want only one thing, to generate a click and want the window to handle that message, ok.

the purpose is to do something like this;
send to the window or system such message

SendMessage(hWnd, WM_/**, POINT clickedPoint,...,.. );

, but this function wants to the contol which i haven't, had don't want to know <img src="smooch-1.gif" border="0">

the window have to handle this message.

Talex
Reply With Quote
Old 13.02.2002, 14:20   #4
Академик
 
greka's Avatar
 
Join Date: 09 2001
Location: inside myself
Posts: 5,369
Downloads: 0
Uploads: 0
Reputation: 18 | 5
Post

hi, Talex.
Please clarify your question - it's not evident for me:

Talex, post#1:
i want to generate mouse click at the specified point in the window, but i don't know exactly on which contol i'm clicking.
i mean i don't know is it a button or panel, or menu items. i only know window's handle, clicked point and that's all.


Talex, post#2:
...
i don't want to know on which contol, i'm clicking on. i want only one thing, to generate a click and want the window to handle that message, ok.
..

Actually the "button" control is a window, too.

I think that was a reason why OS called "Windows"
Though, "Buttons 2000" name seems to be funny.
<img src="wink-5.gif" border="0">
__________________
И повешенные могут качаться в неположенную сторону. /С.Е.Лец/
Reply With Quote
Old 13.02.2002, 17:57   #5
The Reloaded
 
Aram Hambardzumyan's Avatar
 
Join Date: 01 2002
Location: behind the flesh and gelatinе of soft dull eyes
Posts: 3,387
Downloads: 4
Uploads: 0
Reputation: 146 | 4
Post

<blockquote><font size="1" face="MS Sans Serif, Verdana, Helvetica, sans-serif">quote:</font><hr>Originally posted by Talex:

i want to generate mouse click at the specified point in the window, but i don't know exactly on which contol i'm clicking.

i mean i don't know is it a button or panel, or menu items. i only know window's handle, clicked point and that's all.
<hr></blockquote>

just send a message to it: SendMessage(...) (see parameters in msdn, first one is the window handle you send msg to, others for mouse click are: WM_LBUTTONDOWN or smth. like that, click point and some flags)
Reply With Quote
Old 13.02.2002, 23:00   #6
Студент
 
Join Date: 01 2002
Location: Yerevan, Armenia
Age: 37
Posts: 282
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Post

Poyasnyayu:

est' handle glavnogo okna prilozheniya, i escho spisok tochek(list of POINTs).

Pust' prilozhenie obrabotaet "isskustvennio" sozdannie clicki ili double clicki v dannix tochkax ekrana esli ezvesten handle tolko glavnogo okna prilozheniya.

t.e. neodxodimo sozdat' v systeme "isskustvenno" clicki, t.e. soobscheniya sgenerirovannie ne userom, a programmno.

Vopros v tom chto kak sozdat' takie clicki???

esli ne ponyatno mogu snova skazat'.

//////////////
ne pomogaet SendMessage s dannimi parametrami

POINT lp = {100, 200};

::SendMessage(hwndBtn, WM_LBUTTONDOWN, MK_LBUTTON, lp);
::SendMessage(hwndBtn, WM_LBUTTONUP, MK_LBUTTON, lp);

navernoe nuzhno chto to vrode

LPARAM commLP = MAKELPARAM( ID_Of_Control , BN_CLICKED);
WPARAM commWP = MAKEWPARAM(handleOfControl);

::SendMessage(main_hWnd, WM_COMMAND, commLP , commWP);


thx.
Reply With Quote
Old 14.02.2002, 15:06   #7
Академик
 
greka's Avatar
 
Join Date: 09 2001
Location: inside myself
Posts: 5,369
Downloads: 0
Uploads: 0
Reputation: 18 | 5
Wink

kratkost' - sestra talanta:

HANDLE hw, parentHW;
hw = HANDLE_OF_SOME_CHILD_WINDOW;
while (1)
{
parentHW = hw;
hw = ::GetParent( hw );
if ( !hw )
break;
}
::SendMessage( parentHW, WM_LBUTTONDOWN, 0, 0);

pojasnju kod:
1. ishesh' predka dannogo kontrolja
2. posylaesh' ego...emu.. nu v obshem sam razbirajsja.

<img src="smooch-1.gif" border="0">
Reply With Quote
Old 15.02.2002, 01:33   #8
Студент
 
Join Date: 01 2002
Location: Yerevan, Armenia
Age: 37
Posts: 282
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Post

pipl ya mashel, sam! <img src="smooch-1.gif" border="0">

mouse_event() - i vi polzuites' na zdorov'e <img src="smooch-1.gif" border="0">
Reply With Quote
Old 16.02.2002, 17:39   #9
Академик
 
greka's Avatar
 
Join Date: 09 2001
Location: inside myself
Posts: 5,369
Downloads: 0
Uploads: 0
Reputation: 18 | 5
Wink

dobavlju, chto:
Windows NT/2000 (or later): This function has been superseded. Use SendInput instead.

preimushestvo etoj funkcii v tom, chto pozvoljaet sozdavat' POTOK EVENT-ov.

v rekomendacii M$ govoritsa, chto novaja funkcija pozvoljaet sozdavat' event-y ne narushaja ocherednosti eventov (mouse and kb) v sisteme, kak eto delaet mouse_event.

Eto znachit, chto esli ran'she user mog najimat' klavishi v to je samoe vremja, kak vyzyvaetsa mouse_event, i eto privodilo by k rezkim skachkam (naprimer) kursora, to teper' vse budet imenno tak, kak i zadumal programmer. Blagodarja vyzovu SendInput budet obrabatyvat'sja POSLEDOVATEL'NOST' event-ov.
<img src="wink-5.gif" border="0">
b/r
Reply With Quote
Old 16.02.2002, 23:30   #10
Студент
 
Join Date: 01 2002
Location: Yerevan, Armenia
Age: 37
Posts: 282
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Post

Da ya sperva vishen na SendInput(), a potom tolko na mouse_event(). Prosto SentInput() u menya ne zarabotal <img src="sad-2.gif" border="0">

So strukturoi INPUT tozhe problemi kompilyator vidaet takie oshibki....

error C2065: 'INPUT' : undeclared identifier

error C2039: 'SendInput' : is not a member of '`global namespace''


?????
Reply With Quote
Old 17.02.2002, 01:11   #11
Moderator
 
acid's Avatar
 
Join Date: 09 2001
Location: South Korea, Gumi
Posts: 7,699
Downloads: 102
Uploads: 34
Blog Entries: 16
Reputation: 561 | 6
Post

I think you have to install Platform SDK first to use it.
Reply With Quote
Old 18.02.2002, 23:46   #12
Студент
 
Join Date: 01 2002
Location: Yerevan, Armenia
Age: 37
Posts: 282
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Post

2 acid:

razve SDK ne insatlliruetsya vmeste c MSDN i VC. togda kak? Na kakom diske Visual Studio naxoditsya Platform SDK ?

thx
Reply With Quote
Old 19.02.2002, 01:18   #13
Moderator
 
acid's Avatar
 
Join Date: 09 2001
Location: South Korea, Gumi
Posts: 7,699
Downloads: 102
Uploads: 34
Blog Entries: 16
Reputation: 561 | 6
Post

MS Platform SDK installiruetsja s Visual Studio no on ochen' staryi. Est' mnogo veshei kotorye prishli s novym SDK - Microsoft Platform SDK, February 2001 Edition.

Dumau mozhesh ego skachat' s Microsoftovskogo FTP.
Reply With Quote
Old 19.02.2002, 01:27   #14
Студент
 
Join Date: 01 2002
Location: Yerevan, Armenia
Age: 37
Posts: 282
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Post

thx acid:

a na diskax VS 2000 netu???
traffic hzalko <img src="smooch-1.gif" border="0"> ili na .Net-e netu. u menya poslednii .Net est'?

thx
Reply With Quote
Old 19.02.2002, 01:34   #15
Moderator
 
acid's Avatar
 
Join Date: 09 2001
Location: South Korea, Gumi
Posts: 7,699
Downloads: 102
Uploads: 34
Blog Entries: 16
Reputation: 561 | 6
Post

dumau na .NET budet, ne zrja zhe 7 diskov vpixnuli v paket.

A voobshe sovetuu na 100% byt' uverenym chto ty nichego ne propustil kogda ispol'zoval etu funkciu, mozhet okazatsja chto prichina ne v otsutsvii SDK <img src="smooch-1.gif" border="0">

Esli xochesh prishli project posmotru.
Reply With Quote
Sponsored Links
Reply

Thread Tools


На правах рекламы:
реклама

All times are GMT. The time now is 22:48.


Powered by vBulletin® Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.