Re: Windows Resources

2015-09-06 Thread Kagamin via Digitalmars-d-learn

On Sunday, 6 September 2015 at 15:42:52 UTC, Prudence wrote:
So how does one actually include resources such as menu's (rc 
files and all that) in a D project? Or am I stuff creating all 
that stuff programmatically?


Just like in a C project: write, compile and link them.


Re: Windows Resources

2015-09-06 Thread Prudence via Digitalmars-d-learn

On Sunday, 6 September 2015 at 10:28:59 UTC, Kagamin wrote:

On Sunday, 6 September 2015 at 02:37:21 UTC, Prudence wrote:
Obviously the issue is that I'm not using any resources yet it 
is giving me such an error.


You do. See docs for lpszMenuName field. GUI projects generated 
by Visual Studio include resource generation, that's why it 
works for them.


Thanks!

So how does one actually include resources such as menu's (rc 
files and all that) in a D project? Or am I stuff creating all 
that stuff programmatically?





Re: Windows Resources

2015-09-06 Thread Adam D. Ruppe via Digitalmars-d-learn

On Sunday, 6 September 2015 at 10:28:59 UTC, Kagamin wrote:

You do. See docs for lpszMenuName field.


I can't believe I missed that!


Re: Windows Resources

2015-09-06 Thread Kagamin via Digitalmars-d-learn

On Sunday, 6 September 2015 at 02:37:21 UTC, Prudence wrote:
Obviously the issue is that I'm not using any resources yet it 
is giving me such an error.


You do. See docs for lpszMenuName field. GUI projects generated 
by Visual Studio include resource generation, that's why it works 
for them.


Re: Windows Resources

2015-09-05 Thread Rikki Cattermole via Digitalmars-d-learn

This may interest you:
https://github.com/Devisualization/window/blob/master/platforms/win32/devisualization/window/window.d


Re: Windows Resources

2015-09-05 Thread Prudence via Digitalmars-d-learn

On Sunday, 6 September 2015 at 00:29:13 UTC, Adam D. Ruppe wrote:

On Saturday, 5 September 2015 at 19:06:15 UTC, Prudence wrote:
That's about as far as I can get. (what resource data? Where I 
do put it? How, who, when?)


Resource data in Windows is data compiled into your exe. It is 
stuff like icons, menus, or other arbitrary stuff you attach.


However, the code you posted doesn't access any of that so it 
shouldn't be an issue here... what import did you use to access 
the windows api? `import core.sys.windows.windows;` or 
something else? Also, are you building 32 bit (the default) or 
64 bit?


32-bit and I'm using the latest win32 wrappers distributed on 
github from someone. (suppose to be more complete than 
core.sys.windows)


Obviously the issue is that I'm not using any resources yet it is 
giving me such an error. (again, I pretty much copied the code 
directly from MSDN)






Re: Windows Resources

2015-09-05 Thread Adam D. Ruppe via Digitalmars-d-learn

On Saturday, 5 September 2015 at 19:06:15 UTC, Prudence wrote:
That's about as far as I can get. (what resource data? Where I 
do put it? How, who, when?)


Resource data in Windows is data compiled into your exe. It is 
stuff like icons, menus, or other arbitrary stuff you attach.


However, the code you posted doesn't access any of that so it 
shouldn't be an issue here... what import did you use to access 
the windows api? `import core.sys.windows.windows;` or something 
else? Also, are you building 32 bit (the default) or 64 bit?


Re: Windows Resources

2015-09-05 Thread BBasile via Digitalmars-d-learn

On Saturday, 5 September 2015 at 19:06:15 UTC, Prudence wrote:

[...]


Check this file 
https://github.com/D-Programming-Language/dmd/blob/master/samples/winsamp.d ,it's distributed with your D setup.


Windows Resources

2015-09-05 Thread Prudence via Digitalmars-d-learn
I'm trying to create a win32 window. I coped the code pretty much 
directly from msdn:


MSG msg;
BOOL bRet;
WNDCLASS wc;

// Register the window class for the main window.

if (!hPrevInstance)
{
wc.style = 0;
wc.lpfnWndProc = cast(WNDPROC)&WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
//wc.hIcon = LoadIcon(cast(HINSTANCE) NULL, 
IDI_APPLICATION);
//wc.hCursor = LoadCursor(cast(HINSTANCE) NULL, 
IDC_ARROW);
wc.hIcon = NULL;
wc.hCursor = NULL;
wc.hbrBackground = GetStockObject(WHITE_BRUSH);
wc.lpszMenuName =  "MainMenu";
wc.lpszClassName = "MainWndClass";

if (!RegisterClass(&wc))
return FALSE;
}

// Create the main window.
hwndMain = CreateWindow("MainWndClass", "Sample",

WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, 
CW_USEDEFAULT, cast(HWND) NULL,
cast(HMENU) 
NULL, hInstance, cast(LPVOID) NULL);
if (!hwndMain)
{
auto x = GetLastError();
return FALSE;
}


x is 1812 = ERROR_RESOURCE_DATA_NOT_FOUND

That's about as far as I can get. (what resource data? Where I do 
put it? How, who, when?)