win32 app pass参数 [英] win32 app pass Parameters
问题描述
如何创建一个win 32应用程序并传递参数以使其响应
传递的值?
喜欢winzip" winzip32 -a"
有点像Console args但是我希望能够通过Start run来调用它
helloworld.exe一个??一些东西
有人可以发一个简单的例子或链接吗?
vb.net或者C#
谢谢
Hi,
How do I create an win 32 app and pass parameters to have it respond to the
passed values?
Like winzip "winzip32 -a"
Kinda like Console args but I want to be able to call it via Start run
helloworld.exe a?? something
Can someone post a simple example or a link?
vb.net or C#
Thank you
推荐答案
2005-03-09,André< An ** @ discussion.microsoft.com>写道:
On 2005-03-09, André <An**@discussions.microsoft.com> wrote:
如何创建一个win 32应用程序并传递参数以使其响应
传递的值?
像winzip一样winzip32 -a
有点像Console args但是我希望能够通过Start run
helloworld.exe来调用它?什么东西
有人可以发一个简单的例子或链接吗?
vb.net或C#
谢谢
Hi,
How do I create an win 32 app and pass parameters to have it respond to the
passed values?
Like winzip "winzip32 -a"
Kinda like Console args but I want to be able to call it via Start run
helloworld.exe ? something
Can someone post a simple example or a link?
vb.net or C#
Thank you
class MainForm:System.Windows.Forms
{
[STAThread()]
public static void Main(string [] args)
{
foreach(字符串arg in args){
ParseArg(arg);
}
Application.Run(new MainForm());
}
private static void ParseArg (string arg)
{
MessageBox.Show(arg);
}
}
显然,你会想要对论点做点什么。在VB.NET中你
可以做同样的事情 - 你只需要像这样声明Main:
< STAThread()> _
Public Shared Sub Main(ByVal args()As String)
End Sub
或
< STAThread()> _
公共共享函数Main(ByVal args()As String)作为整数
End Sub
VB.NET设计师如果你不提供它,就会创建一个隐藏的主要方法。
所以,你所要做的就是键入方法签名,你很好
去。
-
Tom Shelton [MVP]
class MainForm : System.Windows.Forms
{
[STAThread ()]
public static void Main (string[] args)
{
foreach (string arg in args) {
ParseArg (arg);
}
Application.Run (new MainForm ());
}
private static void ParseArg (string arg)
{
MessageBox.Show (arg);
}
}
Obviously, you''ll want to do something to the arguments. In VB.NET you
can do the exact same thing - you just declare Main like this:
<STAThread ()> _
Public Shared Sub Main (ByVal args() As String)
End Sub
or
<STAThread ()> _
Public Shared Function Main (ByVal args() As String) As Integer
End Sub
The VB.NET designer creates a hidden main method if you don''t supply it.
So, all you have to do is type in the method signature and you are good
to go.
--
Tom Shelton [MVP]
Andre,
您可以使用字符串数组传递信息
我希望这有帮助吗?
Cor
Andre,
You can pass the information using an array of strings
I hope this helps?
Cor
这是我见过的最奇怪的.vb代码! :)
That''s the strangest .vb code I have ever seen! :)
这篇关于win32 app pass参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!