views:

93

answers:

2

Hi there,

How to convert this Delphi code :

const
  cnCursorID1 = 1;
begin
  Screen.Cursors[ cnCursorID1 ] :=
    LoadCursorFromFile(
      'c:\winnt\cursors\piano.ani' );
  Cursor := cnCursorID1;
end;

to C++ Builder

+1  A: 

Caveat: Code compiled by eye, don't have Borland compiler to hand.

{
    const int cnCursorID1 = 1;
    Screen->Cursors[ cnCursorID1 ] =
        LoadCursorFromFile("c:\\winnt\\cursors\\piano.ani" );
    Cursor = cnCursorID1;
}
Binary Worrier
Apologies, just changed `Screen.Cursors` to `Screen->Cursors`
Binary Worrier
+5  A: 

The following ought to work, although I haven't tested it.

const int cnCursorID1 = 1;
Screen->Cursors[cnCursorID1] = LoadCursorFromFile("c:\\winnt\\cursors\\piano.ani");
Cursor = cnCursorID1;

(If you're a regular C++Builder user, you'll find that a lot of example code and third-party libraries are in Delphi, so it's worth learning at least enough Delphi to read it and translate it yourself.)

Josh Kelley
Binary Worrier