Jul 25, 2008

Delphi Tutorial - Change Your Start Button Caption

Free Web Hosting, No Ads > CONTRIBUTE > Tutorials

free web hosting

Delphi Tutorial - Change Your Start Button Caption

bureX
How to change your start button caption using Delphi!

(By the way, the start button will be renamed back to "start" after you restart your computer)

Here we go!

1. Create a new project in Delphi

2. Add a Button and an Edit box to your form, place them where you want.

3. Double click the button to enter the code editor so we can type code for our OnClick event.

4. The code for the OnClick event of our button should look like this:

CODE

procedure TForm1.Button1Click(Sender: TObject);
var Handle1,Handle2:hwnd;
begin
Handle1:=FindWindow('Shell_TrayWnd',nil); //get the handle of the taskbar
Handle2:=FindWindowEx(Handle1,0,'Button',nil); //get the handle of the start button from the taskbar
SetWindowText(Handle2,PAnsiChar(Edit1.Text)); //set the text
SendMessage(Handle2,Messages.WM_MOUSEMOVE,0,0); //used to refresh the caption of the start button
end;


5. Alright, run the program (F9) and enjoy!

The finished program should look something like this:

user posted image

Just type a new caption in the text box and click on the button.

Piece of cake!

 

 

 


Reply

lordofthecynics
QUOTE(bureX @ Feb 14 2005, 04:02 PM)
How to change your start button caption using Delphi!

(By the way, the start button will be renamed back to "start" after you restart your computer)

Here we go!

1. Create a new project in Delphi

2. Add a Button and an Edit box to your form, place them where you want.

3. Double click the button to enter the code editor so we can type code for our OnClick event.

4. The code for the OnClick event of our button should look like this:

CODE

procedure TForm1.Button1Click(Sender: TObject);
var Handle1,Handle2:hwnd;
begin
Handle1:=FindWindow('Shell_TrayWnd',nil); //get the handle of the taskbar
Handle2:=FindWindowEx(Handle1,0,'Button',nil); //get the handle of the start button from the taskbar
SetWindowText(Handle2,PAnsiChar(Edit1.Text)); //set the text
SendMessage(Handle2,Messages.WM_MOUSEMOVE,0,0); //used to refresh the caption of the start button
end;


5. Alright, run the program (F9) and enjoy!

The finished program should look something like this:

user posted image

Just type a new caption in the text box and click on the button.

Piece of cake!
*




What is Delphi, where can I get it, and what is the point of changing the start button name?

 

 

 


Reply

bureX
Delphi is a programming environment that uses Object Pascal as it's main language.

You can get a trial version at www.borland.com.

The point?
This tutorial shows the power of handles. Using Delphi, you can quickly gain a handle of any window/subwindow and resize it, change it's caption, make it transparent, move it around...

Changing the start button caption is just an example of using handles. With handles, you can give your program the ability to react on any system event that you have gained a handle over. For example, if a user presses a key combination ALT+F1, your program will know about it and react the way you want it to. You can also get a device handle, and let your program be notified if a user connects/disconnects an USB device, etc.

Reply

lordofthecynics
QUOTE(bureX @ Feb 15 2005, 06:45 AM)
Delphi is a programming environment that uses Object Pascal as it's main language.

You can get a trial version at www.borland.com.

The point?
This tutorial shows the power of handles. Using Delphi, you can quickly gain a handle of any window/subwindow and resize it, change it's caption, make it transparent, move it around...

Changing the start button caption is just an example of using handles. With handles, you can give your program the ability to react on any system event that you have gained a handle over. For example, if a user presses a key combination ALT+F1, your program will know about it and react the way you want it to. You can also get a device handle, and let your program be notified if a user connects/disconnects an USB device, etc.
*


Oh, ok. I'm not too familiar with programming languages. I had a hard time with JavaScript and CSS as it was, though HTML is somewhat easy for me.

Reply

iGuest
Dynamic debugging
Delphi Tutorial - Change Your Start Button Caption

Using Delphi 7-2007, I would like to know if there is a way to get dynamically the name of the current unite and function/procedure.

Example: Including the name of the unit and function/procedure where an exception raised.

This can be very helpful to locate post production bugs.


