Solved

Get a Newly Created Forms Info (Globally

Posted on 2001-08-17
4
212 Views
Last Modified: 2010-04-06
Can Any 1 help me To get the attributes of a newly created form.  This form can be created by anything such as the drive contents or media player ETC...

I need to be able to get the The Forms ID and enough attributes for me to change the newly created forms caption bar.

I have Some idea on how to do it from articles but they are not clear.  i think the way to go about this is the windows messaging using the SetWindowsHookEx method.

Can Sopme 1 plz help me!!
0
Comment
Question by:C49
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 1

Accepted Solution

by:
sundayboys earned 150 total points
ID: 6399527
{
If you want to change caption of other runnung application try this command , It works well.
(I GIVE YOU AN EXAMPLE FOR NOTEPAD PROGRAM , YOU CAN CHANGE IT)
}

procedure TForm1.Button1Click(Sender: TObject);
begin
  SetWindowText(FindWindow('notepad',nil),'Test');
end;


//or:

SendMessage(FindWindow('notepad',nil), WM_settext, 0, Integer(PChar('test')));
0
 

Author Comment

by:C49
ID: 6400079
Yeah Dats Great! :) but i need it to do that when any programme automatically runs.

0
 
LVL 5

Assisted Solution

by:alanwhincup
alanwhincup earned 150 total points
ID: 6400640
I would do it like this:

function GetWindows(Handle : hWnd; LParam : LParam) : Boolean; stdcall;
begin
  SendMessage(Handle, WM_SETTEXT, 300, LongInt(TForm(LParam).Caption));
  Result := True;
end;

function SetWindowText(Handle : hWnd; LParam : LParam) : Boolean; stdcall;
begin
  SendMessage(Handle, WM_COMMAND, $A065, 0);
  Result := True;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  EnumWindows(@GetWindows, LParam(Edit1.Text));
end;

All you have to do is set the timers interval to 100 or something suitable and then type the text you want to appear on the title bars in the edit box.

Cheers,

Alan
0
 
LVL 17

Expert Comment

by:geobul
ID: 9286256
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

split points between sundayboys and alanwhincup

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Thanks,

geobul
EE Cleanup Volunteer
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

739 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