Discussion:
MFC to wxWidgets - LPCTSTR, LPTSTR, DWORD ...
(too old to reply)
Hans F. Nordhaug
2004-08-30 20:53:51 UTC
Permalink
Dear list,

I'm about to convert an application from Windows (MFC) to Linux (wxWidgets).
However, since I haven't coded anything with MFC I wonder what I should
replace LPCTSTR, LPTSTR and DWORD with? I know what they are, but not the
exact equivalent in wxWidgets (if any) or what the typedefs should look like...
Please give me a hand - even though this probably is pretty trivial (since I
haven't found a question about this in the mailing lists archive).

Regards,
Hans

PS! Yes, I have read the wiki about MFC to wxWidgets.

---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-***@lists.wxwidgets.org
For additional commands, e-mail: wx-users-***@lists.wxwidgets.org
Gunnar Roth
2004-08-30 21:14:28 UTC
Permalink
Post by Hans F. Nordhaug
Dear list,
I'm about to convert an application from Windows (MFC) to Linux (wxWidgets).
However, since I haven't coded anything with MFC I wonder what I should
replace LPCTSTR, LPTSTR and DWORD with? I know what they are, but not the
exact equivalent in wxWidgets (if any) or what the typedefs should look like...
Please give me a hand - even though this probably is pretty trivial (since I
haven't found a question about this in the mailing lists archive).
LPCTSTR : const wxChar *
LPTSTR : wxChar *
DWORD : DWORD or WXD and WORD, both are defined as typedefs in
wx/defs.h


using wxChar instead of char, makes it working in unicode and ansi
build (wxChar is char in ansi ,and wchar_t in unicode builds)
as the LPCTSTR, LPTSTR on windows do.

regards,
gunnar


---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-***@lists.wxwidgets.org
For additional commands, e-mail: wx-users-***@lists.wxwidgets.org
Cheetah
2004-08-30 21:14:28 UTC
Permalink
On Mon, 30 Aug 2004 22:51:41 +0200, Hans F. Nordhaug
Post by Hans F. Nordhaug
However, since I haven't coded anything with MFC I wonder what I should
replace LPCTSTR, LPTSTR and DWORD with? I know what they are, but not the
exact equivalent in wxWidgets (if any) or what the typedefs should look like...
It's been a while since I did anything with MFC, but if my memory serves,

LPCTSTR = const char *
LPSTR = char *
DWORD = long (maybe unsigned?)

If that's correct, then LP(C)TSTR would ideally become (const)
wxString & (or simply (const) wxString) where possible, and DWORD
would be translated to its plain old data type.

Converting everything from LP*STR to wxString might be a lot of work
initially, however, and so you might want to keep those as char * for
the initial port and then handle the migration to C++ string objects
as a second pass of the porting.

Someone with more recent experience with MFC and more thorough
experience with wxWidgets than I might want to confirm all this,
though.
--
-- Cheetah

---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-***@lists.wxwidgets.org
For additional commands, e-mail: wx-users-***@lists.wxwidgets.org
shyandsy
2012-09-06 01:08:32 UTC
Permalink
LPCTSTR has two meanings.
when you define the macroo __UNICODE
LPCTSTR = const wchar*
else
LPCSTR = const char*

在 2004年8月30日星期一UTC-6下午3时14分28秒,Cheetah写道:
Post by Cheetah
On Mon, 30 Aug 2004 22:51:41 +0200, Hans F. Nordhaug
Post by Hans F. Nordhaug
However, since I haven't coded anything with MFC I wonder what I should
replace LPCTSTR, LPTSTR and DWORD with? I know what they are, but not the
exact equivalent in wxWidgets (if any) or what the typedefs should look like...
It's been a while since I did anything with MFC, but if my memory serves,
LPCTSTR = const char *
LPSTR = char *
DWORD = long (maybe unsigned?)
If that's correct, then LP(C)TSTR would ideally become (const)
wxString & (or simply (const) wxString) where possible, and DWORD
would be translated to its plain old data type.
Converting everything from LP*STR to wxString might be a lot of work
initially, however, and so you might want to keep those as char * for
the initial port and then handle the migration to C++ string objects
as a second pass of the porting.
Someone with more recent experience with MFC and more thorough
experience with wxWidgets than I might want to confirm all this,
though.
--
-- Cheetah
---------------------------------------------------------------------
Loading...