Thema: Delphi Cursornamen Bestimmen

Einzelnen Beitrag anzeigen

stiftII

Registriert seit: 2. Sep 2009
Ort: Cuxhaven
122 Beiträge
 
#12

Re: Cursornamen Bestimmen

  Alt 2. Sep 2009, 22:53
Hallo nochmal.

Ich habe nun eine Für mich ausreichende Lösung gefunden aber stehe nun vor einem Neuen Problem.

Ich habe diese Library erstellt, sie soll die Mauscursor als Grafik zurückgeben, bekomme allerdings den Fehler "[Error] causeddll2.dpr(25): Object or class type required" In der markierten Zeile (testbmp := TBitmap.Create;

Delphi-Quellcode:
library causeddll2;

uses
  Messages, Variants, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls,
  Graphics,
  SysUtils,
  Classes,
  Windows,
  FastShareMem;

{$R *.res}

type
  TForm1 = class(TForm)
  end;

function GetCursorBitmap:TBitmap; stdcall;
var
  info: TCursorInfo;
  ico: TIcon;
  testbmp : TBitmap;
begin

[color=#ff005f][b] testbmp := TBitmap.Create;[/b][/color]

   info.cbSize := SizeOf(info);
  GetCursorInfo(info);

    ico := TIcon.Create;
  try
    ico.Handle := info.hCursor;
    testbmp.Width := ico.Width;
    testbmp.Height := ico.Height;
    testbmp.Canvas.Draw(0, 0, ico);

    result:= testbmp;
  finally
    ico.Free;
  end;

end;



function GetFunctionCount(): Integer; stdcall; export;
begin
  Result:= 1;
end;

function GetFunctionInfo(x: Integer; var ProcAddr: Pointer; var ProcDef: PChar): Integer; stdcall;
begin
  case x of
    0:
      begin
        ProcAddr := @GetCursorBitmap;
        StrPCopy(ProcDef, 'function GetCursorBitmap(): TBitmap;');
      end;
  else
    x := -1;
  end;
  Result := x;
end;

exports GetFunctionCount;
exports GetFunctionInfo;

end.
  Mit Zitat antworten Zitat