Solved

C# ActiveX to call local program

Posted on 2009-04-08
5
1,467 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
  • 3
  • 2
5 Comments
 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 24104312
0
 
LVL 29

Accepted Solution

by:
Gautham Janardhan earned 500 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

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 …
A publishing tool, a Version Control System, or a Collaboration Platform! These can be some of the defining words for the two very famous web-hosting Git repositories: Bitbucket and Github. Git is widely used amongst the programmers and developers f…
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…
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.

831 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