Programming on Visual Basic
Contents |
Tips & Tricks Visual Basic6
Following is some Tips & Tricks Visual Basic::
Making Splash Screen VB6 (By Pasbar_Team)
Splash Screen is a which emerge moment an program run. Way of making it shall be as follows:
Click Menu Project --> Add Form, in windows Add Form select Splash Screen and click Tab
Open. Type coding following at part of Form Frmsplash:
Private Sub Form_Load() lblVersion.Caption = "Version " & App.Major & "." & App.Minor & "." & App.Revision lblProductName.Caption = App.Title End Sub
Make a module with select menu Project > Add module. then set startup object become
submain () menu Project > Project Properties > Startup Object.
Type coding following at part of module1:
Sub Main() frmSplash.Show frmSplash.Refresh Unload frmSplash fMainForm.Show End Sub
happy try!
Making non-box Form VB6 (01) (By Pasbar_Team)
General form in box, but how make form non-box or circular, follow step following:
Make a new project, type listing following:
Private Sub Form_Load() Dim lReturn As Long Form1.Show lReturn = SetWindowRgn(hWnd, CreateEllipticRgn(20, 30, 220, 250), True) End Sub
Then make new a module, Select menu Project > Add Module so that show a module, it's name module 1. Write coding as follows:
Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As_ Long, ByVal Y2 As Long) As Long
Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long,_ ByVal bRedraw As Boolean) As Long
Happy Try..!!!
Making non-box Form VB6 (02) (By Pasbar_Team)
Now, how make form non-box like form of is square with corner killed or do not bevel. paying attention coding as following. Making a new project.
type coding following:
Private Sub Form_Load() X1 = 0 Y1 = 0 X2 = 490 Y2 = 300 X3 = 25 Y3 = 25 lHandle = CreateRoundRectRgn(X1, Y1, X2, Y2, X3, Y3) SetWindowRgn Me.hWnd, lHandle, True End Sub
Then make new a module, Select menu Project > Add Module So that show a module. it's name module 1. Write coding as follows:
Public Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As_ long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
Public Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As_ long, ByVal bRedraw As Boolean) As Long
Happy Try..!!!
Making Form transparent in VB6 (By Pasbar_Team)
when us require form which transparent. how to making it? well, follow step following:
Making new a form dan a module, write coding in form:
Private Sub Form_Initialize() 'Tranfarant From are 0 - 255 TranslucentForm Me, 100 End Sub
add a module, then writing source coding as follows:
Option Explicit Public Const GWL_EXSTYLE = (-20) Public Const WS_EX_LAYERED = &H80000 Public Const LWA_ALPHA = &H2 Public Const EM_GETLINECOUNT = &HBA Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As_ Long, ByVal nIndex As Long) As Long
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As_ Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long_ Public Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long,_ ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Function TranslucentForm(frm As Form, TranslucenceLevel As Byte) As Boolean
SetWindowLong frm.hWnd, GWL_EXSTYLE, WS_EX_LAYERED SetLayeredWindowAttributes frm.hWnd, 0, TranslucenceLevel, LWA_ALPHA TranslucentForm = Err.LastDllError = 0 End Function
Happy Try...!!!