Solved

I need a help to develop a generic function

Posted on 2006-10-30
2
143 Views
Last Modified: 2010-04-05
Hello guys,

I don't have any ideia how could I develop a procedure/function that could retrieve me the name of my component / form when I click on my mouse (left button) + Ctrl and Alt held.

I have more than 100 forms, and this need to be a way that could works for any forms.


Thanks
0
Comment
Question by:hidrau
2 Comments
 
LVL 15

Accepted Solution

by:
mikelittlewood earned 500 total points
ID: 17834498
Take a look at this code for a small example

http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_21557898.html

or download Eddie Shipmans clone of WinSpy32

http://www.delphipages.com/result.cfm?ID=5330
0
 
LVL 1

Author Comment

by:hidrau
ID: 17840920
Hi,

this is the example that you linked, but how could I work that way that I told you, only when I press the ctrl + shift and left button?

procedure TForm1.Timer1Timer(Sender: TObject);
var
  pt : TPoint;
  wnd : cardinal;
  txt1 : array [0..255] of char;
  txt2 : array [0..255] of char;
begin
// if you use 'controls' unit, then you may use Mouse.CursorPos instead of variable 'pt'
// in that case GetCursorPos() is not necessary
GetCursorPos(pt);
wnd := WindowFromPoint(pt);
GetClassName(wnd, @txt1[0], sizeof(txt1));
GetWindowText(wnd, @txt2[0], sizeof(txt2));
if txt2 = '' then begin // sometimes wm_gettext works when GetWindowText() does not work
  SendMessage(wnd, wm_gettext, sizeof(txt2), integer(@txt2[0]));
end;
label1.Caption := format('handle: %.8x'#13#10'class: %s'#13#10'text: %s', [wnd, txt1, txt2]);
end;


But how can i do to call this without time, only when I hold my

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi application Soap connection 5 120
When i run adoquery my application freezes 26 178
Tidtcpserver listening on multiports? 1 35
enhance the following code 3 37
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question