VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Creating a VB Form with Opacity Control like Windows Forms in .NET Framework, using Win32 Api (Work

Raghunathan  (1 Submission)   Windows System Services   VB 6.0   Unknown Difficulty   Wed 15th November 2006   Mon 8th February 2021

Creating a VB Form with Opacity Control like Windows Forms in .NET Framework, using Win32 Api (Works only with Windows 2000 and above)

API Declarations


'1) Create a Standard EXE Application
'2) Add 1 Command Button(Command1) and 2 Timer Controls (Timer1, Timer2) in the 'Form
'3) Copy and Paste this code in the code module of the form and run
'4) !!!!!!!!!!!!!!!!ENJOY!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Private Declare Function GetWindowLong Lib "user32" Alias
"GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias
"SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long)
As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal
hwnd As Long, ByVal crey As Byte, ByVal bAlpha As Byte, ByVal dwFlags
As Long) As Long
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As
Long, ByVal bRevert As Long) As Long
Private Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As
Long) As Long
Private Declare Function DeleteMenu Lib "user32" (ByVal hMenu As Long,
ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long,
ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal
cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

Private Const MF_BYPOSITION = &H400&
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Private Const WS_EX_TRANSPARENT = &H20&
Private Const LWA_ALPHA = &H2&
Private Const HWND_TOPMOST = -1

Option Explicit
Dim bTrans As Byte ' The level of transparency (0 - 255)
Dim lOldStyle As Long

Rate Creating a VB Form with Opacity Control like Windows Forms in .NET Framework, using Win32 Api (Work (2(2 Vote))
Creating a VB Form with Opacity Control like Windows Forms in .NET Framework, using Win32 Api (Work.bas

Creating a VB Form with Opacity Control like Windows Forms in .NET Framework, using Win32 Api (Work Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters