Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • October 01, 2016, 05:27:17 AM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Learning C++ Builder  (Read 15558 times)

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 36,278
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Learning C++ Builder
« on: April 08, 2006, 07:02:48 AM »
As someone who is quite fond of C++ builder, I'm happy to help people out who might want some help using it.
I'll try to post some tutortials and walkthrough throughout the course of the contest.

Feel free to ask any c++ builder (bcb) related questions here, or in the #bcb channel on efnet where I also hang out.

Carol Haynes

  • Waffles for England (patent pending)
  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 7,985
    • View Profile
    • Dales Computer Services
    • Donate to Member
Re: Learning C++ Builder
« Reply #1 on: April 08, 2006, 07:20:26 AM »
This would be good. I have a copy of C++ Builder 4 Pro - is that still serviceable as the upgrade prices are ridiculous for a novice/home user!

Does anyone know what is contained in their student offering? It is for sale on the website but you can only find it by typing the word 'student' in the search box and there are no details.

Here is the UK Borland store entry

It doesn't seem to exist on the US site?
« Last Edit: April 08, 2006, 07:23:12 AM by Carol Haynes »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 36,278
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Learning C++ Builder
« Reply #2 on: April 08, 2006, 07:30:46 AM »
builder 6 is still very usable.
builder 5 is usable.

below that you are probably asking for trouble.

a better experience might be to use the trial version of 2006 edition for now, and i will check more about possible home/student/noncommerical discounts.

Smirf

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 59
    • View Profile
    • SMIRF -> OCTOPUS Chess Project
    • Donate to Member
Re: Learning C++ Builder
« Reply #3 on: April 11, 2006, 05:14:47 PM »
Well, there are some questions, where I am not sure, how to act correctly within new BDS2006 compared to BCB6:

a) how to assistedly insert new methods, functions, properties or variables?
b) how to have listed functions ordered alphabetically?

Regards, Reinhard.

Shed

  • Honorary Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 26
    • View Profile
    • Donate to Member
Re: Learning C++ Builder - The TMediaPlayer Component...
« Reply #4 on: April 18, 2006, 07:21:34 AM »
HOW PLAY MUSIC MIDI IN OUR BUILDER APPLICATIONS
-----------------------------------------------------------------------------------------------------------------------

Select the MediaPlayer Component....from SYSTEM Tab....and Drop into main Form of the applicacion....

The Form looks now with the MediaPlayer component with this visible buttons.....



Follow we can modify the property .......MediaPlayer->AutoOpen to True

Then when the Form loads , the MediaPlayer is opened automatically when the application starts....



Also we need a *.MID file for music playing.......you have a midi song included with the source code here:

http://www.cyberscop...dune/images/Tutorial - Playing Midi Files.zip

 This Midi song, it's assigned to MediaPlayer->Filename property...

If you want "don't show" the component, then you must assign -False- to Visible property in properties Editor

(for example for background music ambience or other buttons pre-defined by you....)




Finally, we starts reproduction in constructor of MainForm

//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{

MediaPlayer1->Open();
MediaPlayer1->Play();
}
//---------------------------------------------------------------------------




//And we've done! Midi Music playing!
« Last Edit: April 19, 2006, 01:36:56 AM by Shed »

Smirf

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 59
    • View Profile
    • SMIRF -> OCTOPUS Chess Project
    • Donate to Member
Re: Learning C++ Builder
« Reply #5 on: April 18, 2006, 09:27:32 AM »
Quote from: SMIRF
a) how to assistedly insert new methods, functions, properties or variables?
Quote from: Shed
MediaPlayer Component....
An existing component is very different from a to be created function or method.
In BCB6 that task has been easy to be done, but how to do it now in BDS2006? That has been the question.

Reinhard.


Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Points: 1
  • Posts: 7,651
    • View Profile
    • The Blog of Deozaan
    • Read more about this member.
    • Donate to Member
Re: Learning C++ Builder
« Reply #6 on: April 18, 2006, 07:55:39 PM »
What is that? Borland's visual C++ program?

I'd love to learn c++ but most of the tutorials and examples I've found online won't compile correctly using microsoft's visual c++ 2005


Shed

  • Honorary Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 26
    • View Profile
    • Donate to Member
Re: Learning C++ Builder
« Reply #7 on: April 19, 2006, 01:38:40 AM »
Yes ...my example (MIDI files playback) it's made with Borland C++ Builder compiler (the easy and powerfull way to have the truly C++ visual coding at your fingertips)

Visual programming, means that compiler have special helpers or procedures to help you developing applications, but NOT means "all is made for you simply clicking the mouse" ...mostly, you must KNOW what are you doing for add your OWN functions (written by you)

important things you must know, is that compiler, have following main things:

