Error when trying to create SysLink control

Hi
I am getting an error when I try to create a SysLink control. My handle_error() function doesn't use GetLastError() to get more details. Maybe you can see what is wrong from this code and I don't have to spend some hours in implementing GetLastError() yet. I am using ASCII for the characters, not UNICODE.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
HWND create_link(
                 HINSTANCE hInst, 
                 HWND parent, 
                 int name, 
                 int left, int top, 
                 int width, int height, 
                 void *value
                ) {
                    INITCOMMONCONTROLSEX icmcnt;
                    icmcnt.dwSize = sizeof(INITCOMMONCONTROLSEX);
                    icmcnt.dwICC = ICC_LINK_CLASS;
                    InitCommonControlsEx(&icmcnt);
                    HWND obj = CreateWindowEx(
                                              0,
                                              WC_LINK,
                                              value,
                                              WS_VISIBLE|WS_CHILD|WS_TABSTOP,
                                              left, top,
                                              width, height,
                                              parent,
                                              (HMENU)name,
                                              hInst,
                                              NULL
                                             );
    if (obj) {
        return obj;
    } else {
        handle_error((char*)"Link control could not be created!", true);
        return 0;
    }
}


Thanks
I fail to see how GetLastError() would take hours to implement.

DWORD errorCode = GetLastError();

True: You don't have the error message, but at least you have the error code. Look up an error tool in the net and get the error message, but in all honesty, FormatMessage() is an easy API. It allocates the buffer for you and all you have to do is call LocalFree() once you are done with the message.

I don't spot any obvious mistakes, but I'm not a GUI expert. Have you checked the SysLink control documentation @ MSDN Online?
I have to use UNICODE, that was the issue. Thanks!
Topic archived. No new replies allowed.