Solved

create a win32 program in borland c++

Posted on 2000-02-29
6
455 Views
Last Modified: 2008-02-26
I have recently downloaded the free version of borland c++ form www.inprise.com and I don't know how to make a Windows program. Could someone please tell me the basic princips in creating a windows application in borland c++ (which headers to include, the WinMain function, how to create windows/forms etc.) I would also like an URL.
0
Comment
Question by:hypereng
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 2568215
Probably the best place to start is the book, Programming Windows" by Charles Petzold.  This is, in my opinion, the most fundamental Windows programming text and contains a wealth of information and background.

The examples are very abundant and the explanations are excellent.
0
 
LVL 22

Expert Comment

by:nietod
ID: 2568327
I would definitely definitely agree with jhance.  Your question requires about 200 pages of text to answer.  Obviously we aren't going to type them all and fortunately they have already been typed and bound for you and are available at your local bookstore.  After you read a good book or two (or maybe during) ask questions for what you don't understand or couldn't find.  That would be a much more "reasonable sized" question.  

I'll paste a sample starter windows program, but it really is meaninless without the 200 pages of accompanyment.

*********************

// 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.
      break;
   }
   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.
void
RegWndCls(void)
{
   HCURSOR    ArwCrs = LoadCursor(NULL,IDC_ARROW);  // Default cursor.
   HBRUSH     GryBrh = GetStockObject(LTGRAY_BRUSH); // Background brush.
   WNDCLASSEX WndCls = {sizeof(WNDCLASSEX),   // Create window class parameter block.
                        CS_DBLCLKS,
                        WndPrc,
                        0,
                        0,
                        GetModuleHandle(NULL),
                        NULL,
                        ArwCrs,
                        GryBrh,
                        NULL,
                        "WndClsNam",
                        NULL};
   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,
                       CW_USEDEFAULT,CW_USEDEFAULT,
                       CW_USEDEFAULT,CW_USEDEFAULT,
                       NULL,NULL,GetModuleHandle(NULL),NULL);
}
//------------------------------------------------------------------------------------------------//
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))
   {
      DispatchMessage(&WndMsg);
   }
   return WndMsg.wParam;
};
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 2568508
What version of BC you download?
In 3.1 you can't make 32b Windows apps.
In 4.52 can, but with problems.
Really you can make 32b Windows apps
only with BC 5.x
Many examples you can find in you bc5\examples directory.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:msmits
ID: 2570837
It seems that Borland->Inprise->Corel has made the basic compiler of C++Builder 5 available for free download at:

http://www.borland.com/bcppbuilder/freecompiler

The package doesn't seem to support Windows programming, as the headers and libs are not there. You have to buy the C++Builder 5 package for that, which also provides easier use for non-expert Windows programmers.

If you are really interrested in Windows programming the mentioned book is the basis of it all.
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 2581196
hypereng ???
0
 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 200 total points
ID: 2588147
hypereng, wee need you reaction !
May be this demand you to react.
An i repete my proposal: Borland examples of Window programming.

To nietod and msmits:
If i get PTS for this Q, i'll send you
same summ.
Alex
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question