🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
10 messages
10 total messages Started by Laurent ESTIVAL Mon, 10 Dec 2007 18:29
Hook
#858
Author: Laurent ESTIVAL
Date: Mon, 10 Dec 2007 18:29
7 lines
985 bytes
Hi,

I want to intercept keyboard, mouse and paint event from computer. I try a 
small project with "hook". Is there any others methods ? Is there any 
examples somewhere for hooks ?

Thx 
Re: Hook
#859
Author: Remy Lebeau (TeamB)
Date: Mon, 10 Dec 2007 20:55
10 lines
1134 bytes
"Laurent ESTIVAL" <devleen@Libertysurf.fr> wrote in message 
news:475d84cf$1@newsgroups.borland.com...

> I want to intercept keyboard, mouse and paint event from computer.

What exactly are you trying to accomplish?


Gambit 
Re: Hook
#911
Author: devl
Date: Wed, 12 Dec 2007 18:52
18 lines
1415 bytes
I want to capture screen, keys and mouse move and clicks in my and other 
applications.
So, filling a log file.
Thx

"Remy Lebeau (TeamB)" <no.spam@no.spam.com> a �crit dans le message de news: 
475da9e2@newsgroups.borland.com...
>
> "Laurent ESTIVAL" <devleen@Libertysurf.fr> wrote in message 
> news:475d84cf$1@newsgroups.borland.com...
>
>> I want to intercept keyboard, mouse and paint event from computer.
>
> What exactly are you trying to accomplish?
>
>
> Gambit
> 
Re: Hook
#912
Author: Remy Lebeau (TeamB)
Date: Wed, 12 Dec 2007 20:26
15 lines
1650 bytes
"devl" <devleen@Libertysurf.fr> wrote in message 
news:47602d0f$1@newsgroups.borland.com...

> I want to capture screen, keys and mouse move and clicks
> in my and other applications.

Look at SetWindowsHookEx().  You can use WH_MOUSE, WH_KEYBOARD, and 
WH_GETMESSAGE/WH_CALLWNDPROC for that.  You will have to implement your hook 
procedures inside a DLL in order to hook other applications, though.  Go to 
http://www.deja.com and search the newsgroup archives, as examples have been 
posted many times before.


Gambit 
Re: Hook
#930
Author: devl
Date: Fri, 21 Dec 2007 21:29
27 lines
1993 bytes
Hi,
Thanks, I've already try with this messages. But it doesn't work fine. It 
crash after a moment or other problem like mouse message are not captured 
when mouse is not in my window.
http://deja.com ??? Don't works ? Could you give me another site or example 
?



"Remy Lebeau (TeamB)" <no.spam@no.spam.com> a �crit dans le message de news: 
47604449$1@newsgroups.borland.com...
>
> "devl" <devleen@Libertysurf.fr> wrote in message 
> news:47602d0f$1@newsgroups.borland.com...
>
>> I want to capture screen, keys and mouse move and clicks
>> in my and other applications.
>
> Look at SetWindowsHookEx().  You can use WH_MOUSE, WH_KEYBOARD, and 
> WH_GETMESSAGE/WH_CALLWNDPROC for that.  You will have to implement your 
> hook procedures inside a DLL in order to hook other applications, though. 
> Go to http://www.deja.com and search the newsgroup archives, as examples 
> have been posted many times before.
>
>
> Gambit
> 
Re: Hook
#931
Author: Remy Lebeau (TeamB)
Date: Fri, 21 Dec 2007 21:49
21 lines
1685 bytes
"devl" <devleen@Libertysurf.fr> wrote in message 
news:476c2f5d$1@newsgroups.borland.com...

> Thanks, I've already try with this messages. But it doesn't work fine.
> It crash after a moment

Then your code is likely buggy.  Such hooks are very low-level and very 
sensitive.  Even the slightest error in your code could blow them up badly.

> other problem like mouse message are not captured when
> mouse is not in my window.

Then you did not install the hook globally properly.

> http://deja.com ??? Don't works ?

Works fine for me.


