What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Plug-Ins » [VB6] vbModeless?

Pages: (2): « First [ 1 ] 2 » Last »
[VB6] vbModeless?
Author: Message:
eSouL
Junior Member
**


Posts: 36
Joined: Oct 2005
O.P. [VB6] vbModeless?
Hi, another one from me, sorry for the never-ending questions.. :$

When i do this:
form1.show vbmodeless

Nothing happens. the form will show up only when I use vbModal for it. Why is it so?
10-10-2005 05:02 PM
Profile E-Mail PM Find Quote Report
Mike
Elite Member
*****

Avatar
Meet the Spam Family!

Posts: 2795
Reputation: 48
32 / Male / Flag
Joined: Mar 2003
RE: [VB6] vbModeless?
The variable "vbModeless" is actually unknown in VB, and I guess you get a compile error saying "Variable Not Defined" when trying to compile your plugin.
If you don't get an error, that means that you haven't put "Option Explicit" in the top of your code.
That forces every variable to be declared.

Anyway, if you want to show a "modeless" form, you don't have to put "vbModel".
However, you can't use this on a Messenger Plus! VB plugin.
But I think that Matty has made a post on how to make a "modeless" form in a plugin...
YouTube closed-captions ripper (also allows you to download videos!)
10-10-2005 05:08 PM
Profile E-Mail PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [VB6] vbModeless?
The .Show function on a form accepts 2 values for the type of Display. Those values are 0 and 1. 0 would, in essence vbModaless which doesn't technically exist as a Visual Basic Constant. And 1 is vbModal (showing ontop of all other windows.

Now when showing a window from a plugin you have to use vbModal if you choose to show a window using Formname.show. On the other hand if you use the Windows API as shown in the post i made awhile ago you can do it differently.

Matty's reply to Showing Form without vbModal in VB? For the programmers out there... :D

This post was edited on 10-10-2005 at 09:06 PM by matty.
10-10-2005 06:51 PM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: [VB6] vbModeless?
quote:
Originally posted by Mike
The variable "vbModeless" is actually unknown in VB, and I guess you get a compile error saying "Variable Not Defined" when trying to compile your plugin.
No, vbModeless _does_ exist and is a perfect valid constant...

Show parameters:
Constant      Value       Description
vbModal            1        Modal form
vbModeless        0        Modeless form

See VB help files, or MSDN Library: Form constants

quote:
Originally posted by Mike
Anyway, if you want to show a "modeless" form, you don't have to put "vbModel".
Indeed you don't, as "Modeless" is the opposite of "Modal". It would be wrong to put "vbModeless" if you mean "vbModal" (or vice versa)

quote:
Originally posted by Matty
(...) And 1 is vbModal, showing ontop of all other windows.
Although it indeed shows on top of other windows, that isn't exactly the true meaning of it.

Modal vs. Modeless:
The definition of a modal form is that it must be closed (hidden or unloaded) before you can continue working with the rest of the application (hence it is also shown on top; but this is rather a "side effect" so to speak). For example, a dialog box is modal if it requires you to click OK or Cancel before you can switch to another form or dialog box.

Modeless dialog boxes let you shift the focus between the dialog box and another form without having to close the dialog box. You can continue to work elsewhere in the current application while the dialog box is displayed. Modeless dialog boxes are rare. From the Edit menu, the Find dialog box in Visual Basic is an example of a modeless dialog box.
(snipped taken from the MSDN library)

;)

----------------------

From the MSDN Library:
PRB: Modeless Forms in VB ActiveX DLL's Don't Display in VC++ Clients
INFO: Non-Modal Form Support in Visual Basic DLLs

----------------------

did I ever mention you can find everything on the MSDN library? (a) No? hmmm... well... you can find everything on the MSDN library :p)

This post was edited on 10-10-2005 at 11:38 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
10-10-2005 11:21 PM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [VB6] vbModeless?
quote:
Originally posted by CookieRevised
Although it indeed shows on top of other windows, that isn't exactly the true meaning of it.
Showing ontop of all windows in your application making them inaccessible until you close the window... hows that Cook?
10-10-2005 11:46 PM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: [VB6] vbModeless?
quote:
Originally posted by Matty
Showing ontop of all windows in your application making themthe other forms inaccessible until you close the window... hows that Cook?
hehehe :p, yep, correct (y)

This post was edited on 10-11-2005 at 02:19 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
10-11-2005 02:11 AM
Profile PM Find Quote Report
eSouL
Junior Member
**


Posts: 36
Joined: Oct 2005
O.P. RE: [VB6] vbModeless?
Hi,

I discovered an odd behaviour when using this method to show a modeless form. Whenever you use the form (writing some text into a textbox, clicking a button etc.), the form does not appear to be activated, if you look at the taskbar!

What i mean is, the form's window in the taskbar will not get highlighted as the 'active' window, when it is indeed in the foreground. The highlight will remain at the last activated app, no matter how hard you click or drag the new vb form. The only way to get it highlighted is to actually click on the form window in the taskbar.

This normally wouldn't be a problem, but right now I'm using FlashWindowEx to flash the form taskbar window on some event and will continue to flash until user activates the form (dwFlags = FLASHW_TRAY | FLASHW_TIMERNOFG). But the form flashing will NOT stop even after I click on the vb form and start interacting with it, simple because somehow Windows thinks it is still not the active app.

Any ideas?
10-28-2005 07:14 AM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: [VB6] vbModeless?
There nothing odd about it though...

Making a form modeless doesn't mean it is activated. In fact it is not and that's very normal. Activating a form and making a form modeless or modal are two different things... A form (aka dialog) can even be at the foreground but not activated.

All these window states are independant and must be set seperatly and shouldn't be taken as "granted" (although some states automatically activate another by default, eg: making a form modal will also activate it and make it the foreground window).

This post was edited on 10-28-2005 at 05:21 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
10-28-2005 05:17 PM
Profile PM Find Quote Report
eSouL
Junior Member
**


Posts: 36
Joined: Oct 2005
O.P. RE: [VB6] vbModeless?
Cookie, when I use the exact same code in a normal exe project to call up a new form, the bahaviour was everything as expected, ie. you click the form, it gets its focus and becomes highlighted in the taskbar. But when the same piece of code is used in a plugin dll to call up new forms, these forms don't appear as highlighted in the taskbar. I tested on the vanilla sample plugin.
10-28-2005 07:53 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [VB6] vbModeless?
Why not use the BringWindowToTop API function. Or SetForeGround API Function.

Public Declare Function BringWindowToTop Lib "user32" Alias "BringWindowToTop" (ByVal hwnd As Long) As Long
Public Declare Function SetForegroundWindow Lib "user32" Alias "SetForegroundWindow" (ByVal hwnd As Long) As Long
10-28-2005 08:00 PM
Profile E-Mail PM Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On