I realize that this tread is some quite old, but...
1. freQ, really you can set FormBorderStyle in VB.Net environment; but, in earlier versions, this property doesn't exist;
2 choudhuryshouvi, if you use API for disable buttons in title bar, why not to disable border in the form? It's possible, but need a bit of work on it. Use two APIs of USER32 file: GETWINDOWLONG and SETWINDOWLONG;
3. PVBert, if the only aim of hide the MDI form's border is to prevent that the user can close the application, your sollution works fine... but, if you need to "redesign" your application, reshape the "Windows window" (this sounds very strange) with a picture, for example?
I made a "form picture", with "title", "borders" and so on (in a photoshop-like application), and need to take out the conventional border of the MDI and put my image in the background, simulating a "skin" for my VB6 program.
The result is very cool... and the above code solve my problem! ;)
It's adpated from
http://phsoftware.de/index.php/content/view/18/49/
I hope this can be usefull for anyone that "googles" for borderless MDI form in pre-NET Visual Basic, and apologize for the bad writing (not speak english very well).
Best regards,
Sidnei
Sao Paulo - Brasil
'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 <strong>RetiraBorda</strong>(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
<strong>RetiraBorda</strong> Me.hwnd
rTela = AreaTrabalho
'Some other code to initialize application
'(...)
End Sub