Jump to content
  • Advertisement
Sign in to follow this  

How to remove the console?

This topic is 4337 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a Java jar file which contains a program I wish to run. However, I want to make a simple bootstrap program in C to get it running without the need to open up the console. Originally, I just had some jazz along the line of
#include ...
int main() { 
    system("java -jar myjar.jar"); 
    return 0;
}
But the windows console appears (albiet blank). My question is how to I get rid of the console entirely? I thought that maybe if I switch it over to a WinMain, Windows would interpret this as meaning my program is a windowed application, but alas, it still shows the console:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, 
					LPSTR lpCmdLine, int nCmdShow) {
	system("java -jar myjar.jar");
	return 0;
}




So how do I write this simple "launcher" program without opening a new console?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Red_falcon
If you use VS you can right click on project and set the environment in settings from console to windows

The project's subsystem has nothing to do with the call to system. You can use ShellExecute to do this.
An example with the command-prompt: "ShellExecute(NULL, NULL, "cmd", "/c echo dummy > Dump.txt", NULL, SW_HIDE);" -> Dump.txt will contain "dummy", and the console window will never be visible.
In your case, I guess you will need to specify SW_NORMAL, though and obviously replace the data with your own...

Share this post


Link to post
Share on other sites
Hmmm. Well, it sorta worked. Now the main issue I'm having is that my application is written in jython, and so, takes about 10 seconds to load. My users are going to think the application is having troubles launching =-/

Oh well. I'll figure something out.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!