|
-
Sep 25th, 2000, 11:55 PM
#1
Thread Starter
Lively Member
This should be something simple, but for some reason it isn't. All my forms have ShowInTaskbar set to True, but when I run it, nothing appears in the taskbar .... I'm confused.
Any suggestions?
-
Sep 26th, 2000, 08:15 AM
#2
_______
<?>
Are your forms titleless? If so ...
Code:
'show the icon of a titleless form in taskbar tray
Private Declare Function SetWindowLong Lib "user32" _
Alias "SetWindowLongA" (ByVal hwnd As Long, _
ByVal nIndex As Long, ByVal dwNewLong As Long) _
As Long
Private Const GWL_STYLE = (-16)
Private Const WS_SYSMENU = &H80000
'<<<<<< Form load >>>>>>
Private Sub Form_Load()
Call SetWindowLong(Me.hwnd, GWL_STYLE, WS_SYSMENU)
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Sep 26th, 2000, 03:19 PM
#3
Or try this:
Code:
Private Sub Form_Load()
App.TaskVisible = True
End Sub
-
Sep 26th, 2000, 10:37 PM
#4
Thread Starter
Lively Member
Unfortunately, neither of those tips worked. The first one ade the form titelless, but still didnt show in the task bar. The second did nothing as far as i could tell. Thanks for replying though.
Any other ideas?
-
Sep 26th, 2000, 10:40 PM
#5
Frenzied Member
try setting the border stlye to BORDERLESS then enter a title for the form, the blue bar at the top woun't show, and is should show in the taskbar
NXSupport - Your one-stop source for computer help
-
Sep 26th, 2000, 10:56 PM
#6
Thread Starter
Lively Member
I'm not sure if I have a different version of VB to you but, borderless is not an option for border style.
using borderstyle = None, I couldnt notice any difference. The form has a Caption, but no Title?
i have VB 6.0 if that makes any difference to the price of fish.
-
Sep 27th, 2000, 09:32 AM
#7
Frenzied Member
I asked the same question a few weeks ago in A Minimize Mystery. I still have not figured it out. If you find the answer, please let me know.
-
Oct 5th, 2000, 01:45 PM
#8
Hyperactive Member
Minimize problem, any luck?
I was wondering if you got anywhere on this. I've got this problem too, I read your Minimize Mystery. In my scenario, I've got an exe which shows fine in the task bar and minimizes there, but the forms I'm showing from that exe live in a DLL. I can only get those forms to minimize to the desktop and they don't show at all in the taskbar.
Just talking out loud and wondering if you-all had any news.
-
Oct 5th, 2000, 11:06 PM
#9
Thread Starter
Lively Member
nowhere yet I'm afraid, but will keep you posted
-
Oct 12th, 2000, 09:24 PM
#10
Lively Member
Possible Explanation
I'm having the same problem. I looked up some stuff on MSDN, and found this:
http://support.microsoft.com/support.../Q176/4/68.ASP
It's an article about form behavior with ActiveX controls, but what it basically said was that modal forms (displayed like Form.Show 1) will NOT show in the taskbar no matter what ShowInTaskbar is set to.
This is a major problem for me, because I use all my forms like classes, defining them with variables, setting their properties (standard and user-defined) and calling them with their own custom View function, which allows them to start up correctly and show themselves modally, which allows a return value to be sent back when activity is complete. I can't easily change this behavior.
If anybody has any more info on this or a work around, I'd appreciate it.
-JoeyCode
-
Oct 23rd, 2000, 12:45 PM
#11
All of my forms are modal, but for a work around I've loaded a non-modal form on startup, and kept this form hidden so that the user never sees it. This will bring up the app in the task bar.
Hope it helps.
-
Oct 23rd, 2000, 02:50 PM
#12
Hyperactive Member
huh
Can you be more specific about your method?
-
Oct 25th, 2000, 05:24 PM
#13
Lively Member
My Way or the Highway
I see what Caspian is doing, just SHOWing a single invisible non-modal form that probably has nothing on it and no code, thusly the app will show in the taskbar, displayed with the caption of that form. That's a pretty good solution, no better or worse than mine below (they're all stupid, since it shouldn't be necessary).
What I'm doing is calling all my forms with a custom View method (because I'm treating all my forms as separate "classes"), and the forms show themselves modally, like this:
Code:
'View Method
'Set the Default form properties (if any)
'Set flag and show form
m_ReturnValue = vbCancel
m_ValidView = True
'Just in case form was called incorrectly...
Me.Visible = False
'Now show modally
Me.Show vbModal
'Return the value
View = m_ReturnValue
m_ValidView = False
'Done
Exit Function
The variable m_ReturnValue allows the form (the View method) to return a value, and the flag m_ValidView is checked in the Form.Activate event...if it's not set to True, the form won't load and will display an error message. This makes it so you can't load the form normally, you have to call the View method. The key here is that when the form shows itself Modally, the code pauses there until the form unloads itself, at which time m_ReturnValue is passed back and control is returned to the calling function. This was also why my app wasn't showing in the Taskbar...but I need it to pause here. So I made this modification:
Code:
'View Method
'Set the Default form properties (if any)
'Set flag and show form
'm_ReturnValue = vbCancel
m_ReturnValue = 0 'For new show method
m_ValidView = True
'Just in case form was called incorrectly...
Me.Visible = False
'Now show modally
'Me.Show vbModal
'New show method to allow form to appear in taskbar
Me.Show vbModeless
'Loop till it's done
While m_ReturnValue = 0
DoEvents
Wend
'Return the value
View = m_ReturnValue
m_ValidView = False
'Done
Exit Function
So now this code will wait until a return value is set, which happens at the same time as the form unloads itself (but it doesn't have to). I was worried about doing this, but there doesn't seem to be any performance hit.
I don't think any solution is going to be clean, and Caspian's solution is good, but this worked for my situation.
-JoeyCode
-
Oct 25th, 2000, 10:27 PM
#14
Sorry vbmom, haven't had time to respond. JoeyCode did a great job explaining my solution. Thanks!
-
Oct 27th, 2000, 10:11 PM
#15
Hyperactive Member
Hey thanks
That worked great, JoeyCode. And gee, was it so simple. I might have to disagree that it doesn't suck up resources. I've got the NT Task Mgr telling me I've got 100% cpu usage when the two forms are showing and the loop thing is running.
Regardless, I'm glad the ideas were shared. If anything, it's an interesting study. I modified the method to satisfy the requirement that control does not come back to the caller form (the one that loads the DLL form using your custom View function through a DLL class function, right?) until the DLL form is unloaded.
Calling form...
Dim LoadClass as New CLoadClass
(code that disables this form and presents hourglass)
LoadClass.LoadForm
(code that enables this form and returns to mouse ptr)
CLoadClass class...
Public Sub LoadClass()
DLLForm.View
Do
DoEvents
Loop Until DLLForm.ViewDone
Unload DLLForm
End Sub
DLLForm's View function is the same as yours *up through* the Me.Show vbModeless.
DLLForm's ViewDone & QueryUnload functions ...
Public Function ViewDone() As Boolean
If m_ReturnValue <> 0 Then ViewDone = True
End Function
Public Function QueryUnload...
m_ReturnValue = vbCancel
End Function
I hope this makes sense. Maybe it will be helpful to you.
-
Apr 14th, 2003, 01:28 PM
#16
New Member
Thanks!!!!!
Thankyou JoeyCode. I have been looking for a solution to this problem. You are a life saver. Thanks again, Chris.
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
|