[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 328
  • Last Modified:

wlxDialogBoxParam compilation

Hi,
I'm having trouble compiling this function.


pWlxFuncs->WlxDialogBoxParam( hGlobalWlx, hDllInstance,
                                         (LPTSTR)MAKEINTRESOURCE(IDD_OS_CHOICE_DLG),
                                         NULL,
                                         NULL,
                                         0);

the third parameter gives this error:
"Cannot convert parameter 3 from 'LPSTR' to 'LPWSTR'."

yet, I have seen an example with this exact line......
Any ideas?

David.
0
dave_p_r_b
Asked:
dave_p_r_b
1 Solution
 
jkrCommented:
>>"Cannot convert parameter 3 from 'LPSTR' to 'LPWSTR'."


IF your resource is UNICODE, simply use

#define UNICODE

before including any header files.

or

pWlxFuncs->WlxDialogBoxParam( hGlobalWlx, hDllInstance,
                                        (LPWSTR)MAKEINTRESOURCE(IDD_OS_CHOICE_DLG),
                                        NULL,
                                        NULL,
                                        0);


If your string resource is ANSI, use 'mbstowcs()' to convert it, e.g.

LPSTR pstr = (LPCSTR)MAKEINTRESOURCE(IDD_OS_CHOICE_DLG);

wchar_t* pwstr = new wchar_t [ lstrlen ( pstr)];

mbstowcs ( pwstr, pstr, lstrlen (pstr));

pWlxFuncs->WlxDialogBoxParam( hGlobalWlx, hDllInstance,
                                        pwstr,
                                        NULL,
                                        NULL,
                                        0);

delete [] pwstr;

LPWSTR

0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now