Главная страница | назад

Article #17779: Creating a transparent window.

 Question and Answer Database

FAQ2779C.txt   Creating a transparent window.
Category   :Windows API
Platform    :Win95/NT
Product    :   BC++4.5x   BC++5.x   C++Builder1.0   C++Builder3.x

In VB there is what is called a transparent form.  How do I do this with your tools.

To create a transparent window you can use the Win32 API procedure 
CreateWindowEx.  The pocedure looks like this:
HWND CreateWindowEx(

    DWORD dwExStyle,	// extended window style
    LPCTSTR lpClassName,	// pointer to registered class name
    LPCTSTR lpWindowName,	// pointer to window name
    DWORD dwStyle,	// window style
    int x,	// horizontal position of window
    int y,	// vertical position of window
    int nWidth,	// window width
    int nHeight,	// window height
    HWND hWndParent,	// handle to parent or owner window
    HMENU hMenu,	// handle to menu, or child-window identifier
    HINSTANCE hInstance,	// handle to application instance
    LPVOID lpParam 	// pointer to window-creation data
If for the dwExStyle you pass it the WS_EX_TRANSPARENT flag it will create a 
window that is transparent.  Check out the Code Example TransWin for an example.

7/20/98 9:34:24 AM

Last Modified: 01-SEP-99