-question by Sale AHMAD

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Recent Queries:-
  1. how to create a button caption in delphi - 3.65 hr back. (2)
  2. delphi get caption height - 5.29 hr back. (1)
  3. "start button caption" - 6.22 hr back. (1)
  4. borland delphi tutorial - 13.77 hr back. (1)
  5. delphi get button handle - 27.23 hr back. (1)
  6. delphi get button from handle - 27.71 hr back. (1)
  7. delphi create dynamic button - 29.59 hr back. (1)
  8. textarea in delphi - 29.66 hr back. (1)
  9. button caption - 30.87 hr back. (1)
  10. change the start button - 32.56 hr back. (1)
  11. delphi get component handle findwindow - 38.11 hr back. (1)
  12. delphi taskbar caption - 42.45 hr back. (1)
  13. what is a handle delphi pascal - 44.21 hr back. (1)
Similar Topics

Keywords : delphi, change, start, button, caption

  1. Download Files Off Esnips.com
    even now that the download button is gone! (0)
  2. Button Rotations!
    (0)
    You know when you refresh a page and an image changes? Well it's called a rotation. Here's
    how to do it: QUOTE <script LANGUAGE="JavaScript"> <!-- Begin var how_many_ads = 2;
    var now = new Date() var sec = now.getSeconds() var ad = sec % how_many_ads; ad +=1; if (ad==1) {
    url="http://domain.org"; alt="Domain Name"; banner="http://buttonURL.com"; width="88"; height="31";
    } if (ad==2) { url="http://domain.org/"; alt="Domain Name"; banner="http://buttonURL.com";
    width="88"; height="31"; } document.write(' '); document.write(' document....
  3. Formating Your Form "textarea" And "submit" Button
    if you are fed up with default settings (0)
    This is gonna be short tutorial about formating textarea and submit button in forms. This is code
    for textarea: CODE <p class="inputs">Comment: * </p> <div
    class="besedilo"><textarea name="comments" cols="35"
    rows="5" style="border:1px solid #cccccc; background:#EDF4ED;"
    onfocus="style.borderColor='#999999', style.background='#ffffff';"
    onblur="style.borderColor='#cccccc',
    style.background='#EDF4ED';"></textarea></d....
  4. Simple Parsing Functions
    [Delphi] Tutorial (0)
    Because parsing is such an integral part of string manipulation, I took the time to make a quick and
    simple parse function. For you VBers, Delphi is a derivative of Pascal...it's powerful, simple,
    and (best of all) doesn't need external components (eg: ocx files). Hence the code: CODE
    function TForm1.SimpleParse(MainString, BeginString, EndString: string): string;
    var PosBeginString: integer; PosEndString: integer; begin PosBeginString :=
    Pos(BeginString, MainString) + Length(BeginString); PosEndString ....
  5. Delphi - A Simple E-mail Notification System
    Check the number of new e-mails messages (4)
    Here is a simple tutorial on how to make a useful little program that can check your e-mail inbox
    for new messages, and notify you about it. If you save the finished EXE file on your hard disk, you
    can also configure windows to start it automatically when windows is loaded, and get notified when
    your inbox is checked for new messages. Here is a checklist on what you need: -Borland Delphi
    -Installed Indy components (these are automatically installed if you are using Delphi 6 or Delphi 7)
    Onward! Create a new project in Delphi. Select the Indy “IdPop3” component f....
  6. [tutorial] Delphi
    Multi-Parsing Function (0)
    I've spent a while trying to create parsing function with Delphi. This language is very useful.
    This tutorial explains how to parse multiple instances of an item in one string. Here is the
    function (which I am actually very proud of): Code: function TForm1.MultiParse(MainString,
    BeginString, EndString: string): TStrings; var PosBeginString, PosEndString, i, LastPos: integer;
    tmpCopy: string; tmpStrings: TStrings; begin tmpStrings := TStringList.Create; LastPos := 0;
    for i := 1 to LastDelimiter(EndString, MainString) do begin PosBeginString := Pos....
  7. Delphi
    Simple Text Parsing Function (1)
    Because parsing is such an integral part of string manipulation, I took the time to make a quick and
    simple parse function. For you VBers, Delphi is a derivative of Pascal...it's powerful, simple,
    and (best of all) doesn't need external component (eg: ocx files). Hence the code: Code:
    function TForm1.SimpleParse(MainString, BeginString, EndString: string): string; var PosBeginString:
    integer; PosEndString: integer; begin PosBeginString := Pos(BeginString, MainString) +
    Length(BeginString); PosEndString := Pos(EndString, MainString); Result := Copy(MainString, ....

    1. Looking for delphi, change, start, button, caption

Searching Video's for delphi, change, start, button, caption
advertisement



Delphi Tutorial - Change Your Start Button Caption



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE