Win Apps

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
JackFoo
Senior Member
Senior Member
Posts: 373
Joined: 2003-02-05, 19:53 UTC
Location: ERROR

Win Apps

Post by *JackFoo »

Hi, I've been thinking of rewriting lst2str into a windows app. instead of a console app.; However I have no experience with win. apps, I replaced

Code: Select all

int main(int argc, char *argv[])
with:

Code: Select all

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
and am now calling the argv as __argv and the same for argc, however despite these changes I can still see the console window popping up, any help would be greatly appreciated.
P.S. All pure C, no C++ or delphi please ;-).

Chears.
User avatar
Aezay
Senior Member
Senior Member
Posts: 269
Joined: 2003-02-12, 07:27 UTC
Location: Denmark
Contact:

Post by *Aezay »

I dont really know, but since there's an Image Subsystem value in the Portable Executeable Optional Header of the exe file, I would guess u have to tell the compiler that it's not a console app somehow.

This Image Subsystem value is 3 if its a console, and 2 if GUI.
Of all the planets I've been to, this one is my favorite.
User avatar
soreno
Junior Member
Junior Member
Posts: 87
Joined: 2003-02-13, 13:04 UTC
Location: Denmark

Post by *soreno »

It depends on your compiler.

You should set the subsystem to "windows" instead of "console"

With MinGW (GCC for Win32) you could link with this parameter:

Code: Select all

-mwindows
With MSVC++ you could paste these lines:

Code: Select all

//#pragma comment(linker, "/subsystem:\"console\" /entry:\"mainCRTStartup\"") 
#pragma comment(linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"")
User avatar
soreno
Junior Member
Junior Member
Posts: 87
Joined: 2003-02-13, 13:04 UTC
Location: Denmark

Post by *soreno »

You can still use

Code: Select all

int main(int argc, char **argv)
when setting subsystem to "windows".
User avatar
JackFoo
Senior Member
Senior Member
Posts: 373
Joined: 2003-02-05, 19:53 UTC
Location: ERROR

Post by *JackFoo »

So simple, damn, I'm deeply vexed. Thanks a lot soreno, -mwindows worked like a charm!!!!

Cheers.
Post Reply