Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PostMessage being undefined using Win32 API in a D program?

Tags:

winapi

d

This is a sample piece of code showing the problem. I need to use the PostMessage function but i can't seem to get the symbol recognised. I've created a simple program to opening a win32 window which works fine but when i use either PostMessage or UnregisterClass they don't seem to be defined. I've check the D source and they are there but why does the compiler complain? I tried using the ascii and wide versions too.

import std.c.windows.windows;

extern(Windows):

void main(string[] Args)
{
    PostMessage(0, WM_CLOSE, 0, 0);
    PostMessageA(0, WM_CLOSE, 0, 0);
    PostMessageW(0, WM_CLOSE, 0, 0);
}

Output:

Error: undefined identifier PostMessage
Error: undefined identifier PostMessageA
Error: undefined identifier PostMessageW

How can i use this function call in a D program?

like image 360
Gary Willoughby Avatar asked May 13 '26 01:05

Gary Willoughby


1 Answers

std.c.windows.windows is very incomplete. Use the WindowsApi bindings project, instead.

like image 187
Vladimir Panteleev Avatar answered May 14 '26 15:05

Vladimir Panteleev