|
-
Oct 29th, 2008, 01:15 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] [2005] DDE In VB.NET
I remember a LONG time ago that I was able to create DDE "channels" between two applications. Is that still possible with .Net? If so does anyone have any examples or articles I could read about this?
-
Oct 29th, 2008, 01:30 PM
#2
Re: [2005] DDE In VB.NET
I think there was some work done at some point to try to make a wrapper to easily use DDE in .NET but I am not sure if it ever surfaced.
Most (if not all) DDE stuff has been replaced by remoting or WCF
-
Oct 29th, 2008, 01:33 PM
#3
Thread Starter
Hyperactive Member
Re: [2005] DDE In VB.NET
So if I need to send data between two applications without file and/or registry access how would I do that running the .NET 2.0 framework without DDE?
-
Oct 29th, 2008, 01:44 PM
#4
Re: [2005] DDE In VB.NET
There are a few ways
1) Using .NET Remoting
2) Using Win API SendMessage/Copy Memory calls (more complex)
.NET remoting has some nice classes, like the IPC protocol classes, which is InterProcess Communication.
-
Oct 29th, 2008, 02:20 PM
#5
Thread Starter
Hyperactive Member
Re: [2005] DDE In VB.NET
I went through the tutorial at http://msdn.microsoft.com/en-us/libr...2e(VS.71).aspx
The main thing I do NOT like it the need of having a .config file. Is there anyway to do .Net remoting without having to have a .config?
Also does anyone have an example of using .Net Remoting. Just need something to learn from.
Thanks.
-
Oct 29th, 2008, 02:38 PM
#6
Re: [2005] DDE In VB.NET
what operating systems are you targetting, and also, is the communication between apps supposed to be 2 way, and is it supposed to be across computers or just across apps?
-
Oct 29th, 2008, 02:54 PM
#7
Thread Starter
Hyperactive Member
Re: [2005] DDE In VB.NET
It is only going to be done on a single workstation targeting Windows XP:
Basically I have an app that is running on a workstation. If the app is executed a second time with a command line switch it sends a message to the first instance of the app with the command line information to execute.
Example:
app.exe /switch "Message"
This will tell the first instance of the app to evaluate the message and show it. Though a "DDE" channel.
I hope I explained that correctly...
-
Oct 29th, 2008, 03:07 PM
#8
Re: [2005] DDE In VB.NET
So is it supposed to be single instance then? Only 1 instance should run at a given time, and if a second instance is launched with command line params, it should send those to the first instance?
That functionality is built right into the application framework for VB, which features events like ApplicationStartup and ApplicationStartupNextInstance.
Is that what you are looking for? or something else?
-
Oct 30th, 2008, 09:35 AM
#9
Thread Starter
Hyperactive Member
Re: [2005] DDE In VB.NET
So how would I pass the arguments to the first instance using Application.StartupNextInstance?
-
Oct 30th, 2008, 12:54 PM
#10
Re: [2005] DDE In VB.NET
Thats the point, you don't have to. StartupNextInstance fires in the FIRST instance, when the SECOND instance is opened, bring with it the command line params passed to the second instance, so the first instance can handle them.
Make sense?
-
Oct 30th, 2008, 01:00 PM
#11
Thread Starter
Hyperactive Member
Re: [2005] DDE In VB.NET
I think so...
Do you have a small example of this? In VB 2005 My.Application.StartupNextInstance does not appear to be valid...
-
Oct 30th, 2008, 01:06 PM
#12
Re: [2005] DDE In VB.NET
In your project, you need to go to project properties.
Once you are in the properties page, make sure the first vertical tab is selected (Application tab). it should be selected by default anyway.
In this screen, make sure the "Enable Application Framework" is checked, and under that, make sure "Make single instance application" is checked off.
After that, look down to see the button that says "View Application Events" (You might need to scroll a little)
Clicking that button brings you to a code window. Once in there, select "(MyApplication Events)" from the left drop down atop the code window, and then from the right drop down, select StartupNextInstance.
That creates the stub for the event, and you can then code in there.
Note the eventargs variable e has 2 important properties for you to use in your code here.
e.BringToForeground
and
e.CommandLine
BringToForeground is a boolean you can set to make the first instance become focused when a second instance it attempted to be launched.
CommandLine is a readonly array of strings which are the command line params used when trying to launch the second instance. They have been sent back to the first instance so you can handle them in this routine.
-
Oct 31st, 2008, 06:28 AM
#13
Thread Starter
Hyperactive Member
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
|