|
-
Sep 10th, 2004, 06:37 PM
#1
Thread Starter
PowerPoster
[RESOLVED] ActiveX exe
Regarding;
http://msdn.microsoft.com/library/de...ualbasic70.asp
How can a class library be the equivelant of an Active X exe if you it compiles to a dll? Can you execute the resulting dll like an exe (I wouldnt think so)? What am I missing?
Why would MSFT get rid of, with dot net, the concept of being able to develop an executable that has a programming interface (ie ActiveX exe) when so many of their products are just that ...
I really want to "get with the times" and jump on the dot net bandwagon ... but I really need to be able to build an exe that can be run standalone or accessed programatically through a programming interface.
Is there a dot net solution for me???
Thanks for any help!
Last edited by Muddy; Sep 13th, 2004 at 05:43 AM.
-
Sep 10th, 2004, 09:35 PM
#2
You can't run a dll but you can reference an exe. If you can't reference it directly you can still load it via code (kind of like late binding).
ActiveX was basically COM and .NET is a different model thus it doesn't follow COM.
Now having said that the more proper solution should probably be (IMHO) to have the interface as a seperate dll and have an exe run it. That allows you to have both. Unless you mean being able to share the same instance of an object via an ActiveX exe in which case .NET has remoting which can do that and more.
-
Sep 11th, 2004, 06:28 AM
#3
Thread Starter
PowerPoster
Originally posted by Edneeis
You can't run a dll but you can reference an exe. If you can't reference it directly you can still load it via code (kind of like late binding).
ActiveX was basically COM and .NET is a different model thus it doesn't follow COM.
Now having said that the more proper solution should probably be (IMHO) to have the interface as a seperate dll and have an exe run it. That allows you to have both. Unless you mean being able to share the same instance of an object via an ActiveX exe in which case .NET has remoting which can do that and more.
Thanks Edneeis!
I have been unsuccessful at referencing an exe or even finding any examples. Would you be able to point me to some examples of referencing a dot net exe from another dot net app? Also a point to a remoting example would be nice.
Thanks again!
-
Sep 11th, 2004, 04:19 PM
#4
Well it appears the IDE blocks you from making a normal reference to an assembly with an 'exe' extension but you could late bind or load it through code:
VB Code:
Dim asm As Reflection.Assembly = Reflection.Assembly.LoadFile("c:\path\exe.dll")
Dim obj As Object = asm.GetType("MyNamespace.MyObject")
What exactly are you trying to do?
To get traditional referencing you will need to abstract the interface or shared objects into a dll. This would be required even for remoting. Sorry I don't have any really good references for remoting try search this forum or google. Or if you tell me more maybe I'll make an example.
.NET also has the GAC (Global Assembly Cache) where you can register an assembly and then reference it from a central location instead of having the file in the bin.
It really depends on what you are trying to accomplish.
Couldn't you just put the objects in a dll and the app/ui bits in the exe and reference the dll from both apps? That is the simplest method.
-
Sep 11th, 2004, 08:56 PM
#5
yay gay
It might sound stupid but if you rename the .EXE to .DLL it will work good
\m/  \m/
-
Sep 11th, 2004, 09:17 PM
#6
Lively Member
I have a very similar situation. I have a windows application written in C#, actually in VB.NET as well (just for fun) and I've also created a Windows Control library which contains a usercontrol that holds some textboxes and button. After building the control library I added the usercontrol to my windows application (dropped it on the form). This automatically created a reference to the control library (I guess it's a dll at this point??), so accessing it is no problem. The problem I'm running into is being able to reference back to the windows application from the usercontrol class. For example, when I click the button on the usercontrol it fires the click event in the usercontrol class, but once it's done processing the windows form appears and the application is once again idle. I need to be able to reference back to the windows application before processing ends in order to update some variables, but how. I was told to create an EventHandler then raise the event from within the button's click event, which I did but I can't get it to work b/c the reference to the windows application from the usercontrol class is not there.
What is the best way to create this reference??
I really appreciate any help.
-
Sep 11th, 2004, 11:38 PM
#7
You should have a reference to the host of the control via its Parent property which should be there by default if you inherited from Control or something like it.
-
Sep 12th, 2004, 09:48 AM
#8
Thread Starter
PowerPoster
Originally posted by Edneeis
Well it appears the IDE blocks you from making a normal reference to an assembly with an 'exe' extension but you could late bind or load it through code:
VB Code:
Dim asm As Reflection.Assembly = Reflection.Assembly.LoadFile("c:\path\exe.dll")
Dim obj As Object = asm.GetType("MyNamespace.MyObject")
What exactly are you trying to do?
To get traditional referencing you will need to abstract the interface or shared objects into a dll. This would be required even for remoting. Sorry I don't have any really good references for remoting try search this forum or google. Or if you tell me more maybe I'll make an example.
.NET also has the GAC (Global Assembly Cache) where you can register an assembly and then reference it from a central location instead of having the file in the bin.
It really depends on what you are trying to accomplish.
Couldn't you just put the objects in a dll and the app/ui bits in the exe and reference the dll from both apps? That is the simplest method.
Sorry I am such an OOP moron, but I am having difficulty understanding what you are saying.
Maybe if I explain what I am doing as you suggested:
I am evaluating whether or not to convert an existing large ActiveX exe app to dot net. Since a synopsis of the existing app would be too much (from a learning perspecitive for me) I will try to simplify the basic concepts I want to mimic.
I have 2 Classes ... Human and House
I have an application that instantiates the objects and simulates Humans entering and leaving the House. The user controls the number of Houses and Humans and other influencing inputs via a control panel.
The user can also programatically (via COM with the ActiveX exe) control the number of Houses and Humans and other influencing inputs with things like:
objSim.Humans.Count =10
objSim.House.OnFire = True
objSim.Simulate
objSim.ShowResults
Probably not a hard thing to do if I can just get headed in the right direction.
Thanks for all the help so far!
-
Sep 12th, 2004, 11:29 PM
#9
Here is a very simple example of just using a shared dll and an exe. It contains 2 solutions, MuddyActiveXExe has what would be your current ActiveX exe, or in other words it has a common dll and an exe which uses that common dll. The other solution is an example of what a client or other developer would do to use the objects in another app.
If you needed to share specific instances across applications then you'd need to use remoting.
-
Sep 13th, 2004, 05:42 AM
#10
Thread Starter
PowerPoster
Originally posted by Edneeis
Here is a very simple example of just using a shared dll and an exe. It contains 2 solutions, MuddyActiveXExe has what would be your current ActiveX exe, or in other words it has a common dll and an exe which uses that common dll. The other solution is an example of what a client or other developer would do to use the objects in another app.
If you needed to share specific instances across applications then you'd need to use remoting.
Thanks! I just had a look and this definitly helps!
Thanks again!
-
May 9th, 2018, 01:10 AM
#11
Member
Re: [RESOLVED] ActiveX exe
 Originally Posted by Edneeis
Here is a very simple example of just using a shared dll and an exe. It contains 2 solutions, MuddyActiveXExe has what would be your current ActiveX exe, or in other words it has a common dll and an exe which uses that common dll. The other solution is an example of what a client or other developer would do to use the objects in another app.
If you needed to share specific instances across applications then you'd need to use remoting.
Sorry to dig-up such an old post, but any chance you could repost those sample projects, as they do not appear to be linked anywhere?
Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|