[3/5] comctl32: Implement TaskDialogIndirect as a custom dialog box (try 2)

Alexandre Julliard julliard at winehq.org
Tue Feb 24 08:50:24 CST 2015


Nikolay Sivov <bunglehead at gmail.com> writes:

> On 24.02.2015 17:37, Joachim Priesner wrote:
>> Am Dienstag, 24. Februar 2015 schrieb Nikolay Sivov:
>>> On 23.02.2015 15:42, Joachim Priesner wrote:
>>>> +    if (IS_INTRESOURCE(text))
>>>> +    {
>>>> +        SetLastError(S_OK);
>>>> +        LoadStringW(instance, LOWORD(text), (LPWSTR)result, 0);
>>>> +        return HRESULT_FROM_WIN32(GetLastError());
>>>> +    }
>>>
>>> You don't need SetLastError(), especially not with HRESULT value. And
>>> GetLastError() should only be used when LoadStringW() fails.
>>
>> Thanks for the feedback, again. The rationale behind SetLastError is that the following three cases can occur:
>>   1) LoadStringW succeeds, string length > 0 => return value > 0
>>   2) LoadStringW succeeds, string length == 0 => return value 0
>>   3) LoadStringW fails => return value 0, error code available via GetLastError.
>>
>> Because LastError is not modified in case 2), I have to set it to S_OK beforehand in order to distinguish between 2) and 3). Does that make sense?
>>
>
> Ok, what happens on windows if resource length is 0? If it still works
> and text is simply empty you can detect a failure another way - by
> testing returned resource pointer (I'd expect NULL if resource id was
> not found), and in that case use last error.

There shouldn't be any need to distinguish. If you get 0 then there's no
defined string and you use the fallback.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list