Results 1 to 7 of 7

Thread: [RESOLVED] Special Form Style

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Resolved [RESOLVED] Special Form Style

    How do I make a Form with a Titlebar that has no icon and 2 buttons; one button with a ? and the other a normal close button


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  2. #2

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Special Form Style

    Ok, I found out how to do the 'What's This' (?) button so all I need to know is how to get rid of the icon


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Special Form Style

    Never mind, I got it

    Form Properties:

    BorderStyle = 3 - Fixed Dialog
    ControlBox = True
    MaxButton = False
    MinButton = False

    Put following code in Form Module

    Code:
    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 Const WS_EX_CONTEXTHELP = &H400
    Private Const GWL_STYLE = (-16)
    Private Const GWL_EXSTYLE = (-20)
    
    Private Sub Form_Load()
     Dim nStyleEx As Long
      
     nStyleEx = GetWindowLong(hWnd, GWL_EXSTYLE)
     nStyleEx = nStyleEx Or WS_EX_CONTEXTHELP
     SetWindowLong hWnd, GWL_EXSTYLE, nStyleEx
       '
       '
       '
    End Sub
    Last edited by jmsrickland; Mar 15th, 2016 at 06:56 PM.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  4. #4
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,254

    Re: Special Form Style

    Quote Originally Posted by jmsrickland View Post
    Never mind, I got it
    And when somebody else with the same problem finds this thread, they'll be really happy for you....
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [RESOLVED] Special Form Style

    Updated post above


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  6. #6
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: [RESOLVED] Special Form Style

    No Min/Max - BorderStyle: 3 - Fixed Dialog
    No Icon - Delete the Icon
    Question Button - WhatsThisButton: True

  7. #7

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [RESOLVED] Special Form Style

    So simple. Much better than the code. Thanks, very helpful

    I tried deleting the icon on a previous attempt but all it did was remove VB's icon and replace it with a default system icon (similar to the one you see for an exe file). I guess at that time I must have had the Form as either a 1 or 2. Didn't enter my mind to make it a 3 (duh ) and I had no idea about the 'WhatsThisButton' Property.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width