Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How do you change the primary mouse button Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
18-Jun-02
Category
System
Language
Delphi 3.x
Views
63
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Kevin Gallagher 

How do you change the primary mouse button

Answer:

To change the primary mouse button in code you need to execute an API function 
called SwapMouseButton. This changes the primary button but does not alert the 
control panel applet for the mouse that the primary button has changed. To do this 
we need to write to the registry. The code below shows how to toggle the primary 
mouse button by first reading the registry to determine the current assignment then 
does the toggle by writing to the registry and executing the SwapMouseButton 
function. 

1   uses Windows, Registry;
2   
3   const
4     LeftButton = '0';
5     RightButton = '1';
6     VaueToRead = 'SwapMouseButtons';
7   begin
8     with TRegistry.Create do
9     begin
10      try
11        if OpenKey('Control Panel\Mouse', False) then
12        begin
13          if ValueExists(VaueToRead) then
14            if ReadString(VaueToRead) = LeftButton then
15            begin
16              SwapMouseButton(True);
17              WriteString(VaueToRead, RightButton);
18            end
19            else
20            begin
21              SwapMouseButton(False);
22              WriteString(VaueToRead, LeftButton);
23            end;
24          CloseKey;
25        end;
26      finally
27        Free;
28      end;
29    end;
30  end.


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC