Danko McBudnugitt
2007-09-05 20:30:46 UTC
I am using some winsock code in a GUI app written in Win32 C. The
winsock network functions handle strings as standard ol' fashioned
character arrays, but I need to output this text on a listbox in a
dialog box. Here's the function I'm using from the Win32 API:
BOOL SetDlgItemText(
HWND hDlg,
int nIDDlgItem,
LPCTSTR lpString
);
Notice the 4th parameter is the actual string, but its data type is
LPCTSTR, which is a long pointer to a unicode string. Does anyone
know how to convert a standard char type into a LPCTSTR type? There
has to be a way to do it. This seems like it would be a common thing
to do when writing code C for a windows GUI app.
(My code works fine in a console app since there is no use of
unicode. If I were to use printf() or cout, its fine.)
winsock network functions handle strings as standard ol' fashioned
character arrays, but I need to output this text on a listbox in a
dialog box. Here's the function I'm using from the Win32 API:
BOOL SetDlgItemText(
HWND hDlg,
int nIDDlgItem,
LPCTSTR lpString
);
Notice the 4th parameter is the actual string, but its data type is
LPCTSTR, which is a long pointer to a unicode string. Does anyone
know how to convert a standard char type into a LPCTSTR type? There
has to be a way to do it. This seems like it would be a common thing
to do when writing code C for a windows GUI app.
(My code works fine in a console app since there is no use of
unicode. If I were to use printf() or cout, its fine.)