Results 1 to 5 of 5

Thread: Hiding Controls

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    Is there a way of making a controll visible/invisible using only the API, I'm subclassing and most of the code is done in a module so it's be quite hard to go back into the usercontrol and make it invisible, also I'd have to make it's visible property public which I dont want to do.

  2. #2
    Addicted Member
    Join Date
    Sep 1999
    Posts
    154
    You could probably do it by first finding the handle to the control and then passing an API that hides the window. I don't have the API of hand. I am not sure why you would not simply issue a Control.visible = false statement.

  3. #3
    Lively Member
    Join Date
    Jun 1999
    Location
    East Anglia, England
    Posts
    73
    Hello,
    Don't let the name of the API call fool you it actually hides things other than windows as well.
    Add two textboxes to a form and paste the code in.
    Code:
    Option Explicit
    
    Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
    
    Private Sub Command1_Click()
        ShowWindow Text1.hwnd, 0 '//HIDE THE TEXTBOX
    End Sub
    
    Private Sub Command2_Click()
        ShowWindow Text1.hwnd, 1 '//SHOW THE TEXTBOX
    End Sub
    Hope it helps,
    Desire

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089

    OK, Why Doesn't that work?

    I tried showwindow and it magicly did nothing. I've also tried

    SetWindowLong hWnd, GWL_STYLE, GetWindowLong(hWnd,GWL_STYLE) and (not WS_VISIBLE)

    and

    SetWindowLong hWnd,GWL_STYLE,GetWindowLong(hWnd,GWL_STYLE) or WS_VISIBLE to make it visible again

    AnyClues why It doesnt work?

    P.S. I'm Doing This while Subclassing in the Substitute Window Procedure which may have something to do with it, but I can't think what.

    Thanks for your help Anyway but more help would be great.

  5. #5
    Lively Member
    Join Date
    Jun 1999
    Location
    East Anglia, England
    Posts
    73
    Hello,
    Well I'm fresh out of ideas, I'm *coughs* cráp at subclassing so I can't help you there.

    Desire.

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