Hy. I'm using Borland's C++ Builder 5. How can I acces the Windows API from this compiler? I would like to know a little more about API and their usage, so, can someone redirect me to a tutorial? Thanks.
Hy. I'm using Borland's C++ Builder 5. How can I acces the Windows API from this compiler? I would like to know a little more about API and their usage, so, can someone redirect me to a tutorial? Thanks.
I don't know of any specific tutorials for doing win api stuff with bcb5 but I am familiar with simple stuff using the command line tools. I also played around with bcb4, which the following refers to (I originally posted it elsewhere):
Builder is great for RAD of GUI apps but doesn't lend itself (IMO) very easily to win32 projects.
It can be done, however, but I could not remove dependencies on the vcl (visual component library) as the borland IDE doesn't seem to permit hyperfine compiler & linker switch selection. I could be wrong of course as I often am.
First off my advice would be to abandon the ide and use the cmd line tools via make as it will liberate you from the bloat imposed by the vcl.
If you still want to use builder then:
1. Create a new project. Remove the form and all units from it.
2. Builder has a default project cpp file with the WinMain fn in it. Find this file and copy and paste some typical 'hello world' code in there.
3. Amend the <#include windows.h> line to read <#include windows.hpp>. Alternatively you can replace that line with these two lines:
#include <vcl.h>
#pragma hdrstop
which will accomplish more or less the same thing. In the latter case the build will take slightly longer and the exe will be larger.
4. If you want a 'release' build then from the menu select project->options. A tabbed dialog box should appear. In the linker tab make sure that 'use dynamic rtl' is NOT checked, otherwise you will have to distribute borland run-time dll's with any apps you make. Also uncheck 'use debug libraries'. In the 'compiler' tab, click the 'release' button to set-up some std release compiler configuartions.
5. Build the project.
Note that there may be some differences in your bcb5 version, extra features etc that may help you improve on this. If not, it is almost definitely true that exes produced from wthin the IDE will be larger in size than any you create from the command line from makefiles.
The information here is fairly general and may be adapted to most win32 examples you may find.
Alternatively I think some of NeHe's tutorials have been adapted to use borland builder 4/5. A perusal of them may refine your techniques.
Good luck with your experiments.
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.