For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic Addins > May 2005 > Modeless Behavior from within VB for Word COM AddIn w/ Certain Modal Functionality?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Modeless Behavior from within VB for Word COM AddIn w/ Certain Modal Functionality?
TMan

2005-05-21, 8:58 am

Hey Folks,

I'm sure that you are all well acquainted with how when one uses a modal
form from within Word VBA or the VB environment, one stays within that
routine until the form is closed and the routine can continue. The opposite
is, of course, true when using a modeless form from within Word VBA or the
VB environment (i.e. the code will run completely through the routine).

However, if one loads a VBA form as modal and then, say, clicks a button
that runs such code as below:



Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal
lpClassName As String, ByVal lpWindowName As String) As Long

Private Declare Function EnableWindow Lib "user32" (ByVal hWnd As Long,
ByVal fEnable As Long) As Long

Public Sub Enabler
'Make the form modeless by enabling Word
EnableWindow FindWindow("OpusApp", Application.Caption), True
End Sub


The behavior will be to make the form modeless such that the user can move
about in Word but the code will not run until the form is unloaded.

I want to create this same behavior from within the VB environment but it is
not working.

Any suggestions?

Thanks & Regards,

TC


alpine

2005-05-21, 3:57 pm

Have a look at the following....

[http://groups-beta.google.com/group...eader=1&q=modal
+form+vb+-.net+alpine+showmodal&_done=%2Fgroup%2Fmicrosoft.public.vb. winapi%2Fbrowse_frm%2Fthread%2F75d3935e7
d40248a%2F0445463fe8ed6bec%3Fq%3Dmodal+f
orm+vb+-. net+alpine+showmodal%26rnum%3D1%26hl%3De
n%26#doc_30e3ec88dfafddc6]

HTH,
Bryan
________________________________________
____________________
New Vision Software "When the going gets weird,"
Bryan Stafford "the weird turn pro."
alpine_don'tsendspam@mvps.org Hunter S. Thompson -
Microsoft MVP-Visual Basic Fear and Loathing in LasVegas



On Sat, 21 May 2005 04:44:02 -0400, "TMan" <getmyemails2@yahoo.com>
wrote:

>Hey Folks,
>
>I'm sure that you are all well acquainted with how when one uses a modal
>form from within Word VBA or the VB environment, one stays within that
>routine until the form is closed and the routine can continue. The opposite
>is, of course, true when using a modeless form from within Word VBA or the
>VB environment (i.e. the code will run completely through the routine).
>
>However, if one loads a VBA form as modal and then, say, clicks a button
>that runs such code as below:
>
>
>
>Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal
>lpClassName As String, ByVal lpWindowName As String) As Long
>
>Private Declare Function EnableWindow Lib "user32" (ByVal hWnd As Long,
>ByVal fEnable As Long) As Long
>
>Public Sub Enabler
> 'Make the form modeless by enabling Word
> EnableWindow FindWindow("OpusApp", Application.Caption), True
>End Sub
>
>
>The behavior will be to make the form modeless such that the user can move
>about in Word but the code will not run until the form is unloaded.
>
>I want to create this same behavior from within the VB environment but it is
>not working.
>
>Any suggestions?
>
>Thanks & Regards,
>
>TC
>


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com