将命令行参数传递给第一个实例 [英] Passing Command line arguments to first Instance

查看:93
本文介绍了将命令行参数传递给第一个实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!我有一个(希望如此)快速的问题:如何在不使用.NET Framework和ApplicationEvents的情况下,从第一个实例中获取应用程序的第二个实例的命令行参数?我已经尝试过使用Google搜索,但是似乎无法找到正确的搜索词来查找所需的内容.我将非常感谢您的帮助. :)

我已经尝试过 [

Howdy! I have a (hopefully) quick question: How do I get the command line arguments of a second Instance of an application from the first Instance WITHOUT using .NET Framework and ApplicationEvents? I HAVE tried googleing this, but I can''t seem to get the correct search term to find what I need. I would REALLY appreciate any help. :)

I HAVE tried this[^], but it had a couple of problems that I could not figure out.

Thanks in advance!

@First Answer: I think that might be a little advanced for me. :( Is there a simpler way? I found this code, but I think it requires you to have Application Framework enabled. Which I can''t have.

Private Sub MyApplication_StartupNextInstance(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs) Handles Me.StartupNextInstance
     My.Forms.MenuForm.MenuMotionOn(False, True)
     My.Forms.MenuForm.Top = 0
     My.Forms.MenuForm.Activate()
 End Sub


有类似的东西吗?感谢您愿意帮助我:)


Is there something similar? I appreciate your willingness to help me :)

推荐答案

您也可以使用命名管道进行此类通信.

.NET中使用命名管道的进程间通信,第1部分 [ .NET中使用命名管道的进程间通信,第2部分 [ http://msdn.microsoft.com/en-us/library/system.runtime.remoting.channels.ipc.ipcchannel [ ^ ]

祝你好运!
You could also use a named pipe for this kind of communication.

Inter-Process Communication in .NET Using Named Pipes, Part 1[^]

Inter-Process Communication in .NET Using Named Pipes, Part 2[^]

http://msdn.microsoft.com/en-us/library/system.runtime.remoting.channels.ipc.ipcchannel[^]

Good luck!


这篇关于将命令行参数传递给第一个实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