www.xbdev.net
xbdev - software development
Friday April 19, 2024
home | contact | Support | Win32.. Using our Windows API's... | Win32.. Using our Windows API's...

     
 

Win32..

Using our Windows API's...

 

Start Button (Windows)

 

 

With a few simple lines of code you can do some great things with windows, one of them is change your start button.  This simple demo shows you how to repaint the Start Buttons window....yup that little button in the bottom left of the screen is a start button.

 

 

DownloadSourceCode

 

If you run the demo code, and click the left mouse button in the program window it will change your start button from 'Start' to an alternative image as show on the right.  Don't worry, its only temporary...as if you click on your start button it will change back.

 

Its a nice effect and shows you how you can easily grad the handle for almost any window and draw to it.  You could modify the code to display an animation to the start button... its upto you.

 

Below shows the snippet of code that does all the work.

 

....

            //Get the handld to the Start Button

            hStart = GetWindow(FindWindow("Shell_TrayWnd",""),GW_CHILD);

            //or use instead

            //hStart = FindWindowEx(FindWindowEx(NULL,NULL,"Shell_TrayWnd",""),NULL,"Button","");

           

            //Get the DC for the window, so we can draw on it ;)

            hdc = GetDC(hStart);

           

           

            //Repaint the Start window for a second...until the mosue moves ;)

            //Find out how big the start button is ;)

            GetClientRect(hStart,&rect);

           

            memdc = ::CreateCompatibleDC(GetDC(hwnd));

            hBitmap = (HBITMAP)::LoadImage(NULL,"button.bmp",IMAGE_BITMAP,0,0,

                                                LR_LOADFROMFILE);

            SelectObject(memdc,hBitmap);

            BitBlt(hdc,0,0,rect.right,rect.bottom,

                                    memdc,0,0,SRCCOPY);

           

           

            ReleaseDC(hwnd,memdc);     

            ReleaseDC(hStart,hdc);

....

 

 

 

 

 
Advert (Support Website)

 
 Visitor:
Copyright (c) 2002-2024 xbdev.net - All rights reserved.
Designated articles, tutorials and software are the property of their respective owners.