Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / May 2005

Tip: Looking for answers? Try searching our database.

Launching .NET Windows App from within InfoPath?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gustaf Liljegren - 06 May 2005 16:56 GMT
I made a Windows app in C# using .NET VS 2003. It's loosely related to a
group of InfoPath forms I made, so I want to add a button on a custom
toolbar to launch this app from within InfoPath. It's just a convenience
for my users. I learned how to add the button by editing the XSF file,
but how to I launch the Windows app from that button?

Ideal would be to install this button so that it's independent of the
form loaded, because there's a lot of form templates I have to modify
otherwise (but this is not a requirement).

Gustaf
KjellSJ - 08 May 2005 16:36 GMT
Using the WScript.Shell will let you start other applications:
var WshShell = new ActiveXObject("WScript.Shell");
var oExec = WshShell.Exec("calc");

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/w
slrfexecmethod.asp


You will get a security warning when the script runs, and might need to make
your form run under full trust.

KjellSJ
http://kjellsj.blogspot.com

> I made a Windows app in C# using .NET VS 2003. It's loosely related to a
> group of InfoPath forms I made, so I want to add a button on a custom
[quoted text clipped - 7 lines]
>
> Gustaf
Gustaf Liljegren - 10 May 2005 13:47 GMT
> Using the WScript.Shell will let you start other applications:
> var WshShell = new ActiveXObject("WScript.Shell");
[quoted text clipped - 4 lines]
> You will get a security warning when the script runs, and might need to make
> your form run under full trust.

When I run this script from the InfoPath Script Editor, all I get is the
contents of script.js in the web browser.

I have made the button in the XSF file like this:

<xsf:toolbar name="myToolbar" caption="My Toolbar">
  <xsf:button caption="My Button" icon="1" tooltip="My Tooltip"
    name="MyFunction"/>
</xsf:toolbar>

First, the icon doesn't show up. I tried adding a 16x16 BMP in the
resource file from InfoPath, but writing the filename in the icon
attribute didn't help. One book suggested this is an integer, so writing
"1" there seems logical.

Secondly, nothing happens when I press the button. There seem to be no
connection between the name attribute and the MyFunction function in
script.js.

Gustaf
Brisk - 09 May 2005 17:33 GMT
1.add code to the click event of your button
2.instantiate your windows app
  MyWindowsApp myApp = new MyWindowsApp(); // this will likely require
a 'using' reference

3. call the myApp.Show() or myApp.ShowDialog() method
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.