Posts

Beep vs MessageBeep vs Windows.Beep procedure in Delphi

Beep 

Beep procedure call generates a very short and quiet sound through the internal speaker of our system. It is used to inform the user that something has gone wring. It is declared in SysUtils unit. and on Windows OS, Beep procedure call Windows API MessageBeep procedure internally.
How to use Beep?

Start a project. Put a button on it. Make the button's OnClick handler do.....

Uses
      SysUtils;
..........………....
procedure TForm1.Button1Click(Sender: TObject);
begin
  Beep;
end;

That’s it, we can hear a sound on button click after application run.

MessageBeep

The MessageBeep function plays a waveform sound. The waveform sound for each sound type is identified by an entry in the sounds section of the registry. After queuing the sound, the MessageBeep function returns control to the calling function and plays the sound asynchronously. It is declared in Windows unit.
  MessageBeep(uType: Cardinal);

Parameter uType specifies the sound type, as identified by an entry in the [sounds] section of …

Delphi Data Types for API Integration

Sometime we may need to integrate APIs written on other languages into our Delphi application or we may need to call windows APIs when dealing with complex data structures or we may need to communicate with ActiveX OLE components. Then  in such cases, main issue is Data Type mismatch. So for better compatibility Delphi provides following Pointer data types which can be used to send and receive data to and from other application to Delphi applications.
Integer Data Types
Type Description Pointer Byte 8-bit unsigned integer PByte ShortInt 8-bit signed integer PShortInt Word 16-bit unsigned integer PWord