Click here to Skip to main content
15,908,776 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Ascending order Pin
jhwurmbach11-Nov-03 4:49
jhwurmbach11-Nov-03 4:49 
GeneralRe: Ascending order Pin
iasaber11-Nov-03 5:35
iasaber11-Nov-03 5:35 
GeneralRe: Ascending order Pin
jhwurmbach11-Nov-03 5:50
jhwurmbach11-Nov-03 5:50 
GeneralRe: Ascending order Pin
David Crow11-Nov-03 5:55
David Crow11-Nov-03 5:55 
GeneralDialog in Console Application Pin
imranhabib11-Nov-03 4:18
imranhabib11-Nov-03 4:18 
GeneralRe: Dialog in Console Application Pin
Antti Keskinen11-Nov-03 6:53
Antti Keskinen11-Nov-03 6:53 
GeneralRe: Dialog in Console Application Pin
imranhabib11-Nov-03 10:46
imranhabib11-Nov-03 10:46 
GeneralRe: Dialog in Console Application Pin
Antti Keskinen11-Nov-03 22:10
Antti Keskinen11-Nov-03 22:10 
Okay,

You see, you use the standard C/C++ entry point function 'main' to start your program. This is ok if you were creating a pure console based application. However, a Windows programs starts from 'WinMain' function, and have a bit different parameters. What is happening here is that the pure console application is not very good at working with windows. Not even with OpenGL enabled. To summarize, you have a wrong style of approach to the problem, if you don't mind me saying Smile | :)

The difference between a pure console program and a Windows program is that in a Windows program, the thread can start a full-flexible message pump to handle messages from the main window or it's children. In a pure console program, this message pump is much more limited.

For instructions on how to create a Windows-based console application, read Lanz Jean-Claude's article "QuickWin" located here http://www.codeproject.com/dialog/quickwin.asp?target=windows%7Cconsole%7Capplication[^]

That tutorial will show you how to move your application from the console-based version to a Windows program which has a console redirection enabled.

If you need OpenGL, you can follow the same tutorial, but instead, when creating the splitter frames, create a view which uses OpenGL. The basic idea behind this all is, that now when your program is executed, it will have a full-fledged message pump attached to it, and if you create a new window, it will work properly.

If you are not needing the redirection from the standard console (as is, the DOS prompt in old OS), you can always use the same approach, but instead of creating a frame window, just create a small window with OpenGL view inside it. This is the way most of the small-scale 3D apps (like demos or similar) are made.

The key issue beyond everything is that you use a Windows program entry point, instead of the standard console (DOS) entry point. In order to make everything quick & convenient for yourself, just grab a copy of all code files in your project at this moment, then create a new blank Win 32 Application project in Visual Studio, paste your code files and change the 'main' function to match the correct 'WinMain' call. Now you have a fresh start working under a thread which has a full-fledged message pump support. Remember to add necessary headers and libraries to the new project to use OpenGL, if needed.

To carry on from here, just create a main window with OpenGL view, then start a message pump for the thread. The rest is functionality Smile | :)

-Antti Keskinen



----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
QuestionHow to Change CDialogBar Background Pin
asierra11-Nov-03 4:17
asierra11-Nov-03 4:17 
Generalmouse cursor in console application Pin
imranhabib11-Nov-03 4:16
imranhabib11-Nov-03 4:16 
GeneralRe: mouse cursor in console application Pin
David Crow11-Nov-03 5:58
David Crow11-Nov-03 5:58 
GeneralRe: mouse cursor in console application Pin
Alvaro Mendez11-Nov-03 6:01
Alvaro Mendez11-Nov-03 6:01 
GeneralRe: mouse cursor in console application Pin
imranhabib11-Nov-03 11:09
imranhabib11-Nov-03 11:09 
Generaltwo Questions! Help! Pin
andylaw11-Nov-03 3:47
andylaw11-Nov-03 3:47 
GeneralRe: two Questions! Help! Pin
Antti Keskinen11-Nov-03 10:33
Antti Keskinen11-Nov-03 10:33 
GeneralPorting to PDA Pin
georgiek5011-Nov-03 3:38
georgiek5011-Nov-03 3:38 
GeneralInstalled Apps via WMI or Other Pin
JerryFW11-Nov-03 2:59
JerryFW11-Nov-03 2:59 
GeneralRe: Installed Apps via WMI or Other Pin
Heath Stewart11-Nov-03 3:56
protectorHeath Stewart11-Nov-03 3:56 
GeneralRe: Installed Apps via WMI or Other Pin
JerryFW11-Nov-03 4:11
JerryFW11-Nov-03 4:11 
GeneralRe: Installed Apps via WMI or Other Pin
Heath Stewart11-Nov-03 6:22
protectorHeath Stewart11-Nov-03 6:22 
GeneralRe: Installed Apps via WMI or Other Pin
JerryFW11-Nov-03 7:04
JerryFW11-Nov-03 7:04 
GeneralScreen info Pin
Anonymous11-Nov-03 2:37
Anonymous11-Nov-03 2:37 
GeneralRe: Screen info Pin
David Crow11-Nov-03 2:46
David Crow11-Nov-03 2:46 
QuestionHow to decode an audio bitstream using Directx??? Pin
elza11-Nov-03 1:27
elza11-Nov-03 1:27 
Generalextended procedure for sql server Pin
mhmoud rawas11-Nov-03 1:17
mhmoud rawas11-Nov-03 1:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.