Board index » delphi » Win32 API - Woohoo!!

Win32 API - Woohoo!!

Does anyone know where I can find some delphi code demonstrating the
creation of a window using the Win32 API?  I've found plenty of C++
examples, but none of them work when ported to Delphi.

I appreciate that it'd be much easier if I just used the Forms unit, but I'm
pedantic.
Cheers.

 

Re:Win32 API - Woohoo!!


Try 'The Tomes of Delphi 3: Win32 Core API' and ''The Tomes of Delphi 3:
Win32 Graphical API', published by Wrox Press (editor: John Ayres). If
you're really into Win32 API programming, these are the bibles you need.
Superb! (Not meant for real beginners, though.)

Robin Gerrets
R.Gerr...@student.nyenrode.nl

"Barry" <elb...@student.lboro.ac.uk> schreef in bericht
news:877ne8$73a$1@sun-cc204.lboro.ac.uk...
| Does anyone know where I can find some delphi code demonstrating the
| creation of a window using the Win32 API?  I've found plenty of C++
| examples, but none of them work when ported to Delphi.
|
| I appreciate that it'd be much easier if I just used the Forms unit, but
I'm
| pedantic.
| Cheers.

Re:Win32 API - Woohoo!!


Quote
"Barry" <elb...@student.lboro.ac.uk> wrote:

|Does anyone know where I can find some delphi code demonstrating the
|creation of a window using the Win32 API?  I've found plenty of C++
|examples, but none of them work when ported to Delphi.

Look at .../delphi4/projects/generic.dpr

at least in D4.

Phil

Re:Win32 API - Woohoo!!


In Delphi you have to use WS_VISIBLE under C not...

  Inst := hInstance;
  with WinClass do
  begin
    style              := CS_CLASSDC or CS_PARENTDC;
    lpfnWndProc        := @WindowProc;
    hInstance          := Inst;
    hbrBackground      := color_btnface + 1;
    lpszClassname      := 'DELPHI_WINDOW';
    hCursor            := LoadCursor(0, IDC_ARROW);
  end; { with }
  RegisterClass(WinClass);

  { ** Create Main Window ** }
  Handle := CreateWindowEx(WS_EX_APPWINDOW, 'DELPHI_WINDOW', 'Title',
                           WS_VISIBLE or WS_SIZEBOX or WS_CAPTION or
WS_SYSMENU or WS_POPUP,
                           363, 278, 230, 380, 0, 0, Inst, nil);

  UpdateWindow(Handle);

  while(GetMessage(Msg, Handle, 0, 0)) do
  begin
    TranslateMessage(msg);
    DispatchMessage(msg);
  end;

if you need more help just mail me la...@nicely.ch or webmas...@nicely.ch or
Remo-Laubac...@gmx.net

Remo

Quote
"Barry" <elb...@student.lboro.ac.uk> wrote in message

news:877ne8$73a$1@sun-cc204.lboro.ac.uk...
Quote
> Does anyone know where I can find some delphi code demonstrating the
> creation of a window using the Win32 API?  I've found plenty of C++
> examples, but none of them work when ported to Delphi.

> I appreciate that it'd be much easier if I just used the Forms unit, but
I'm
> pedantic.
> Cheers.

Other Threads