在 Windows 上编写轻量级 GUI 程序的最快路径是什么? [英] What is the quickest path to writing a lightweight GUI program on Windows?
问题描述
我想要一个小的 (<30MB) 独立 Windows 可执行文件(单个文件),它创建一个窗口,询问用户目录的位置,然后在该目录中启动不同的程序.
I want a small (< 30MB) standalone Windows executable (a single file) that creates a window which asks the user for the location of a directory and then launches a different program in that directory.
此可执行文件必须在 XP、Vista、Server 2003 和 Server 2008 版本的 Windows 上以 32 位和 64 位 x86-64 架构以及安腾芯片运行.
This executable has to run on XP, Vista, Server 2003, and Server 2008 versions of Windows in 32-bits and 64 bits on x86-64 architecture as well as Itanium chips.
如果我们只需要构建一次就可以在所有这些平台上运行它,那将会很壮观,但这不是必需的.这是针对专有系统的,因此 GPL 代码是禁止使用的.
It would be spectacular if we only had to build it once in order to run it on all these platforms, but that is not a requirement. This is for a proprietary system, so GPL code is off-limits.
将这些组合在一起的最快方法是什么?
What is the fastest way to put this together?
这些是我正在研究的一些事情,所以如果你有关于它们的可行性的信息,我就是这样:
These are some things I'm looking into, so if you have info about their viability, I'm all about it:
- Perl/Tk 使用 perl2exe 获取二进制文件.
- Ruby 与 wxruby
- 学习 MFC 编程,并像其他人一样以正确的方式进行编程.
推荐答案
WSH 脚本怎么样?它不会是一个 exe,对,但是要请求一个文件夹,我认为不需要 exe 文件,更不用说 30Mb 的了...
What about a WSH script? It won't be an exe, right, but to ask for a folder I don't see the need for an exe file, much less a 30Mb one...
一个 1Kb 的脚本,用 vbs 扩展名保存为任何你喜欢的名字并运行它.如果不清楚,它会询问您的文件夹名称,然后从 system32 子目录运行 calc.exe.您当然可以在 2 或 4 Kb 中做得比这更好.
A 1Kb script, save it as whatever name you like with vbs extension and run it. This, in case it's not clear, asks you for a folder name and then runs calc.exe from the system32 subdirectory. You can of course do a lot better than this in 2 or 4 Kb.
Set WshShell = WScript.CreateObject("WScript.Shell")
win = InputBox("Please type your Windows folder location.")
If Right(win,1) <> "\" Then
win = win & "\"
End If
WshShell.Run win & "system32\calc.exe"
要添加文件夹浏览器对话框而不是输入框,请检查这个.
To add a Folder Browser dialog instead of an InputBox, check this out.
明显的好处是:
- 简单(好吧,VB 很丑,但如果您愿意,可以使用 JScript),无需编译!
- 兼容性,适用于所有 Windows 机器我有(从 98 开始)
- Simplicity (well, VB is ugly, but you can use JScript if you prefer), no need to compile it!
- Compatibility, works on every windows machine I have available (from 98 onwards)
这篇关于在 Windows 上编写轻量级 GUI 程序的最快路径是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!