Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

create a win32 program in borland c++

Posted on 2000-02-29
6
Medium Priority
?
465 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 600 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

618 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