5 Replies - 3905 Views - Last Post: 07 August 2011 - 05:33 PM Rate Topic: -----

#1 deverauxxi  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 19-July 11

Disable close button in form (form with activeskin) in VB6. Thx!

Posted 04 August 2011 - 03:43 AM

Hello World!

I'm currently designing my project by applying skin. At this moment, my code for disabling close button is being disregarded to the form where the activeskin is applied.

Can somebody tell me what code should I'm goin to change/add here:
'module

Option Explicit

Public Declare Function GetSystemMenu Lib "user32" _
    (ByVal hwnd As Long, _
     ByVal bRevert As Long) As Long

Public Declare Function RemoveMenu Lib "user32" _
    (ByVal hMenu As Long, _
     ByVal nPosition As Long, _
     ByVal wFlags As Long) As Long

Public Const MF_BYPOSITION = &H400&

Public Sub DisableCloseWindowButton(frm As Form)
    Dim hSysMenu As Long
    hSysMenu = GetSystemMenu(frm.hwnd, 0)
    RemoveMenu hSysMenu, 6, MF_BYPOSITION
    RemoveMenu hSysMenu, 5, MF_BYPOSITION
End Sub



And this short code for the form:
DisableCloseWindowButton Me


Is This A Good Question/Topic? 0
  • +

Replies To: Disable close button in form (form with activeskin) in VB6. Thx!

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 6463
  • View blog
  • Posts: 23,497
  • Joined: 12-June 08

Re: Disable close button in form (form with activeskin) in VB6. Thx!

Posted 04 August 2011 - 07:23 AM

What do you mean "applying skin"?
Was This Post Helpful? 0
  • +
  • -

#3 deverauxxi  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 19-July 11

Re: Disable close button in form (form with activeskin) in VB6. Thx!

Posted 04 August 2011 - 06:04 PM

View Postmodi123_1, on 04 August 2011 - 07:23 AM, said:

What do you mean "applying skin"?

The code for activating the skin is applied to the form (Form1.ApplySkin HwNd) together with the code for disabling the close button (DisableCloseWindowButton Me). The expected result is that the close button will be disabled and so the active skin will take place.
Form1.ApplySkin HwNd
DisableCloseWindowButton Me


It did not work, the skinned form still having the close button. Setting the value of Control Box at the form property as false also didnt take effect.
Was This Post Helpful? 0
  • +
  • -

#4 chuckjessup  Icon User is offline

  • D.I.C Regular

Reputation: 33
  • View blog
  • Posts: 380
  • Joined: 26-October 09

Re: Disable close button in form (form with activeskin) in VB6. Thx!

Posted 05 August 2011 - 09:41 PM

try making the forms border style fixed or 1,3,4, this will then make the min & max buttons disabled, then the close x will likely also be disabled if the control box is set to false...


Give that a try

Jesse Fender

This post has been edited by chuckjessup: 05 August 2011 - 09:48 PM

Was This Post Helpful? 0
  • +
  • -

#5 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 549
  • View blog
  • Posts: 2,908
  • Joined: 19-May 09

Re: Disable close button in form (form with activeskin) in VB6. Thx!

Posted 06 August 2011 - 11:43 AM

If you set controlbox to false, you will not see any of the buttons (buttons will not be disabled, but invisible). In this case, setting the borderstyle will only determine whether you can resize the border or not, or whether you have one at all. Of course, if you remove the controlbox, you will have to provide another means of exiting the form.

This post has been edited by BobRodes: 06 August 2011 - 11:45 AM

Was This Post Helpful? 0
  • +
  • -

#6 deverauxxi  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 19-July 11

Re: Disable close button in form (form with activeskin) in VB6. Thx!

Posted 07 August 2011 - 05:33 PM

Thx for replies, I did all your suggestions and it gave me the hint to solve my problem =)

:flowers: chuckjessup
:flowers: BobRodes
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1