Creating a GUI without Console in Win2k with VC++6

Hello Rooters,

I am trying to build a standalone Data Aquistion Program using only a GUI. But everytime I run my compiled program not only the gui pops up, also a console comes with it.
How do I get rid of the console for example for the little test program below? I am using Root ver.4.00/03 on a win2k machine with vc++6. I have tried to create a win32 Application, but then the program crashes when startet.
(I have used the WinMain() entry point and extracted the right argc, and argv from LpCmdLine)

Thank you

Lutz

////////////////////MyMainFrame.h//////////////////////////
#ifndef __MyMainFrame_H_
#define __MyMainFrame_H_

#include <TGFrame.h>

class MyMainFrame : public TGMainFrame
{
public:
	MyMainFrame(const TGWindow *p, int w, int h);
	virtual ~MyMainFrame();
	ClassDef(MyMainFrame,1) //GUI example
};
#endif

/////////////////rootguitest.cpp///////////////////////////
#include <TGApplication.h>
#include <TGClient.h>
#include <TGButton.h>
#include "MyMainFrame.h"

MyMainFrame::MyMainFrame(const TGWindow *p, int w, int h) 
	:TGMainFrame(p,w,h)
{
	TGTextButton *exit = new TGTextButton(this,"&Exit",
					"gApplication->Terminate()");
	this->AddFrame(exit, new TGLayoutHints(kLHintsCenterX|kLHintsCenterY,
						20,20,20,20));

	this->SetWindowName("Test");
	this->MapSubwindows();
	this->Resize(this->GetDefaultSize());
	this->MapWindow();
}

MyMainFrame::~MyMainFrame()
{
	this->Cleanup();
	delete this;
}

int main(int argc,char *argv[])
{
	TGApplication theApp("App",&argc,argv);
	new MyMainFrame(gClient->GetRoot(),200,200);
	theApp.Run();
	return 0;
}

Hi,
you should use win32gdk version of ROOT.

Regards. Valeriy

Hi Valeriy,

Thank you for the quick reply. Sorry for the misunderstanding currently I am using the following version of Root:

  *******************************************
  *                                         *
  *        W E L C O M E  to  R O O T       *
  *                                         *
  *   Version   4.00/03     26 March 2004   *
  *                                         *
  *  You are welcome to visit our Web site  *
  *          http://root.cern.ch            *
  *                                         *
  *******************************************

Compiled for win32gdk.

regards,
Lutz

Hello,

In order to disable console, add this statement

/SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup

in your makefile i.e :

LD = link
LDOPT = -opt:ref /SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup

Hope it helps,

Cheers,
Bertrand.

Hi Bertrand,

Yes this works fine. Thank you very much.

Cheers,

Lutz