Solved

create a win32 program in borland c++

Posted on 2000-02-29
6
429 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
6 Comments
 
LVL 32

Expert Comment

by:jhance
Comment Utility
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
Comment Utility
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
Comment Utility
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 3

Expert Comment

by:msmits
Comment Utility
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
Comment Utility
hypereng ???
0
 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 200 total points
Comment Utility
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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 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.

743 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now