Friday, 28 May 2010

Example program of using BinaryToInteger.DLL

In this example, we are going to create a program that can convert an eight binary data into an integer value using BinaryToInteger.DLL. Before we start, you have to create a user interface like this picture.

Every edit box holds a bit of binary data. So there is a byte binary data (8 bits) that will be converted into an integer value. A binary data holds ‘0’ or ‘1’, so we need to limit the input of each edit box. And the code will be :

procedure TForm1.bit8KeyPress(Sender: TObject; var Key: Char);
  if not (key in ['0','1',#8,#13]) then 

To use BinaryToInteger.DLL, you must declare the function after {$R *.DFM}

{$R *.DFM}
function BinToInt(S : String): integer; stdcall; external 'BinaryToInteger.dll';

Don forget, you must place your BinaryToInteger.DLL in the same folder with this project, or you can place this DLL file in the directory : c:\windows\system.

The code of OnClick even of ConvertButton :

procedure TForm1.ConvertButtonClick(Sender: TObject);
  BinaryData : string;
  BinaryData := bit8.Text + bit7.Text + bit6.Text + bit5.Text +
  b it4.Text + bit3.Text + bit2.Text + bit1.Text;
  IntegerValue.Caption := IntToStr(BinToInt(BinaryData));  

You can download the complete code of this example program here.


  1. wah, sumpah gak ngerti ...

  2. pakde mampir lagi untuk menimba ilmu, boleh donk

    moga sukses selalu kawan

  3. code2 seperti ini softwarenya pakai apa yah sob ?

  4. jika benrkenan follow balik yah ?

  5. baru lihat codenya aja dah ngelu pol sob

  6. saya menyimak aja Sob, soalnya belum ngerti...

    sukses Sob...


These links are part of a pay per click advertising program called Infolinks. Infolinks is an In Text advertising service; they take my text and create links within it. If you hover your mouse over these double underlined links, you will see a small dialog box containing an advertisement related to the text. You can choose to move the mouse away and go on with your browsing, or to click on the box and visit the relevant ad. Click here to learn more about Infolinks Double Underline Link Ads.