Tags:CbuilderHow to avoid simultaneous access?

To avoid clashing with other threads when accessing global objects or variables, you may need to block the execution of other threads until your thread code has finished an operation. Be careful not to block other execution threads unnecessarily. Doing so can cause performance to degrade seriously and negate most of the advantages of using multiple threads.

The VCL and CLX include support for three techniques that prevent other threads from...

Programming - C++Builder

How to use the main VCL/CLX thread?

The Execute method is your thread function. You can think of it as a program that is launched by your application, except that it shares the same process space. Writing the thread function is a little trickier than writing a separate program because you must make sure that you don't overwrite memory that is used by other threads in your application. On the other hand, because the thread shares the same process space with other threads, you can use the...

Programming - C++Builder

Tags:CbuilderTthreadHow to Initialize the thread?

Use the constructor to initialize your new thread class. This is where you can assign a default priority for your thread and indicate whether it should be freed automatically when it finishes executing.How to assign a default priority?

Priority indicates how much preference the thread gets when the operating system schedules CPU time among all the threads in your application. Use a high priority thread to handle time critical tasks, and a low...

Programming - C++Builder

Tags:CbuilderHow to write multi-threaded applications in C++Builder?

C++Builder provides several objects that make writing multi-threaded applications easier. Multi-threaded applications are applications that include several simultaneous paths of execution. While using multiple threads requires careful thought, it can enhance your programs by: Avoiding bottlenecks. With only one thread, a program must stop all execution when waiting for slow processes such as accessing files on disk...

Programming - C++Builder

Tags:CbuilderMultimediaHow to add silent video clips to your program?

Suppose you want to display an animated logo as the first screen that appears when your application starts. After the logo finishes playing the screen disappears.
To run this example, create a new project and save the Unit1.cpp file as Frmlogo.cpp and save the Project1.bpr file as Logo.bpr. Then: Double-click the animate icon from the Win32 page of the Component palette. Using the Object Inspector, set its Name...

Programming - C++Builder

Tags:CbuilderDelphiMultimediaHow to work with multimedia in C++Builder or Delphi?

C++Builder and Delphi allows you to add multimedia components to your Windows (not CLX or Linux) applications. To do this, you can use either the TAnimate component on the Win32 page or the TMediaPlayer component on the System page of the Component palette. Use the animate component when you want to add silent video clips to your application. Use the media player component when you want to add audio and/or video...

Programming - C++Builder

Tags:CbuilderRefining line drawing

With fields in place to track various points, you can refine an application's line drawing.How to track the origin point?

When drawing lines, track the point where the line starts with the Origin field.
Origin must be set to the point where the mouse-down event occurs, so the mouse-up event handler can use Origin to place the beginning of the line, as in this code:

void __fastcallTForm1::FormMouseDown(TObject *Sender, TMouseButton Button,
  TShiftState...

Programming - C++Builder

Tags:CanvasDrawingOnmousedownOnmousemoveOnmouseup

How to track the mouse actions? well, we can add a field to a form object to track mouse actions.

To track whether a mouse button was pressed, you must add an object field to the form object. When you add a component to a form, C++Builder adds a field that represents that component to the form object, so that you can refer to the component by the name of its field. You can also add your own fields to forms by editing the type declaration in...

Programming - C++Builder

Tags:Linux

How to change the password under linux? The most common ways of the command line looks as following:

passwd   Change your own password.

passwd sleepy   Change sleepy's password.

passwd -d sleepy   Delete sleepy's password.

When these commands to change your password, you need to enter your old password and new passwords. The new password should be at least six characters long and a little complex.

If you share your Linux system with multiple users, you might do...

Operating system - Linux

More Articles...