|
-
Mar 26th, 2000, 11:09 PM
#1
Thread Starter
Frenzied Member
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.
-
Mar 26th, 2000, 11:15 PM
#2
Addicted Member
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.
-
Mar 27th, 2000, 03:47 AM
#3
Lively Member
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
-
Mar 27th, 2000, 04:15 AM
#4
Thread Starter
Frenzied Member
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.
-
Mar 27th, 2000, 04:22 AM
#5
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|