I created a simple Windows Forms app (strongly named)
in VB .NET that automates MS Word XP. The app handles
the Word.Quit event...however my event handler for this
is not being called when my app is launched from
a url on a web page (works fine when I run my app stand
alone). I have a code group that I created for my app
in order to avoid a security exception when creating the
new Word.Application (I created a code group with the
membership condition tied to the strong name of my app
and set the permission set to "FullTrust").

I originally ran into this problem while trying to do
this with a UserControl embedded in a web page, but
found I could reproduce the behavior with a Windows
Forms App launched from a web page.

So can anyone tell me why the Quit event won't fire when
my app is launched from a url?


Here is the code from my Windows Forms app...


Imports Microsoft.Office.Core
Imports Microsoft.Office.Interop

Public Class Form1
Inherits System.Windows.Forms.Form

' Main member var for getting at Word object model
Private WithEvents m_wordApp As Word.ApplicationClass

Private Sub wordApp_Quit() Handles
m_wordApp.ApplicationEvents2_Event_Quit
m_wordApp = Nothing
MsgBox("Word Quit Event", MsgBoxStyle.SystemModal Or
MsgBoxStyle.Information)
End Sub

Private Sub btnLaunchWord_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnLaunchWord.Click
If m_wordApp Is Nothing Then
m_wordApp = New Word.Application()
m_wordApp.Visible = True
End If
End Sub
End Class

--
Scott Herter

Re: Event not called when run from URL by Scott

Scott
Thu Jul 24 14:03:04 CDT 2003

I'm bringing up a test page in my browser by
hitting a URL like this...

http://localhost/test/test.html

...and the test page has a link to my app like this:

<a href='WinApp.exe'>WinApp</a>

I originally found the problem while using my sample
code in a UserControl that I embedded in my test page
(ultimately what I need to get working), but since I could
reproduce the behavior with a link to an EXE I thought
it might be easier to trouble shoot that way.


"alien2_51" <dan.billow@n.o.s.p.a.m.monacocoach.com> wrote in message
news:eBkjAngUDHA.2224@TK2MSFTNGP10.phx.gbl...
> Scott,
>
> When you say that your app is launched from a URL, what mechanism are you
> using to do this..?



Re: Event not called when run from URL by Scott

Scott
Mon Jul 28 11:13:52 CDT 2003

Yes, if I change member ship to "all code" it does work, but we
need to limit things to strong name. I just tried to add additional
code groups for the strong names of the Word interop DLLs, but
that didn't help.


""»OÆW·L³n§Þ³N¤ä´©³¡"" <lukezhan@online.microsoft.com> wrote in message
news:Eu81NBOVDHA.2092@cpmsftngxa06.phx.gbl...
> When you set the code group in framework configuration, if you change the
> member ship to "all code", will this help? Since you only set the strong
> name to your assembly, not inluding the Word interop DLL files, this may
> cause the problem. I tested "all code" in VS.NET 2003, it worked well.
>
> Luke
>
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>



Re: Event not called when run from URL by lukezhan

lukezhan
Wed Jul 30 04:40:50 CDT 2003

You may add the server to trusted site on the client side, and set member
ship for "all code" for one code group in "trusted site.

Luke

"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026?  If not Microsoft strongly advises
you to review the

information at the following link regarding Microsoft Security Bulletin
MS03-026 http://www.microsoft.com/security/security_bulletins/ms03-026.asp
and/or to

visit Windows Update at http://windowsupdate.microsoft.com to install the
patch. Running the SCAN program from the Windows Update site will help to

insure you are current with all security patches, not just MS03-026."