• Welcome to Valhalla Legends Archive.
 

GUI help VB

Started by RhiNo, July 30, 2003, 02:27 PM

Previous topic - Next topic

RhiNo

Ok, I was just wondering because ei havnt seen it done yet but is it possible to make a GUI in vb that has transparent parts so you can see whatever is under the application like some skins for winamp or windows media player.?

Soul Taker


Camel

#2
Col and LWA_COLORKEY set a transparant mask color for if you don't want a rectangular window. If you dont want to use that, just get rid of the LWA_COLORKEY flag.

Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Declare Function SetLayeredWindowAttributes Lib "user32.dll" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long

Public Const GWL_EXSTYLE = (-20)
Public Const WS_EX_LAYERED = &H80000
Public Const LWA_COLORKEY = &H1
Public Const LWA_ALPHA = &H2

Public Sub SetTrans(ByVal hWnd As Long, Ammount As Byte, Col As ColorConstants)
   SetWindowLong hWnd, GWL_EXSTYLE, WS_EX_LAYERED Or GetWindowLong(hWnd, GWL_EXSTYLE)
   SetLayeredWindowAttributes hWnd, Col, Ammount, LWA_ALPHA Or LWA_COLORKEY
End Sub



[edit] note that Ammount isn't a percent, it goes from 0 to 255

RhiNo

#3
doesnt that hide the whole window or make the whole window transparent? i just want like certain spots and other spots to be like a normal GUI i just want to beable to make it like a circle or something or what would this be called so i can find tutorials about it and learn more on it.?

Camel

Quote from: RhiNo on July 30, 2003, 05:22 PM
doesnt that hide the whole window or make the whole window transparent? i just want like certain spots and other spots to be like a normal GUI i just want to beable to make it like a circle or something or what would this be called so i can find tutorials about it and learn more on it.?

I doubt that is possible, but I'm not entirely sure. If it is, it would probably have to do with finding an area of the window and somehow getting it to have its own window handle.

Grok

You can create a region and make it transparent.  Look for the region functions in MSDN.  Let us know what you find.

RhiNo

#6
Quote from: Grok on July 30, 2003, 06:43 PM
You can create a region and make it transparent.  Look for the region functions in MSDN.  Let us know what you find.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbls7/html/vblrfvbspec3_3.asp there are 2 links with info on regions and region clipings and what not thanks grok

+1 for grok for the idea of MSDNN i always forget bout msdn

sPlOrYgOn

WHAT?!? forget?
I goto MSDN everyday because I never learned vb properly..

Yoni