www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - import std.c.windows.windows;

reply "DNewbie" <run3 myopera.com> writes:
I'm not sure I understand.. The page at http://dlang.org/windows.html says

  Instead of the:
  #include <windows.h>
  of C, in D there is:
  import std.c.windows.windows;

However, the samples at
https://github.com/AndrejMitrovic/DWinProgramming/tree/master/Samples
use

  import win32.windef;
  import win32.winuser;

My question is which one should I use in my programs?

-- 

  D
Jan 10 2012
parent reply Mike Parker <aldacron gmail.com> writes:
On 1/10/2012 10:24 PM, DNewbie wrote:
 I'm not sure I understand.. The page at http://dlang.org/windows.html says

    Instead of the:
    #include<windows.h>
    of C, in D there is:
    import std.c.windows.windows;

 However, the samples at
https://github.com/AndrejMitrovic/DWinProgramming/tree/master/Samples
 use

    import win32.windef;
    import win32.winuser;

 My question is which one should I use in my programs?

Those samples use a binding to the Win32 API[1] that does not ship with DMD. So in your case, std.c.windows.windows is probably what you want for now. [1]http://dsource.org/projects/bindings/wiki/WindowsApi
Jan 10 2012
parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
std.c.windows.windows is missing *a lot* of definitions. It also
doesn't provide aliases to ASCII/UTF16 functions like WindowsAPI does
via the Unicode flag, so you have to explicitly use e.g.
MessageBoxA/MessageBoxW instead of MessageBox. WindowsAPI is nicely
modularized, and is based on existing MinGW headers.
Jan 10 2012
parent Mike Parker <aldacron gmail.com> writes:
On 1/10/2012 11:44 PM, Andrej Mitrovic wrote:
 std.c.windows.windows is missing *a lot* of definitions. It also
 doesn't provide aliases to ASCII/UTF16 functions like WindowsAPI does
 via the Unicode flag, so you have to explicitly use e.g.
 MessageBoxA/MessageBoxW instead of MessageBox. WindowsAPI is nicely
 modularized, and is based on existing MinGW headers.

Yes, but it's not necessarily the best place to start for someone who hasn't figured out the toolchain yet.
Jan 10 2012