Window creation in generic windows app compiled in Delphi (without forms etc)

I wanted to write a small app that takes a dos program as a parameter, then
asks the user to supply a command line for the dos app, and finally uses
winexec to run the dos prog with the command line. This I did in Delphi and
finished with an app that was 174kb which seemed to be overkill to me, so I
decided to make a generic windows app, creating the window in the
traditional C way, thus:

  WindowClass: TWndClass = (
    style: 0;
    lpfnWndProc: @WindowProc;
    cbClsExtra: 0;
    cbWndExtra: 0;
    hInstance: 0;
    hIcon: 0;
    hCursor: 0;
    hbrBackground: 0;
    lpszMenuName: AppName;
    lpszClassName: AppName);
  if HPrevInst = 0 then
    WindowClass.hInstance := HInstance;
    WindowClass.hIcon := LoadIcon(0, idi_Application);
    WindowClass.hCursor := LoadCursor(0, idc_Arrow);
    WindowClass.hbrBackground := GetStockObject(white_Brush);
    if RegisterClass(WindowClass) = 0 then Halt(255);
  Window := CreateWindow(AppName,'Delphi Generic',
                         ws_OverlappedWindow or ws_Visible,

Create window returns a zero value, meaning the window creation failed.
Before it returns, it goes through the WindowProc three times, with message
values of 35460, 35496 and again 35496, which don't make sense to me. My
WindowProc at the moment only handles create & destroy, passing all other
messages on:

  WindowProc := DefWindowProc(Window, Message, WParam, LParam);

Has anyone got any idea why I'm not creating my window?