Solved

C# ActiveX to call local program

Posted on 2009-04-08
5
1,483 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 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Introduction A frequently used term in Object-Oriented design is "SOLID" which is a mnemonic acronym that covers five principles of OO design.  These principles do not stand alone; there is interplay among them.  And they are not laws, merely princ…
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…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

705 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