Thread overview
import std.c.windows.windows;
Jan 10, 2012
DNewbie
Jan 10, 2012
Mike Parker
Jan 10, 2012
DNewbie
Jan 11, 2012
Mike Parker
Jan 14, 2012
DNewbie
Jan 10, 2012
Andrej Mitrovic
Jan 11, 2012
Mike Parker
January 10, 2012
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
January 10, 2012
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
January 10, 2012
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
January 10, 2012
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.
January 11, 2012
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.
January 11, 2012
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.
January 14, 2012

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.