This code show how to made a MDI Form Borderless.
Tested on Visual Basic 6 under Windows XP SP3 platform.
Make a MDI Form borderless
AndreRet commented: Not enough comments added, no help on how to instigate. -1
'This is the API declaration; I suggest to put it in a module, OR change private to public
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
'Constants to make code more readable
Private Const GWL_STYLE = (-16)
Private Const WS_BORDER = &H800000
Private Const WS_CAPTION = &HC00000
'A generic function to make a form borderless
Public Sub RetiraBorda(ByRef nFormHWND As Long)
Dim nEstilo As Long
On Error GoTo errRetiraBorda
nEstilo = GetWindowLong(nFormHWND, GWL_STYLE)
nEstilo = nEstilo And Not WS_CAPTION
SetWindowLong nFormHWND, GWL_STYLE, nEstilo
Exit Sub
errRetiraBorda:
MsgBox "Erro na execução da rotina:" & vbNewLine & vbNewLine & Err.Number & " - " & Err.Description, vbExclamation, "RetiraBorda"
End Sub
'The function can be called this way, in the form for example
Private Sub MDIForm_Activate()
Dim rTela As tCoord
RetiraBorda Me.hwnd
rTela = AreaTrabalho
'Some other code to initialize application
'(...)
End Sub
labq5 0 Newbie Poster
AndreRet 526 Senior Poster
AndreRet 526 Senior Poster
labq5 0 Newbie Poster
AndreRet 526 Senior Poster
anbarasan 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.