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
next sibling 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
prev sibling next sibling parent reply "DNewbie" <run3 myopera.com> writes:
On Tue, Jan 10, 2012, at 10:37 PM, Mike Parker wrote:
 
 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
 
Ok.. I still don't understand why such a 'binding' is needed. Is std.c.windows.windows not enough for everyone? -- D
Jan 10 2012
parent Mike Parker <aldacron gmail.com> writes:
On 1/10/2012 10:57 PM, DNewbie wrote:
 On Tue, Jan 10, 2012, at 10:37 PM, Mike Parker wrote:
 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
Ok.. I still don't understand why such a 'binding' is needed. Is std.c.windows.windows not enough for everyone?
Unfortunately, no. It is not a complete binding of the Win32 API. It has a lot of stuff, but if you need more you need to look elsewhere. Andrej hit on some of the deficiencies in his post.
Jan 10 2012
prev sibling parent "DNewbie" <run3 myopera.com> writes:
On Wed, Jan 11, 2012, at 01:16 PM, Mike Parker wrote:
 On 1/10/2012 10:57 PM, DNewbie wrote:
 On Tue, Jan 10, 2012, at 10:37 PM, Mike Parker wrote:
 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
Ok.. I still don't understand why such a 'binding' is needed. Is std.c.windows.windows not enough for everyone?
Unfortunately, no. It is not a complete binding of the Win32 API. It has a lot of stuff, but if you need more you need to look elsewhere. Andrej hit on some of the deficiencies in his post.
Understood. I think I'll go with the binding. Thnk you.
Jan 14 2012