Lately I was experimenting on my old VB6, and found there a strange thing.
Using ProcMon I found that while compiling, VB6 runs Link.exe with parameters like this:
LINK "D:\Folder\Form1.OBJ" "D:\Folder\Project1.OBJ"... /SUBSYSTEM:WINDOWS,4.0 ... I wrote Link.exe /? in cmd and found there

link.exe /?
usage: LINK [options] [files] [@commandfile]      
    options:      
    ...    
    /SUBSYSTEM:{NATIVE|WINDOWS|CONSOLE|WINDOWSCE|POSIX}

By default VB6 compiles with parameter /SUBSYSTEM:WINDOWS.
But can I compile my VB6 code to Native or POSIX subsystem application?

有帮助吗?

解决方案

This just sets a bit in the resultung exe file. Visual Basic uses Microsoft's standard linker which is also used for C/C++, that's why the flag is there.

So yes, you can compile it with those settings, but I'm certain that the resulting exe won't run in native mode or in the Posix subsystem.

For more information on those settings you might want to check out information about the PE file format and have a look at the DUMPBIN and EDITBIN tools.

其他提示

VB applications uses Win32 calls, so there is no chance your application will work, even if you uses a console-only application.

Console is the only alternative subsystem that is useful. Posix isn't even present since Win2K and Native is for kernel mode drivers.

If any of this is news to you, I wonder why you are playing with ProcMon? Scary.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top