Thema: Delphi Dummy-Konstanten

Einzelnen Beitrag anzeigen

Benutzerbild von nailor
nailor

Registriert seit: 12. Dez 2002
Ort: Karlsruhe
1.989 Beiträge
 
#3
  Alt 11. Mai 2003, 13:59
Code:
program bla;

uses
  Windows,
  Messages;

const
  MC_case1: cardinal = 0;
  MC_case2: cardinal = 1;
  MC_case3: cardinal = 2;

function MessageLoop(hWnd: HWND; uMsg: UINT; wParam: wParam; lParam: LParam):
  lresult; stdcall;
begin
  Result := 0;
  case uMsg of
    WM_DESTROY:
      PostQuitMessage(0);
    WM_CREATE:
      begin
        //nix bis jetzt
      end;
  else
    Result := DefWindowProc(hWnd, uMsg, wParam, lParam);
  end;
end;

procedure mc(CodeNR: cardinal);
begin
case CodeNR of
  MC_case1: begin {irgendwas} end;
  MC_case2: begin {irgendwas} end;
  MC_case3: begin {irgendwas} end;
end;
end;

var
  WindowClass: TWndClassEx = (
    cbSize         : SizeOf(TWndClassEx);
    Style          : CS_HREDRAW or CS_VREDRAW;
    lpfnWndProc    : @MessageLoop;
    cbClsExtra     : 0;
    cbWndExtra     : 0;
    hbrBackground  : COLOR_APPWORKSPACE;
    lpszMenuName   : nil;
    lpszClassName  : 'myClass';
    hIconSm        : 0;    );
  msg: TMsg;
begin
WindowClass.hInstance := hInstance;
WindowClass.hCursor   := LoadCursor(0, IDC_ARROW);
WindowClass.hIcon     := LoadIcon(0, IDI_APPLICATION);

RegisterClassEx(WindowClass);

CreateWindowEX(0, 'myClass', 'capt', WS_CAPTION or WS_VISIBLE,
                100, 100, 200, 125, 0, 0, hInstance, nil);

while GetMessage(msg,0,0,0) do
  begin
    TranslateMessage(msg);
    DispatchMessage(msg);
  end;
ExitCode := msg.wParam;
end.
Michael N.
http://nailor.devzero.de/code/sharpmath/testing/ --- Tests, Feedback, Anregungen, ... aller Art sehr willkommen!
::: don't try so hard - it'll happen for a reason :::
  Mit Zitat antworten Zitat