By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,950 Members | 1,032 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,950 IT Pros & Developers. It's quick & easy.

Win32

P: n/a
Hello everyone!

When I start a "Win32 Project" with Microsoft's Visual C++ I can't
produce any output by using my "normal" C++ code that I would use in a
console application. First, I'm not sure if i place my code in the
right position, but I think I'm right as I don't get any error
messages and the comments by Visual C++ tell me the right place:

-----------------------------------------------------------------------------------

[...]

int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);

// TODO: Place code here.

cout << "This is a test!";

[...]

}

[...]

-----------------------------------------------------------------------------------

When I compile this I just get an empty win32 window, and there's
nowhere written "This is a test!". I also included all necessary
header files, and didn't change nothing from the "main code" already
written by Visual C++, I just added "cout << "This is a test!" ".

Flingor

Aug 6 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
fl*****@gmail.com wrote:
Hello everyone!
You have come to the wrong place, try a windows programming group.

--
Ian Collins.
Aug 6 '07 #2

P: n/a
fl*****@gmail.com wrote:
When I start a "Win32 Project" [...]
It's a sad feature of MS Windows: when a program uses GUI, output to console
is hidden. The same happens with Java Swing programs.

Aug 6 '07 #3

P: n/a

Alf P. Steinbach <al***@start.nowrote in message...
* fl*****@gmail.com:
Hello everyone!
When I start a "Win32 Project" with Microsoft's Visual C++ I can't
produce any output by using my "normal" C++ code that I would use in a
console application. First, I'm not sure if i place my code in the
right position, but I think I'm right as I don't get any error
messages and the comments by Visual C++ tell me the right place:
--------------------------------------------------------------

[...]

int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow){
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
// TODO: Place code here.

cout << "This is a test!";

[...]
}
[...]
-------------------------------------------------------------------
When I compile this I just get an empty win32 window, and there's
nowhere written "This is a test!". I also included all necessary
header files, and didn't change nothing from the "main code" already
written by Visual C++, I just added "cout << "This is a test!" ".

Answer's too long to include here (although it's likely that others will
provide technically inaccurate and misleading short answers);
You mean like:

// in main() or ?

MessageBox( 0, "This is a test!", "Hello World",
MB_OK | MB_ICONINFORMATION );

--
Bob <GR
POVrookie
Aug 6 '07 #4

P: n/a
On Aug 6, 1:41 pm, Manuel T <man...@t.govwrote:
flin...@gmail.com wrote:
When I start a "Win32 Project" [...]
It's a sad feature of MS Windows: when a program uses GUI, output to console
is hidden. The same happens with Java Swing programs.
Are you kidding? When I was developping a Java Swing
application under Windows, we regularly output debugging
messages to the standard out or standard error. No problem.

Alf's got an exceptionally good page on this; regretfully, I
don't have the URL on this machine, but maybe he'll cite it
again for us. I'd consider it required reading for anyone doing
Windows programming.

--
James Kanze (GABI Software) email:james.kanze:gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Aug 6 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.