AAARRRGGGHHH!!!

I have discovered that if I run the code inside a DLL (forgot to mention this...D'OH!) then CreateWindowEx() returns 0, but if I run the same code outside the DLL as a plain unit like this:

Code:
  if Window_Create('some title',800,600,False) then
  begin
    WriteLn('Press Space to Quit...');
    while Window_Update(nil) do
    begin

    end;

    Window_Close;
  end;
Then it works...

Any idea if this is possible from inside a DLL?

This is kinda a show-stopper for me as I want to do all of this INSIDE a DLL

cheers,
Paul