?
Solved

C# ActiveX to call local program

Posted on 2009-04-08
5
Medium Priority
?
1,494 Views
Last Modified: 2013-11-18
I am trying to figure out how to write an ActiveX control in C# to call a local program, lets call it Program1.  I want to pass a XML files through the server to the client and load that XML file into Program1.  Most of the stuff I have found online is about how to write a user control in a webpage, I am trying to actually pass a file  to the client's machine and execute Program1 with the XML file.
0
Comment
Question by:htn5ca
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 24104312
0
 
LVL 29

Accepted Solution

by:
Gautham Janardhan earned 1500 total points
ID: 24104323
http://www.dreamincode.net/forums/showtopic38890.htm
http://www.c-sharpcorner.com/UploadFile/dsandor/ActiveXInNet11102005040748AM/ActiveXInNet.aspx 

using System;
using System.Runtime.InteropServices;
namespace AXComponent 
{
 
public interface AXTest
{
string callMe();
}
 
[ClassInterface(ClassInterfaceType.AutoDual)]
public class AxComp :AXTest
{
public string callMe()
{
return "My dog has no nose, how does it smell?";
}
}
}
 
Compile this using:
csc /t:library AxComp.cs
 
Register and generate Typelib with:
regasm AxComp.dll /tlb:AxCompNet.dll /codebase
 
Try the control: ( testControl.htm )
<html>
<head>
<script language="javascript">
var obNewAXComponent = new ActiveXObject("AXComponent.AXComp");
alert(obNewAXComponent.callMe());
</script>
</head>
<body>
<h1>Awful!</h1>
</body>
</html>

Open in new window

0
 

Author Comment

by:htn5ca
ID: 24163431
Sorry its been awhile but I have been trying this like crazy.  Nothing seems to work.  Right now it says that IE is done but has a problem, it says it cannot create activeX object.  
0
 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 24183156
u will need to enble certain propertis in IE to do that ? is that done ? under tools -> internert options - > advanced
0
 

Author Comment

by:htn5ca
ID: 24187422
The only document that seems to work is
http://www.c-sharpcorner.com/UploadFile/dsandor/ActiveXInNet11102005040748AM/ActiveXInNet.aspx   

But when I try putting in System.Diagnostics.Process.Start("C:\\something.txt") it will not display the text file and says "Request Failed"

I have attached what my IE -> advanced settings are.  In the picture, the last couple are all checked.
IEadvanced.JPG
0

Featured Post

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developer tools in browsers have been around for a while, yet they are still heavily underused by developers. Developers still fix html or CSS then refresh page to see effect, or they put alert or debugger in JavaScript and then try again and again …
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question