cant print to screen

I have a basic Win32 dialog program that I need to turn into a command line program. I've got everything done, but none of the printf or cout statements are printing to the console so that I can see progress etc. I cant use messageboxes because this will be run in a batch format.

Am I missing something?
Are you using int main(); instead of WinMain() ?
Its a WinMain call
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

I have to still be able to use it as a dialog app as well.

So I need both, the windows dialog and to be able to run it without the window
You can create dialogs from an application using int main();

I am going to guess, but with WinMain you'll need to create your own console, then redirect stdout to it.
Does that mean I have to convert the WinMain into a main()? I dont know how to do this. I still need the windows dialog to work properly though.

ANy ideas?
Somewhere at the beginning of your WinMain() call AllocConsole().

You will then have to hook up the standard streams.
http://www.halcyon.com/~ast/dload/guicon.htm

Have fun!
Topic archived. No new replies allowed.