Page 2 of 2

Re: window transparent

Posted: Thu Jun 11, 2009 12:42 pm
by gfilatov
Alex Gustow wrote:Hi all!
I tried updated sample (Win98, Harbour 1.1.0.dev (Rev. 11020), HMGExt 1.6.67 ).

...
1. Compile time warning
--------
Warning W8017 c:\borland\bcc55\include\winuser.h 3536: Redefenition of
'LWA_ALPHA' is not identical
--------
Hi Alex,

Thanks for reporting!
You are right (for Borland C). ;)

I've changed the definition for MinGW at the C-level:
...
#pragma BEGINDUMP

#if defined ( __MINGW32__ )
#define _WIN32_WINNT 0x0500
#endif

#include <windows.h>
#include "hbapi.h"
...

Re: window transparent

Posted: Thu Jun 11, 2009 7:52 pm
by jrendon
gfilatov wrote:
jrendon wrote:

Hi Grigory !

when compiling the code your post the following error appears:

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. 
Can you help me please?

Saludos, Fernando Chirico.
Yes me to the same error on this line code

Code: Select all

pfnSetLayeredWindowAttributes((HWND) hb_parnl (1), 0, hb_parni (2), LWA_ALPHA);
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

   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
I hope that helps. :|

Hi Grigory !

is working now
thank's

Re: window transparent

Posted: Thu Jun 11, 2009 8:59 pm
by jrendon
Set Language to Spanish

en este ejemplo que hice gracias a Grigory me salieron varias dudas

1.- como puedo insertar un objeto arriba de una imagen y que se pueda utilizar por ejemplo el slider por encima de la imagen (ya cambie el orden de los controles y si se pone el slider encima pero no tengo control sobre el)

2.- En el slider no existe la propiedad Transparent ( Creo que esto es para Roberto)

3.- Como hacer que la ventana quede transparente pero los objetos queden normales como controles o imagen ( creo que es para Grigory)

Gracias

Set Language to English (Powered by google)

in this program that I thank Grigory took me several questions

1 .- How can I put an object up an image that can be used eg the slider above the image (and change the order of the checks and if we put the slider on top but I have no control over)

2 .- In the slider Transparent property does not exist (I believe this is Roberto)

3 .- How to make the window is transparent but the objects are normal controls or an image (I think it is for Grigory)

Thank you

Re: window transparent

Posted: Thu Jun 11, 2009 9:01 pm
by jrendon
ups sorry, the program is here...

Re: window transparent

Posted: Fri Jun 12, 2009 2:17 am
by fchirico
jrendon wrote:ups sorry, the program is here...
Excelente !!!

Seguramente me servirá de inspiración :ugeek:

Gracias por compartir.

Saludos, Fernando Chirico.

Re: window transparent

Posted: Fri Jun 12, 2009 2:53 am
by fchirico
jrendon wrote:ups sorry, the program is here...

If we join the examples of Esgici and Jrendon ....

Re: window transparent

Posted: Fri Jun 12, 2009 3:50 am
by jrendon
fchirico wrote:
jrendon wrote:ups sorry, the program is here...

If we join the examples of Esgici and Jrendon ....

fchirico good inspiration jejeje :mrgreen:

Re: window transparent

Posted: Fri Jun 12, 2009 6:41 am
by jrendon
another example
notify.JPG
notify.JPG (123.94 KiB) Viewed 2250 times

and this is the program

Regards
Juan Rendon

Re: window transparent

Posted: Fri Aug 16, 2019 12:01 am
by jairpinho
gfilatov wrote:
Wed Jun 10, 2009 7:15 am
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.
Hi Juan Rendón,

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
8-)


I need to develop an application that the window main would have to be transparent and be based on a png picture this is possible?
It would be a window for game with the format of a picture png and all buttons on this images, would be next to the example: C: \ hmg.3.4.4 \ SAMPLES \ Miscellaneous \ ScreenSplash but with the main window with the possibility to create by ide
jogo.png
jogo.png (1.19 MiB) Viewed 258 times