BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

RegisterHotkey - Parameter Question - VK's Ord() etc.

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.misc
View previous topic :: View next topic  
Author Message
anon
Guest





PostPosted: Fri Jan 30, 2004 4:47 am    Post subject: RegisterHotkey - Parameter Question - VK's Ord() etc. Reply with quote



procedure TForm1.FormCreate(Sender: TObject);
begin
If not RegisterHotkey
(Handle, 1, VK_CONTROL, VK_LBUTTON) Then
ShowMessage('Unable to assign hotkey.') ;
end;

I cannot get the above piece of code to work :(

What I would like is a systemwide hotkey that triggers when Shift is down
and the leftmousebutton is depressed.

This might not be possible using the RegisterHotkey function but I don't
know, maybe someone could help me out?

I could just use an alt+letter key but it would be a pain.


Back to top
Nicholas Sherlock
Guest





PostPosted: Fri Jan 30, 2004 4:53 am    Post subject: Re: RegisterHotkey - Parameter Question - VK's Ord() etc. Reply with quote



anon wrote:
Quote:
procedure TForm1.FormCreate(Sender: TObject);
begin
If not RegisterHotkey
(Handle, 1, VK_CONTROL, VK_LBUTTON) Then
ShowMessage('Unable to assign hotkey.') ;
end;

I cannot get the above piece of code to work :(

What I would like is a systemwide hotkey that triggers when Shift is
down and the leftmousebutton is depressed.

This might not be possible using the RegisterHotkey function but I
don't know, maybe someone could help me out?

Take a closer look at your code and RTM - Then tell me what "VK_Control"
tells Windows you want to respond to.

Btw: What are you using this hot-key for? Do you realize that most times a
user will select multiple text/files etc they will be holding down shift and
left-clicking? Same thing for control. My bet is that Windows has reserved
these hotkeys for itself, since it wouldn't make sense for a user
application to hook them.

Cheers,
Nicholas Sherlock



Back to top
J French
Guest





PostPosted: Fri Jan 30, 2004 8:07 am    Post subject: Re: RegisterHotkey - Parameter Question - VK's Ord() etc. Reply with quote



On Fri, 30 Jan 2004 17:53:29 +1300, "Nicholas Sherlock"
<n_sherlock (AT) hotmail (DOT) com> wrote:

<snip>

Quote:
Take a closer look at your code and RTM - Then tell me what "VK_Control"
tells Windows you want to respond to.

Quite

Quote:

Btw: What are you using this hot-key for? Do you realize that most times a
user will select multiple text/files etc they will be holding down shift and
left-clicking? Same thing for control. My bet is that Windows has reserved
these hotkeys for itself, since it wouldn't make sense for a user
application to hook them.

RegisterHotKey seems pretty powerful ...

It looks like he is writing some sort of document 'snipper'
- for grabbing marked areas from documents

IME this can be happily done using a Timer and pumping in a Ctl V
- or sending a message

Back to top
anon
Guest





PostPosted: Fri Jan 30, 2004 7:37 pm    Post subject: Re: RegisterHotkey - Parameter Question - VK's Ord() etc. Reply with quote

<snip>
Quote:

Take a closer look at your code and RTM - Then tell me what "VK_Control"
tells Windows you want to respond to.

Quite
It says the CTRL key

http://delphi.about.com/library/blvkc.htm
What manual are you refering to?
Quote:

Btw: What are you using this hot-key for? Do you realize that most times
a
user will select multiple text/files etc they will be holding down shift
and
left-clicking? Same thing for control. My bet is that Windows has
reserved
these hotkeys for itself, since it wouldn't make sense for a user
application to hook them.

RegisterHotKey seems pretty powerful ...

It looks like he is writing some sort of document 'snipper'
- for grabbing marked areas from documents

IME this can be happily done using a Timer and pumping in a Ctl V
- or sending a message

I'm just attempting to create an easy to reach hotkey =



Back to top
anon
Guest





PostPosted: Fri Jan 30, 2004 7:39 pm    Post subject: Re: RegisterHotkey - Parameter Question - VK's Ord() etc. Reply with quote

Using RegisterHotKey is it possible to create a one key shortcut? If so
would you please provide a link/example/etc

This is a code snippit:
//In the main forms OnCreate
//handler assign the hotkey:

If not RegisterHotkey
(Handle, 1, MOD_ALT or MOD_SHIFT, VK_F9) Then
ShowMessage('Unable to assign Alt-Shift-F9 as hotkey.') ;

//In the main forms
//OnClose event remove the handler:

UnRegisterHotkey( Handle, 1 ) ;

//Add a handler for the
//WM_HOTKEY message to the form:

private // form declaration
Procedure WMHotkey( Var msg: TWMHotkey ) ;
message WM_HOTKEY;

Procedure TForm1.WMHotkey( Var msg: TWMHotkey ) ;
Begin
If msg.hotkey = 1 Then Begin
If IsIconic( Application.Handle ) Then
Application.Restore;
BringToFront;
End;
End;


Back to top
Rob Kennedy
Guest





PostPosted: Fri Jan 30, 2004 8:21 pm    Post subject: Re: RegisterHotkey - Parameter Question - VK's Ord() etc. Reply with quote

anon wrote:
Quote:
Using RegisterHotKey is it possible to create a one key shortcut? If so
would you please provide a link/example/etc

Pass 0 as the third parameter to RegisterHotKey.

--
Rob

Back to top
AlanGLLoyd
Guest





PostPosted: Fri Jan 30, 2004 8:27 pm    Post subject: Re: RegisterHotkey - Parameter Question - VK's Ord() etc. Reply with quote

In article <HnySb.2883$jH6.99 (AT) newsread1 (DOT) news.atl.earthlink.net>, "anon"
<an@o.n> writes:

Quote:
Take a closer look at your code and RTM - Then tell me what "VK_Control"
tells Windows you want to respond to.

Quite
It says the CTRL key
http://delphi.about.com/library/blvkc.htm
What manual are you refering to?


Look up RegisterHotKey in Win32.hlp

Alan Lloyd
[email]alanglloyd (AT) aol (DOT) com[/email]

Back to top
anon
Guest





PostPosted: Tue Feb 03, 2004 11:51 pm    Post subject: Re: RegisterHotkey - Parameter Question - VK's Ord() etc. Reply with quote

Quote:
Using RegisterHotKey is it possible to create a one key shortcut? If so
would you please provide a link/example/etc

Pass 0 as the third parameter to RegisterHotKey.
^_^ thank you

--
Rob



Back to top
anon
Guest





PostPosted: Sun Feb 15, 2004 2:27 pm    Post subject: Re: RegisterHotkey - Parameter Question - VK's Ord() etc. Reply with quote

Quote:
Take a closer look at your code and RTM - Then tell me what
"VK_Control"
tells Windows you want to respond to.

Quite
It says the CTRL key
http://delphi.about.com/library/blvkc.htm
What manual are you refering to?


Look up RegisterHotKey in Win32.hlp

I've done that -- I usually consult the Delphi help file then I check the
Win32 help file and finally I use google. Sometimes the help files or the
websites (like msdn) use terms that I don't fully understand even after I've
looked them up and its just quicker to post a question on a form.

..hlp file = manual?

man-u-al
n.
1.. A small reference book, especially one giving instructions.
2.. Music. A keyboard, as of an organ or harpsichord, played with the
hands.
3.. A machine operated by hand.
4.. Prescribed movements in the handling of a weapon, especially a rifle:
the manual of arms.
Source: http://dictionary.reference.com/search?q=manual

....and thanks for all the help ^_^ the hotkey works!!

Quote:
Alan Lloyd
[email]alanglloyd (AT) aol (DOT) com[/email]



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.misc All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.