Hm, okay. I just wanted to test the waters here; I'll rework this to use a function that loads a string from a resource file. Does the help message itself look okay? I just used the message provided by the native dxdiag app, but I could rework it if there are issues with copyright or wine conventions.
On Thu, Sep 17, 2009 at 6:34 AM, Henri Verbeet <hverbeet@...http://www.nabble.com/user/SendEmail.jtp?type=post&post=25500104&i=0> wrote:
2009/9/17 Brian Nguyen <*mtxcoll*@...http://www.nabble.com/user/SendEmail.jtp?type=post&post=25500104&i=1>:
+/* Thread-safe function for converting to wide char strings at runtime
*/
+LPWSTR PrintWide(LPWSTR buf, size_t len, const char *s) +{
- size_t i;
- for (i = 0; i < len && *s != '\0'; i++, s++) {
buf[i] = *s;
- }
- return buf;
+}
That doesn't do what you want, you should use MultiByteToWideChar() to convert to WCHAR. However, I don't think you want to hardcode the strings in the first place, you should load them from the resources so they can be translated. Also, functions like that which are only used in the current file should be static.
Thanks for taking this on!
2009/9/18 Brian Nguyen mtxcoll@gmail.com:
Hm, okay. I just wanted to test the waters here; I'll rework this to use a function that loads a string from a resource file. Does the help message itself look okay? I just used the message provided by the native dxdiag app, but I could rework it if there are issues with copyright or wine conventions.
You usually shouldn't copy anything from native Windows, including code, documentation/strings and graphics. So yes, please use your own wording for the help message.
Here's an updated patch that stores the string in an En.rc resource file and loads it using a wrapper for LoadString. How does this look?
On Fri, Sep 18, 2009 at 1:36 AM, Henri Verbeet hverbeet@gmail.com wrote:
2009/9/18 Brian Nguyen mtxcoll@gmail.com:
Hm, okay. I just wanted to test the waters here; I'll rework this to use
a
function that loads a string from a resource file. Does the help message itself look okay? I just used the message provided by the native dxdiag app, but I could rework it if there are
issues
with copyright or wine conventions.
You usually shouldn't copy anything from native Windows, including code, documentation/strings and graphics. So yes, please use your own wording for the help message.
2009/9/18 Brian Nguyen mtxcoll@gmail.com:
Here's an updated patch that stores the string in an En.rc resource file and loads it using a wrapper for LoadString. How does this look?
I think that should work, but how about something like this:
static const WCHAR *DxDiag_LoadString(UINT id) { static const WCHAR failed[] = { 'F', 'a', 'i', 'l', 'e', 'd', '!', '\0' }; const WCHAR *ret;
if (!LoadStringW(GetModuleHandleW(NULL), id, (WCHAR *)&ret, 0)) { WINE_FIXME("Failed to load string %u, last error %u.\n", id, GetLastError()); return failed; }
return ret; }
- DXDIAG_MESSAGE_HELP,
You have a trailing space here.
Thanks for the suggestion; I didn't realize you could get a pointer to the string itself. Here's an updated patch. I also changed the wording some more to make it less similar to the native dxdiag.
On Sat, Sep 19, 2009 at 12:05 PM, Henri Verbeet hverbeet@gmail.com wrote:
2009/9/18 Brian Nguyen mtxcoll@gmail.com:
Here's an updated patch that stores the string in an En.rc resource file
and
loads it using a wrapper for LoadString. How does this look?
I think that should work, but how about something like this:
static const WCHAR *DxDiag_LoadString(UINT id) { static const WCHAR failed[] = { 'F', 'a', 'i', 'l', 'e', 'd', '!', '\0' }; const WCHAR *ret;
if (!LoadStringW(GetModuleHandleW(NULL), id, (WCHAR *)&ret, 0)) { WINE_FIXME("Failed to load string %u, last error %u.\n", id, GetLastError()); return failed; }
return ret; }
- DXDIAG_MESSAGE_HELP,
You have a trailing space here.
2009/9/19 Brian Nguyen mtxcoll@gmail.com:
Thanks for the suggestion; I didn't realize you could get a pointer to the string itself. Here's an updated patch. I also changed the wording some more to make it less similar to the native dxdiag.
Works for me. You still have the trailing space though.
Oops, removed the trailing space.
On Sat, Sep 19, 2009 at 2:25 PM, Henri Verbeet hverbeet@gmail.com wrote:
2009/9/19 Brian Nguyen mtxcoll@gmail.com:
Thanks for the suggestion; I didn't realize you could get a pointer to
the
string itself. Here's an updated patch. I also changed the wording some
more
to make it less similar to the native dxdiag.
Works for me. You still have the trailing space though.
On Fri, Sep 18, 2009 at 4:35 PM, Brian Nguyen mtxcoll@gmail.com wrote:
Here's an updated patch that stores the string in an En.rc resource file and loads it using a wrapper for LoadString. How does this look?
The text still matches Windows'.