1st) have some kind of C and C++ knowledges (for this i recommend begin with a User's Manual for C languaje and after study and practice with console applications, try with C++ lenguaje (that is like C but with more things and Object Oriented programming)

- IDE (Integrated Development Environment)  This is the Main Pannels etc when you start the C++ Builder compiler

- VCL (Visual Component Library) it's the standard function library available into the IDE, it have the components and functions               
                                              that you'll use in your projects.

This is the COMPONENT PALLETTE and IDE menu, (with the AsyncPro components...this is a 3rd party component library


- COMPONENTS (it's like library functions (known as VCL) that have the necessary code to MAKE some kind of work)
           |         (for example, we have components for make a FTP connection to a server, a visual GRID for view data, etc)
           |             This components, are sorted by a TABBED control, with different sections,
           |              (Standard, FastNet, BDE, Interbase, Office,...etc etc)
           |   
           |              One thing that you must have in mind, is that the Component VCL can be "extended" with components       
           |                  developed by 3rd party components....
           |
           |--->Properties  (define some things for each component....for example FONT property defines with kind of Font                         
           |                                have the component....(size, bold, font type etc...)                                           
           |
           |--->Events (for each component in application, happens some kind of events, for example, OnClick event,
           |                             manage what will DO the component, when the user Clicks with Mouse on it)
           |
           |--->Methods (it's some "internal" functions that the component have into....for example the Method for a
                                           TTable component (that manage a DataBase Table), have the method TTable->First();                       
                                            that positioning the selected registry of the Table, to First registry on the Table.


- IDE Options for Compile, Debugging, and editting your project source code files,

- F1 Help File system (once you're developing, perhaps you NEED know something about some function or parameter or something....for help you, C++ Builder have a Visual Help File, that contains help system for all functions, and things related to development environment....it's usefull know a bit this file, for further use when you don't know use a function or something

Also you must know the difference between DESIGN and RUNTIME modes....for example, a control can be VIEWED at Design Mode, but in Runtime mode can't be visible (it's there, but HIDDEN.....(visible propertie = False))

And remember...if you're thinking to introduce programming world, you must have another thing in mind-...

READ THE DOCUMENTATION of USE

what i'm saying...yes...exactly your'e reading...common attitude on people...is want make things BEFORE read the user manual or README files....it's important know if you're thinking make things, know how it works is essential....no?

Then, just before playing with a thing....take a view to Documentation of use....some times this save you a lot of hours...


Also, important to remember, if you have enough "skilled" you can build your own components at your own convenience, but if you're not expert coder, it's a bit difficult made this...
« Last Edit: April 19, 2006, 02:42:32 AM by Shed »

Shed

  • Honorary Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 26
    • View Profile
    • Donate to Member
Re: Learning C++ Builder - Older Console Applications
« Reply #8 on: April 19, 2006, 02:29:07 AM »
Perhaps, some people say....wow...Visual Programming it's very hard for me....i need begin older stylish...with a console application, (ok good...the IDE of C++ Builder also allow console applications....)

For it, you need Click on the main top menu File->New->Other ....and select Console Wizard (this is for generating the new project for a console application)

Console wizard allows select kind of languaje (C or C++) and if it's multithreaded, etc...

when you create the console, you've the standard *.c    or    *.cpp file for procedural coding

here, you can write old style coding...things like main function with arguments....void main(int argc, char argv[])...
this is,...C standard coding...

//---------------------------------------------------------------------------

#pragma hdrstop
#include <conio.h>
#include <stdio.h>

//---------------------------------------------------------------------------

#pragma argsused
int main(int argc, char* argv[])
{
 int x = 0;

  clrscr(); //this function clear the text screen

  for(x=1; x<12; x++)
  {
    //we use gotoxy function for place the cursor
    //and print 12 Hello world to screen

    gotoxy(30,x);
    printf("hello world");

  }

  getch(); //wait keystoke by user for exit
}
« Last Edit: April 19, 2006, 02:34:39 AM by Shed »

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,650
    • View Profile
    • App's Apps
    • Read more about this member.
    • Donate to Member
Re: Learning C++ Builder
« Reply #9 on: April 19, 2006, 02:45:44 AM »
Now why couldn't this be a Delphi contest?
Or for any language that Borland supports?  :(

I hate C/C++...I tried it...too cryptic for me.

Never got past printf() and scanf() in C.

Sure, BCB looks just like my Delphi 6, and probably acts a lot like it too...but to me it's like trying to program in Chinese.

Shed

  • Honorary Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 26
    • View Profile
    • Donate to Member
Re: Learning C++ Builder
« Reply #10 on: April 19, 2006, 03:12:05 AM »
hello...looks...some differences between pascal and c++

- In C/C++ lenguage, you use 'Include' directive for include files with header files (i think in Delphi this is PAS Units but don't know very well.....)

- C++ uses open and close brackets ---- {    and    } for delimit blocks.....not Begin and End

- properties are referenced by -> operator...

   but also, accesing to some structure members or conversion routines in execution...can be obtained with '.' character

    example accessing a property in a TTable component:

Quote
TTable->Filtered = True;   //enabling filtering for Table

    example accessing format converting method:

Quote
AnsiString String_question = "Pascal or C++?? that's the question";
char other_string[200];
   
            other_string = String_question.c_str();  //we're converting from Ansistring type, to C standard formatted string
                                              // some others are -----   .ToInt()
                                              //                                  .ToDouble();   ... etc...
           


- the end of line in C and C++ it's always marked with ';' character

- assign to variables ...is not ':=' operator....just '=' operator for assign the value....or '==' operator to compare with something

- Strings are delimited by double quotation character ....not simple quotation....except in some cases...


hope this helps you understand C++ code
« Last Edit: April 19, 2006, 03:31:53 AM by Shed »

Rover

  • Master of Smilies
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 630
    • View Profile
    • Donate to Member
Re: Learning C++ Builder
« Reply #11 on: April 19, 2006, 06:55:53 AM »
Way back in the 1980's (big hair, bad music) someone created a neat little file that made C look almost exactly like Pascal.  They used the (brain dead moment here...) pre-compiler thing.  Ughh! 

In C you can create shortcuts for almost anything and just before the source code is sent to the complier, it is run through a find/replace process.  I can't remember what it's called... too sticking early in the morning ...
Anyway it would basically allow something like this:

Define BEGIN  {
Define END     }

So that:
 BEGIN
   do some fancy programming stuff;
   programmers are cool;
 END

Would be converted to
 {
   do some fancy programming stuff;
   programmers are cool;
 }

It was pretty cool, but just enough different from real pascal to make it a pain to try to use.  ;D

Someone help my brain and tell me what that whole process is called before I freaking die.  :'(
Insert Brilliant Sig line here

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 36,278
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Learning C++ Builder
« Reply #12 on: April 19, 2006, 07:04:57 AM »
you are talking about the C++ Preprocessor (http://www.cplusplus...al/preprocessor.html).
the subject of much debate and misuse, which can be made to do some strange stuff.

by the way if you thought that was confusing, you might enjoy:
The International Obfuscated C Code Contest
http://www0.us.ioccc.org/main.html

Official Goals of the Contest
  • To write the most Obscure/Obfuscated C program under the rules below.
  • To show the importance of programming style, in an ironic way.
  • To stress C compilers with unusual code.
  • To illustrate some of the subtleties of the C language.
  • To provide a safe forum for poor C code. :-)


ps. the real goal of the contest is to see who can make c code that will break your brain with its insanity.
« Last Edit: April 19, 2006, 07:06:50 AM by mouser »

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,650
    • View Profile
    • App's Apps
    • Read more about this member.
    • Donate to Member
Re: Learning C++ Builder
« Reply #13 on: April 19, 2006, 07:21:08 AM »
Here is a real list of differences between Delphi & C...and it may explain why I am shakey at win32api stuff.

http://delphi.about....lapi/l/aa101303a.htm

Any similarities I may have implied between Delphi & C/C++ was in mentioning that the IDEs of Delphi & BCB were similar...not the languages.

Delphi 6:
http://img205.imageshack.us/img205/6862/delphi4kd.jpg
Learning C++ Builder

Rover

  • Master of Smilies
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 630
    • View Profile
    • Donate to Member
Re: Learning C++ Builder
« Reply #14 on: April 19, 2006, 07:21:50 AM »
you are talking about the C++ Preprocessor (http://www.cplusplus...al/preprocessor.html).
the subject of much debate and misuse, which can be made to do some strange stuff.

Yup, that's the bugger.  I kept wanting to call it a pre-compiler...   :-[

The International Obfuscated C Code Contest

ps. the real goal of the contest is to see who can make c code that will break your brain with its insanity.

I used to read some C language magazines and they would usually have a similar contest.  It was UGLY.  The 2 line programs are nice in the same sort of way.  Scares me just to think about them.  :o
Insert Brilliant Sig line here

Shed

  • Honorary Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 26
    • View Profile
    • Donate to Member
Re: Learning C++ Builder
« Reply #15 on: April 19, 2006, 07:24:38 AM »
Quote
b) how to have listed functions ordered alphabetically?

you can made a standalone utility for it...like this...

then

1) got to *.H or HPP header file...Ctrl+C for copy the block of functions, and paste on this memo,

2) click on button1 (for sort the Memo (results will be duplicated/added to Memo1 text....then you copy and replace at Header file)

very tricky...sure...function_array only manages 100 lines...take care with this

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
#include <string.h>
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;

int sort_function( const void *a, const void *b);
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
 char function_array[100][150];
 AnsiString TEMP_STRING;
 int lines_of_memo=0;
 int counter_1 = 0;

 lines_of_memo = Memo1->Lines->Count;

 if(lines_of_memo <= 0)
  { ShowMessage("memo is empty"); return;}

 Memo1->Lines->Add("******************************************************************************");

 while(counter_1 < lines_of_memo)
 {
   TEMP_STRING = Memo1->Lines->Strings[counter_1].c_str();
   strcpy(function_array[counter_1], TEMP_STRING.c_str());
   counter_1++;
   }

  int  x;

   qsort((void *)function_array, lines_of_memo, sizeof(function_array[0]), sort_function);
   for (x = 0; x < lines_of_memo; x++)
      Memo1->Lines->Add(function_array[x]);

   Memo1->Refresh();
}
//---------------------------------------------------------------------------


int sort_function( const void *a, const void *b)
{
   return( strcmp((char *)a,(char *)b) );
}
void __fastcall TForm1::Button2Click(TObject *Sender)
{
 Memo1->CopyToClipboard();       
}
/

« Last Edit: April 19, 2006, 07:31:29 AM by Shed »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 36,278
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Learning C++ Builder
« Reply #16 on: April 19, 2006, 07:39:35 AM »
shed, i think smirf was asking about BDS functions in the ide to list properties and methods of components alphabetically..

Shed

  • Honorary Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 26
    • View Profile
    • Donate to Member
Re: Learning C++ Builder
« Reply #17 on: April 19, 2006, 10:12:05 AM »
yes...but i don't know if the compiler have it....

well...at least the CodeCompletion have (right click on codecompletion window)

- Sort by Scope
- Sort by Name
« Last Edit: April 19, 2006, 10:19:13 AM by Shed »

Smirf

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 59
    • View Profile
    • SMIRF -> OCTOPUS Chess Project
    • Donate to Member
Re: Learning C++ Builder
« Reply #18 on: April 19, 2006, 10:27:32 AM »
Quote from: mouser
... i think smirf was asking ...

The problem seems to be, that some basic functionalities seem to have vanished since upgrading from BCB6 to BDS2006. So I was asking for to help me how to use them again, thinking that I may have not fully understood, how to use the new Borland Developer Studio correctly.

The mostly missed abilities of the IDE are, how to insert assistedly new to be self written procedures, and how to list existing methods alphabetically. It seems for me, that those abilities have been shifted to the Together functionality e.g. in the Delphi personality. But, because of that this is not present in the C++ personality, those components seem to have completely vanished without any substitute. Am I right? Or what to do otherwise?

Reinhard.

Smirf

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 59
    • View Profile
    • SMIRF -> OCTOPUS Chess Project
    • Donate to Member
Re: Learning C++ Builder
« Reply #19 on: April 19, 2006, 10:34:21 AM »
Quote from: Shed
... the CodeCompletion ...

Well, that does not help to locate the code of the to be found function. Because I do not have all those names exactly in my head, I am used to walk through an alphabetically sorted list of all methods, to finally navigate to a desired code block. CodeCompletion is not usable to solve that common kind of working within a big solution.

Reinhard.

Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Points: 1
  • Posts: 7,651
    • View Profile
    • The Blog of Deozaan
    • Read more about this member.
    • Donate to Member
Re: Learning C++ Builder
« Reply #20 on: April 19, 2006, 12:51:22 PM »
Ha! I made a game or two using Borland's Delphi years ago! I can't remember Pascal for the life of me, but at the time it wasn't so bad.

Maybe I can dig it up somewhere. . .


Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Points: 1
  • Posts: 7,651
    • View Profile
    • The Blog of Deozaan
    • Read more about this member.
    • Donate to Member
Re: Learning C++ Builder
« Reply #21 on: April 19, 2006, 01:01:44 PM »
Ha found them!

I made WormWars (clone of SNAFU from Intellivision) all by myself, including sound effects.
My brother did the programming for Hangman, I made the graphics and the sound effects.

http://www.deozaan.com/games/

I also worked on a checkers game, but I never got computer AI built into it and it remained unfinished.


Shed

  • Honorary Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 26
    • View Profile
    • Donate to Member
Re: Learning C++ Builder
« Reply #22 on: April 20, 2006, 05:16:01 AM »
Deozaan:

Do you see the Narnia's Chronicles PC demo ?...it have in "sounds" directory all sounds in wav format...perfect for choose someones for your own game-sounds ]:) 

sounds like wind effect, broken woods, coins, sounds of hits

...etc


« Last Edit: April 20, 2006, 05:20:11 AM by Shed »