window transparent
Moderator: Rathinagiri
window transparent
Hi all
how create a window transparent
i see one example many years ago on version 1.xx of minigui, and now need this example.
Thank's
Juan Rendón
how create a window transparent
i see one example many years ago on version 1.xx of minigui, and now need this example.
Thank's
Juan Rendón
Re: window transparent
Hi Juan Rendón,jrendon wrote:Hi all
how create a window transparent
i see one example many years ago on version 1.xx of minigui, and now need this example.
Please try the following sample:
Code: Select all
/*
* MINIGUI - Harbour Win32 GUI library Demo
*
* Copyright 2002-2009 Roberto Lopez <harbourminigui@gmail.com>
* http://harbourminigui.googlepages.com/
*/
#include "minigui.ch"
Function Main()
Local nTra := 128, hWnd
DEFINE WINDOW WinTR ;
AT 0,0 ;
WIDTH 300 ;
HEIGHT 300 ;
TITLE 'Transparent window' ;
MAIN ;
NOSIZE NOMAXIMIZE ;
ON INIT ( hWnd := GetFormHandle('WinTR'), SetTransparent(hWnd, nTra) )
@ 200,100 BUTTON But1 ;
CAPTION "Click Me" ;
HEIGHT 35 WIDTH 100 ;
ACTION ( nTra := IIF(nTra == 128, 255, 128), SetTransparent(hWnd, nTra) )
END WINDOW
CENTER WINDOW WinTR
ACTIVATE WINDOW WinTR
RETURN NIL
#pragma BEGINDUMP
#include <windows.h>
#include "hbapi.h"
HB_FUNC( SETTRANSPARENT )
{
typedef BOOL (__stdcall *PFN_SETLAYEREDWINDOWATTRIBUTES) (HWND, COLORREF, BYTE, DWORD);
PFN_SETLAYEREDWINDOWATTRIBUTES pfnSetLayeredWindowAttributes = NULL;
HINSTANCE hLib = LoadLibrary("user32.dll");
if (hLib != NULL)
{
pfnSetLayeredWindowAttributes = (PFN_SETLAYEREDWINDOWATTRIBUTES) GetProcAddress(hLib, "SetLayeredWindowAttributes");
}
if (pfnSetLayeredWindowAttributes)
{
SetWindowLong((HWND) hb_parnl (1), GWL_EXSTYLE, GetWindowLong((HWND) hb_parnl (1), GWL_EXSTYLE) | WS_EX_LAYERED);
pfnSetLayeredWindowAttributes((HWND) hb_parnl (1), 0, hb_parni (2), LWA_ALPHA);
}
if (!hLib)
{
FreeLibrary(hLib);
}
}
#pragma ENDDUMP
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Re: window transparent
gfilatov wrote:
Please try the following sample:Code: Select all
/* * MINIGUI - Harbour Win32 GUI library Demo * * Copyright 2002-2009 Roberto Lopez <harbourminigui@gmail.com> * http://harbourminigui.googlepages.com/ */ #include "minigui.ch" Function Main() Local nTra := 128, hWnd..... [/quote] Hi Grigory ! when compiling the code your post the following error appears: [quote]Start... DEMO.prg: In function `HB_FUN_SETTRANSPARENT': DEMO.prg:57: error: `LWA_ALPHA' undeclared (first use in this function) DEMO.prg:57: error: (Each undeclared identifier is reported only once DEMO.prg:57: error: for each function it appears in.) Finished With Errors. [/quote] Can you help me please? Saludos, Fernando Chirico.
Saludos, Fernando Chirico.
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: window transparent
Hi,
Kindly save 'c' pragma entries in a separate .c file and compile along with the prg and try.
Kindly save 'c' pragma entries in a separate .c file and compile along with the prg and try.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: window transparent
works perfectly.rathinagiri wrote:Hi,
Kindly save 'c' pragma entries in a separate .c file and compile along with the prg and try.
Sorry for the ignorance.
Whenever you learn something new.
Thank you very much.
Regards, Fernando Chirico.
Saludos, Fernando Chirico.
Re: window transparent
Yes me to the same error on this line code
Please try the following sample:Hi Grigory !Code: Select all
/* * MINIGUI - Harbour Win32 GUI library Demo * * Copyright 2002-2009 Roberto Lopez <harbourminigui@gmail.com> * http://harbourminigui.googlepages.com/ */ #include "minigui.ch" Function Main() Local nTra := 128, hWnd.....
when compiling the code your post the following error appears:
Can you help me please?Code: Select all
Start... DEMO.prg: In function `HB_FUN_SETTRANSPARENT': DEMO.prg:57: error: `LWA_ALPHA' undeclared (first use in this function) DEMO.prg:57: error: (Each undeclared identifier is reported only once DEMO.prg:57: error: for each function it appears in.) Finished With Errors.
Saludos, Fernando Chirico.
Code: Select all
pfnSetLayeredWindowAttributes((HWND) hb_parnl (1), 0, hb_parni (2), LWA_ALPHA);
Juan Rendon
Re: window transparent
humm my ignorace is more .... How to compile the .c file ..?fchirico wrote:works perfectly.rathinagiri wrote:Hi,
Kindly save 'c' pragma entries in a separate .c file and compile along with the prg and try.
Sorry for the ignorance.
Whenever you learn something new.
Thank you very much.
Regards, Fernando Chirico.
Re: window transparent
Hi Juan Rendon,jrendon wrote:Yes me to the same error on this line code
Hi Grigory !
when compiling the code your post the following error appears:
Can you help me please?Code: Select all
Start... DEMO.prg: In function `HB_FUN_SETTRANSPARENT': DEMO.prg:57: error: `LWA_ALPHA' undeclared (first use in this function) DEMO.prg:57: error: (Each undeclared identifier is reported only once DEMO.prg:57: error: for each function it appears in.) Finished With Errors.
Saludos, Fernando Chirico.Code: Select all
pfnSetLayeredWindowAttributes((HWND) hb_parnl (1), 0, hb_parni (2), LWA_ALPHA);
Please be so kind to try an updated sample below:
Code: Select all
/*
* MINIGUI - Harbour Win32 GUI library Demo
*
* Copyright 2002-2009 Roberto Lopez <harbourminigui@gmail.com>
* http://harbourminigui.googlepages.com/
*/
#include "minigui.ch"
Function Main()
Local nTra := 128, hWnd
DEFINE WINDOW WinTR ;
AT 0,0 ;
WIDTH 300 ;
HEIGHT 300 ;
TITLE 'Transparent window' ;
MAIN ;
NOSIZE NOMAXIMIZE ;
ON INIT ( hWnd := GetFormHandle('WinTR'), SetTransparent(hWnd, nTra) )
@ 200,100 BUTTON But1 ;
CAPTION "Click Me" ;
HEIGHT 35 WIDTH 100 ;
ACTION ( nTra := IIF(nTra == 128, 255, 128), SetTransparent(hWnd, nTra) )
END WINDOW
CENTER WINDOW WinTR
ACTIVATE WINDOW WinTR
RETURN NIL
#pragma BEGINDUMP
#define LWA_ALPHA 0x02
#include <windows.h>
#include "hbapi.h"
HB_FUNC( SETTRANSPARENT )
{
typedef BOOL (__stdcall *PFN_SETLAYEREDWINDOWATTRIBUTES) (HWND, COLORREF, BYTE, DWORD);
PFN_SETLAYEREDWINDOWATTRIBUTES pfnSetLayeredWindowAttributes = NULL;
HINSTANCE hLib = LoadLibrary("user32.dll");
if (hLib != NULL)
{
pfnSetLayeredWindowAttributes = (PFN_SETLAYEREDWINDOWATTRIBUTES) GetProcAddress(hLib, "SetLayeredWindowAttributes");
}
if (pfnSetLayeredWindowAttributes)
{
SetWindowLong((HWND) hb_parnl (1), GWL_EXSTYLE, GetWindowLong((HWND) hb_parnl (1), GWL_EXSTYLE) | WS_EX_LAYERED);
pfnSetLayeredWindowAttributes((HWND) hb_parnl (1), 0, hb_parni (2), LWA_ALPHA);
}
if (!hLib)
{
FreeLibrary(hLib);
}
}
#pragma ENDDUMP
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
- Alex Gustow
- Posts: 290
- Joined: Thu Dec 04, 2008 1:05 pm
- Location: Yekaterinburg, Russia
- Contact:
Re: window transparent
Hi all!
I tried updated sample (Win98, Harbour 1.1.0.dev (Rev. 11020), HMGExt 1.6.67 ).
If it helps to someone:
1. Compile time warning
--------
Warning W8017 c:\borland\bcc55\include\winuser.h 3536: Redefenition of
'LWA_ALPHA' is not identical
--------
2. no effect in Win98 [of course ]
I tried updated sample (Win98, Harbour 1.1.0.dev (Rev. 11020), HMGExt 1.6.67 ).
If it helps to someone:
1. Compile time warning
--------
Warning W8017 c:\borland\bcc55\include\winuser.h 3536: Redefenition of
'LWA_ALPHA' is not identical
--------
2. no effect in Win98 [of course ]
Re: window transparent
gfilatov wrote: Hi Juan Rendon,
Please be so kind to try an updated sample below:Code: Select all
/* * MINIGUI - Harbour Win32 GUI library Demo * * Copyright 2002-2009 Roberto Lopez <harbourminigui@gmail.com> * http://harbourminigui.googlepages.com/ */ #include "minigui.ch" Function Main() Local nTra := 128, hWnd..................... .... I hope that helps. :|[/quote] This code works OK too, and I can compile directly in HMG. Thank You Grigory. Saludos, Fernando Chirico.
Saludos, Fernando Chirico.