taskmgr [try 4]: Converted some functions and variables to Unicode [1/7]

Nikolay Sivov bunglehead at gmail.com
Sat Aug 9 03:49:55 CDT 2008


Vladimir Pankratov wrote:

>  static void TaskManager_OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu)
>  {
> -    TCHAR str[100];
> +    WCHAR wstr[256];
> +    WCHAR wszEmptyStr[] = {' ',0};
>  
> -    _tcscpy(str, TEXT(""));
> -    if (LoadString(hInst, nItemID, str, 100)) {
> -        /* load appropriate string */
> -        LPTSTR lpsz = str;
> -        /* first newline terminates actual string */
> -        lpsz = _tcschr(lpsz, '\n');
> -        if (lpsz != NULL)
> -            *lpsz = '\0';
> -    }
> -    SendMessage(hStatusWnd, SB_SETTEXT, 0, (LPARAM)str);
> +    strcpyW(wstr, wszEmptyStr);
> +    LoadStringW(hInst, nItemID, wstr, sizeof(wstr)/sizeof(WCHAR));
> +    SendMessageW(hStatusWnd, SB_SETTEXTW, 0, (LPARAM)wstr);
>  }
>  
>  static void TaskManager_OnViewUpdateSpeedHigh(void)
You really need a single space string passed as message parameter?
If not  - WCHAR wszEmptyStr[] = {0} - should be enough. And maybe it's 
better to initialize wstr to empty instead of using another variable.



More information about the wine-devel mailing list