C++ form creation at run-time

Does anyone have any resources on creating forms in C++ without using MFC.  I know this is the hard way to do things.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

boodabellyAuthor Commented:
Edited text of question.
Forms?  You mean windows?  You can just use CreateWindow() or CreateWindowEx().  What specifically do you want to know about?
The following is a simple sample windows program that creates a window.
/ Basic window procedure.  This is where you will do most
// of your work to "customize" the window to do what you want.
LRESULT                                          // Result.  Interpretation depends on the        //
                                                           // message being handled.
CALLBACK WndPrc(HWND   WndHnd,                   // >> window.
                UINT   Msg,                      // Message to be handled.
                WPARAM WrdPrm,                   // Word parameter.  Interpretation depends on    
                                                 // message being handled.
                LPARAM LngPrm)                   // Long parameter.  Interpretation depends on
                                                 // message being handled.
   BOOL    Handled = TRUE;                       // Was message handled by this routine?
   LRESULT RetVal  = 0;                          // Value to be returned.                         //

   switch (Msg)                                  // Branch based on message.
   case WM_DESTROY:                              // If this is a destroy window message, then    
      // Make application quite when window is closed.
      PostQuitMessage(0);                        // Post a quite message.
      Handled = FALSE;                           // Indicate message was not handled.
   default:                                      // otherwise, if any other message, then         //
      Handled = FALSE;                           // Indicate message was not handled.             //

   if (!Handled)                                 // If message was not handled, then
      RetVal = DefWindowProc(WndHnd,Msg,WrdPrm,LngPrm);
   return RetVal;                                // Return the return value.  
// Procedure to register the window class.
   HCURSOR    ArwCrs = LoadCursor(NULL,IDC_ARROW);  // Default cursor.
   HBRUSH     GryBrh = GetStockObject(LTGRAY_BRUSH); // Background brush.
   WNDCLASSEX WndCls = {sizeof(WNDCLASSEX),   // Create window class parameter block.
   RegisterClassEx(&WndCls);                     // Try to register the class.
// Procedure to create a window.
HWND  // >> window created.
CrtWnd(char *Ttl) // Window title.
   return CreateWindow("QWnd",Ttl,
                       WS_OVERLAPPEDWINDOW | WS_VISIBLE,
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,
                   int nShowCmd)
   RegWndCls(); // Register the window class.

   MSG      WndMsg;
   HWND WndHnd = CrtWnd("Window Title"); // Create a window.

   // Process messages until a quit message.
   while (GetMessage(&WndMsg,NULL,0,0))
   return WndMsg.wParam;

Is that what you want?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

By forms, I guess boodabelly means dialog boxes that contain various controls. What do you want to do?

boodabellyAuthor Commented:
Yeah, sorry for not being clear.  I was programming in VB for a while and that is what the referred to windows as.  I need to make something like a "form" or "windows".  I am trying to make a heads up display for a game and dont have one yet.  Ill see what I can do with the code that neitod posted.  Or I guess it would be easier to create the graphics and just put them on the screen.
If you need really fast graphics, you might want to look into direct draw.  It a lot more complex thant standard windows graphics, but much more poserful too.

If you don't go the direct draw route, you still will need the to create windows, i.e the code i posted.  Then you will probably want to output the graphics by drawing to an off-screen bitmap and then copyingthe bitmap into your window with BitBlt().

If you are starting windows program through the windows API, you need to get a a good introductory book on windows programming, like Teach Youself Windows in 21 days or the charles Petzold book, whose name has escaped me at the moment.
boodabellyAuthor Commented:
I have a book on Direct Draw & DX6 and game programming for drawing bitmaps off screen and then putting them on the screen.  I am trying to port the code for linux, so I didnt know if there was a viable ( easy ) alternative to that with out having to write a whole lot of classes to handle the graphics in linux.  It might be easier just to stick with windows programming though.  I'll give it a try, but I think for the time being DirectX is the way to go.

Off the subject, do you know if linux supports OpenGL?  I havent checked on that alternative yet.
I have no idea.
AFAIK there's a library called MESA which is an implementation of OpenGL for LINUX
To create a window("form") under Linux is a different story with under Windows. You can't use the standard Windows API, you may choose some existing library like Gtk+, Qt, wxWindow (cross-platform) to do the GUI programming under Linux.

For OpenGL implementation, try this: http://linux.box.sk/box.php3?prj=linux&gfx=linux&srch=OpenGL
www.wxwindows.org has example source using MDI. It is a framework built similar to MFC, though. It also has a library and example source to support OpenGL called glcanvas, allowing graphics in any kind of window,i.e., scrollable, resizeable.
wxWindows source works for Linux, Win32, MacOS, etc.
boodabellyAuthor Commented:
sorry it took so long
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.