window transparent

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
gfilatov
Posts: 656
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Has thanked: 24 times
Been thanked: 227 times
Contact:

Re: window transparent

Post by gfilatov » Thu Jun 11, 2009 12:42 pm

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"
...
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein

User avatar
jrendon
Posts: 92
Joined: Thu Aug 14, 2008 9:21 pm

Post by jrendon » Thu Jun 11, 2009 7:52 pm

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

User avatar
jrendon
Posts: 92
Joined: Thu Aug 14, 2008 9:21 pm

Post by jrendon » Thu Jun 11, 2009 8:59 pm

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

User avatar
jrendon
Posts: 92
Joined: Thu Aug 14, 2008 9:21 pm

Post by jrendon » Thu Jun 11, 2009 9:01 pm

ups sorry, the program is here...
Attachments
test1.rar
window transparent
(45.52 KiB) Downloaded 157 times

User avatar
fchirico
Posts: 324
Joined: Sat Aug 23, 2008 11:27 pm
Location: Argentina

Post by fchirico » Fri Jun 12, 2009 2:17 am

jrendon wrote:ups sorry, the program is here...
Excelente !!!

Seguramente me servirá de inspiración :ugeek:

Gracias por compartir.

Saludos, Fernando Chirico.
Saludos, Fernando Chirico.

User avatar
fchirico
Posts: 324
Joined: Sat Aug 23, 2008 11:27 pm
Location: Argentina

Post by fchirico » Fri Jun 12, 2009 2:53 am

jrendon wrote:ups sorry, the program is here...

If we join the examples of Esgici and Jrendon ....
Attachments
CuckoClok_Transparente.zip
(9.99 KiB) Downloaded 167 times
Saludos, Fernando Chirico.

User avatar
jrendon
Posts: 92
Joined: Thu Aug 14, 2008 9:21 pm

Post by jrendon » Fri Jun 12, 2009 3:50 am

fchirico wrote:
jrendon wrote:ups sorry, the program is here...

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

fchirico good inspiration jejeje :mrgreen:

User avatar
jrendon
Posts: 92
Joined: Thu Aug 14, 2008 9:21 pm

Post by jrendon » Fri Jun 12, 2009 6:41 am

another example
notify.JPG
notify.JPG (123.94 KiB) Viewed 2239 times

and this is the program

Regards
Juan Rendon
Attachments
test.rar
(46.84 KiB) Downloaded 157 times

User avatar
jairpinho
Posts: 340
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Has thanked: 3 times
Been thanked: 11 times
Contact:

Post by jairpinho » Fri Aug 16, 2019 12:01 am

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 247 times
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br

Post Reply