Valhalla Legends Archive

Programming => General Programming => Topic started by: RhiNo on July 30, 2003, 02:27 PM

Title: GUI help VB
Post by: RhiNo on July 30, 2003, 02:27 PM
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.?
Title: Re:GUI help VB
Post by: Soul Taker on July 30, 2003, 02:48 PM
Yes.
Title: Re:GUI help VB
Post by: Camel on July 30, 2003, 02:54 PM
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
Title: Re:GUI help VB
Post by: 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.?
Title: Re:GUI help VB
Post by: Camel on July 30, 2003, 06:23 PM
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.
Title: Re:GUI help VB
Post by: 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.
Title: Re:GUI help VB
Post by: RhiNo on July 31, 2003, 01:33 PM
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
Title: Re:GUI help VB
Post by: sPlOrYgOn on July 31, 2003, 04:02 PM
WHAT?!? forget?
I goto MSDN everyday because I never learned vb properly..
Title: Re:GUI help VB
Post by: Yoni on August 01, 2003, 03:26 AM
+1 to sPlOrYgOn