Gambit 
Re: Hook
#940
Author: Dennis Jones
Date: Sun, 30 Dec 2007 03:08
29 lines
2003 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message 
news:476c36ab$1@newsgroups.borland.com...
>
> "devl" <devleen@Libertysurf.fr> wrote in message 
> news:476c2f5d$1@newsgroups.borland.com...
>
>> Thanks, I've already try with this messages. But it doesn't work fine.
>> It crash after a moment
>
> Then your code is likely buggy.  Such hooks are very low-level and very 
> sensitive.  Even the slightest error in your code could blow them up 
> badly.
>
>> other problem like mouse message are not captured when
>> mouse is not in my window.
>
> Then you did not install the hook globally properly.
>
>> http://deja.com ??? Don't works ?
>
> Works fine for me.

The deja link redirects to: http://groups.google.com/.

If that is expected, then it works.  If it is not expected, then it does not 
work.  You expected it, but the OP didn't.

- Dennis 
Re: Hook
#943
Author: Remy Lebeau (TeamB)
Date: Mon, 31 Dec 2007 06:06
35 lines
2170 bytes
"Dennis Jones" <nospam@nospam.com> wrote in message
news:47770bc7$1@newsgroups.borland.com...
>
> "Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
> news:476c36ab$1@newsgroups.borland.com...
> >
> > "devl" <devleen@Libertysurf.fr> wrote in message
> > news:476c2f5d$1@newsgroups.borland.com...
> >
> >> Thanks, I've already try with this messages. But it doesn't work fine.
> >> It crash after a moment
> >
> > Then your code is likely buggy.  Such hooks are very low-level and very
> > sensitive.  Even the slightest error in your code could blow them up
> > badly.
> >
> >> other problem like mouse message are not captured when
> >> mouse is not in my window.
> >
> > Then you did not install the hook globally properly.
> >
> >> http://deja.com ??? Don't works ?
> >
> > Works fine for me.
>
> The deja link redirects to: http://groups.google.com/.
>
> If that is expected, then it works.  If it is not expected, then it does
not
> work.  You expected it, but the OP didn't.
>
> - Dennis
>
>
Re: Hook
#944
Author: Remy Lebeau (TeamB)
Date: Mon, 31 Dec 2007 06:07
11 lines
1443 bytes
"Dennis Jones" <nospam@nospam.com> wrote in message
news:47770bc7$1@newsgroups.borland.com...

> The deja link redirects to: http://groups.google.com/.

That is what it is supposed to do.  Google owns Deja.  The actual archive
and search engine work fine regardless of which URL you use, though.


Gambit
Re: Hook
#691
Author: Luka Gabri�
Date: Sat, 23 Feb 2008 22:44
38 lines
2357 bytes
I've compiled a keyhook applicaton. DLL sends keys pressed to APP using:

LRESULT CALLBACK KeyHookProc(int nCode, WPARAM wParam, LPARAM lParam)
{
 if (nCode<0 || (lParam & 0x80000000) || (lParam & 0x40000000) )
  return CallNextHookEx(KeyHook, nCode, wParam, lParam);

 PostMessage(HWND_BROADCAST, MY_CUSTOM_MESSAGE, wParam, lParam);

 return CallNextHookEx(KeyHook, nCode, wParam, lParam);
}

This is how I get the posted message:

_fastcall TForm2::TForm2(TComponent* Owner) : TForm(Owner)
{
MY_CUSTOM_MESSAGE = NULL;
 FCustomMessage = "MyMessage";
 MY_CUSTOM_MESSAGE = ::RegisterWindowMessage( FCustomMessage.c_str() );
 Application->OnMessage = AppMessage;
}

void __fastcall TForm2::AppMessage( TMsg &Msg, bool &Handled )
{
 if( (Msg.message == MY_CUSTOM_MESSAGE) && (MY_CUSTOM_MESSAGE != 0) )
 {
   Handled = true;
   Label1->Caption = "wParam: " + IntToStr(Msg.wParam);
   Label2->Caption = "lParam: " + IntToStr(Msg.lParam);
   Form2->Show();
 }
}

Everything works fine when my APP is hidden or Form is not in focus, but 
when i try to press a key on my form, in edit box or anywhere, the APP 
freezes. Why is that?

Luka 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads