TCHAR conversion problem?

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

TCHAR conversion problem?

Postby JoeAndrieu » Sun Oct 18, 2009 5:13 pm

With a fresh version of Cef integrated into my app (VS2005 Vista 64-bit), I get the following error:

Error 47 error C2664: 'cef_string_alloc' : cannot convert parameter 1 from 'LPCTSTR' to 'const wchar_t *' c:\...\cef\v51\include\cef_win.h 153

This happens in the function because it the windowName parameter is a LPCTSTR and it is passed to cef_string_alloc with wants a const wchar_t.

Here's the code snippet:

Code: Select all
void SetAsPopup(HWND hWndParent, LPCTSTR windowName) {
...
      if(windowName)
         m_windowName = cef_string_alloc(windowName);
}


Unfortunately, this doesn't compile on my system, instead I get the error above. I believe this problem goes away if I were to define UNICODE, but that causes other problems in my code base. I think this is a legitimate issue for fixing Cef, but I'm not sure if the right answer is to change the signature of SetAsPopup or to do the conversion frmo LPCTSTR to wchar_t within SetAsPopup.

Should I just raise this as an issue over in the main Cef site?


FWIW, the code works just fine if I do the conversion. But I'd rather not have to deal with this hack in my code base. It'd be better if the Cef code could be updated to address it one way or the other.

-j
JoeAndrieu
Techie
 
Posts: 21
Joined: Wed Jun 10, 2009 6:44 pm

Re: TCHAR conversion problem?

Postby magreenblatt » Sun Oct 18, 2009 6:16 pm

Good catch, the signature should be LPCWSTR instead of LPCTSTR. I've created an issue to track this:
http://code.google.com/p/chromiumembedd ... tail?id=58
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: TCHAR conversion problem?

Postby JoeAndrieu » Mon Oct 19, 2009 2:15 am

Cool. Thanks.
JoeAndrieu
Techie
 
Posts: 21
Joined: Wed Jun 10, 2009 6:44 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 84 guests