?
Solved

wlxDialogBoxParam compilation

Posted on 2003-03-11
1
Medium Priority
?
320 Views
Last Modified: 2007-12-19
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
Comment
Question by:dave_p_r_b
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 86

Accepted Solution

by:
jkr earned 400 total points
ID: 8112811
>>"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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question