SetLayeredWindowAttributes invalid

HI all,

When I called SetLayeredWindowAttributes function to Set window to specify color transparency,

but the effect from valid to invalid, the call as follows:

HWND hWnd = FindWindow(NULL, “windowname”);

LONG t = GetWindowLong(hWnd, GWL_EXSTYLE);

t |= WS_EX_LAYERED;

SetWindowLong(hWnd, GWL_EXSTYLE, t);

SetLayeredWindowAttributes(hWnd, RGB(255,0,0), 255, LWA_COLORKEY);

Is there something wrong?
Thanks for your any help.

Why don’t you want to post your question to the Linux kernel or FreeBSD lists, or, even better,
just to ask a waiter in your local sushi bar???

Look - your question is very obviously all about the issues that are specific to user/gdi userland libraries, but for the reasons better known to yourself, you post this question to the NG that is all about the Windows kernel, which happens to be the place where GUI light never shines. What kind of a response are you expecting to get???

Anton Bassov

xxxxx@westone.com.cn wrote:

When I called SetLayeredWindowAttributesfunction to Set window to
specify color transparency, 

but the effect from valid to invalid, the call as follows:

HWND hWnd = FindWindow(NULL, “windowname”);

LONG t = GetWindowLong(hWnd, GWL_EXSTYLE);

t |= WS_EX_LAYERED;

SetWindowLong(hWnd, GWL_EXSTYLE, t);

SetLayeredWindowAttributes(hWnd, RGB(255,0,0), 255, LWA_COLORKEY);

Anton is correct, if unnecessarily rude.  Your question would be better
put to the MSDN Forums.  Having said that, I can’t tell what you mean by
“valid to invalid”.  What you have done there should render all of the
red pixels in that window transparent, so that the background shows
through.  Is that not what you see?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

> Anton is correct, if unnecessarily rude

Probably, a bit too harsh, but still not rude. Furthermore,I don’t really think it was uncalled for anyway. Let’s face it - the very fact that he had posted his question to NTDEV speaks,IMHO, volumes about his general attitudes.

In general, I believe that posting questions to any NG should be a kind of “the last resort approach” to be taken only after having done a thorough research concerning your problem.
In my experience, 80+% of the questions that I may have are getting resolved by the Google search literally within minutes. After all, the probability of being the first person in the entire world who had encountered some particular issue/question is very low. In the vast majority of cases you can be 100% sure that your particular question has been asked and answered on numerous occasions, so that the only thing left is to do a bit of research.

However, as we can see, the OP did not bother himself even with doing a bit of research about the specifics of a NG that he posts his question to…

I can’t tell what you mean by “valid to invalid”

Actually, this part may be, indeed, excused - it is obvious from the OP’s “grammar” that he does not really speak any English, so that this part may be excused just as a “language barrier” issue…

Anton Bassov

>just to ask a waiter in your local sushi bar

Is the temperature at which toro is optimally sliced DIFFERENT from the temperature of saba?

Maybe I should ask on LKML?

Anton is correct

How often do you hear THAT on this forum… huh?

Peter
OSR
@OSRDrivers

On Tue, Jul 17, 2018 at 11:21 AM, xxxxx@probo.com wrote:
> xxxxx@westone.com.cn wrote:
>>
>> When I called SetLayeredWindowAttributesfunction to Set window to
>> specify color transparency,
>>
>> but the effect from valid to invalid, the call as follows:
>>
>>
>> HWND hWnd = FindWindow(NULL, “windowname”);
>>
>> LONG t = GetWindowLong(hWnd, GWL_EXSTYLE);
>>
>> t |= WS_EX_LAYERED;
>>
>> SetWindowLong(hWnd, GWL_EXSTYLE, t);
>>
>> SetLayeredWindowAttributes(hWnd, RGB(255,0,0), 255, LWA_COLORKEY);
>>
>
> Anton is correct, if unnecessarily rude. Your question would be better
> put to the MSDN Forums. Having said that, I can’t tell what you mean by
> “valid to invalid”. What you have done there should render all of the
> red pixels in that window transparent, so that the background shows
> through. Is that not what you see?
>

You need to call UpdateLayeredWindow to set the blend function and
commit the changes. See
https://stackoverflow.com/questions/3970066/creating-a-transparent-window-in-c-win32.

There are other WinAPI calls where a similar pattern is necessary,
like SetWindowLong/SetWindowPos.

Cheers,
R0b0t1

> Is the temperature at which toro is optimally sliced DIFFERENT

from the temperature of saba? Maybe I should ask on LKML?

I wold rather suggest OpenBSD list - after all, “Puffy the pufferfish” happens to be their mascot,
so that they may advise you not only about toro and saba, but, probably, also give you a lesson
or two on the ways of preparing fugu safely…

Anton is correct How often do you hear THAT on this forum… huh?

Well, I would say that it reveals more about this forum, rather than about me, don’t you think…

Sadly enough, most members of this forum would accept absolutely anything that is said by those whom they consider to be an “authoritative source” for themselves, no matter how absurd these claims may be (the hidden and mysterious meaning of 'typedef int INT" - like declaration is the very first example that gets to my mind, but it is far from being the only one). Certainly, my willingness and readiness to debunk and openly deride such claims solely for the fun of doing it does not give me any extra points in terms of popularity in this NG.

Therefore, I take your statement as a compliment (which, however, most definitely does not imply that I am claiming to be on the right side in most of these “encounters”)…

Anton Bassov