Click here to Skip to main content
15,887,746 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to load swf from resources Pin
peterchen10-May-10 2:21
peterchen10-May-10 2:21 
QuestionWindowFromPoint and layered windows Pin
Code-o-mat9-May-10 7:07
Code-o-mat9-May-10 7:07 
AnswerRe: WindowFromPoint and layered windows Pin
Randor 9-May-10 9:42
professional Randor 9-May-10 9:42 
GeneralRe: WindowFromPoint and layered windows Pin
Code-o-mat9-May-10 10:21
Code-o-mat9-May-10 10:21 
GeneralRe: WindowFromPoint and layered windows Pin
Randor 9-May-10 11:24
professional Randor 9-May-10 11:24 
GeneralRe: WindowFromPoint and layered windows Pin
Code-o-mat9-May-10 11:36
Code-o-mat9-May-10 11:36 
GeneralRe: WindowFromPoint and layered windows Pin
Randor 9-May-10 12:44
professional Randor 9-May-10 12:44 
GeneralRe: WindowFromPoint and layered windows [modified] Pin
Code-o-mat9-May-10 23:05
Code-o-mat9-May-10 23:05 
Randor wrote:
Sorry about the long reply delay. Today is Sunday and I am being very lazy. Sleepy

No need to say sorry, i apriciate you take the time to help, may that be in 1 minute or 3 days, so thank you. Smile | :) Thumbs Up | :thumbsup:


Randor wrote:

POINT p;
GetCursorPos(&p);
LRESULT r = ::SendMessage(aboutDlg->m_hWnd,WM_NCHITTEST, 0,MAKELONG(p.x,p.y));


I tested this on a splash screen which is WS_EX_LAYERED and has an transparent alpha color key. The WM_NCHITTEST is returning HTCLIENT for anything inside the window rect *including* transparent region.


I tested this, but this kinda works the same "is the point inside the rectangle" way and it will return HTCLIENT even if the window is overlapped by another one, so if there is a window covering the one i test for and the point is inside its window rectangle it will report HTCLIENT althorough the mouse points at a different window.

I guess i will have to rethink the way i want to implement this, forget about TrackMouseEvent and either use a global mouse hook to track the nouse's position, use a timer to periodically poll the position (i personally dislike polling) or use SetCapture when the mouse enters a window so i can track where it goes and notice when it leaves. For the hit-testing i probably will try the WindowFromPoint + check Z order + check rectangle (WM_NCHITTEST for that seems to be a good idea, thanks) "trio".

A simple aproach to the problem which works both for WindowFromPoint and TrackMouseEvent is to change all the alpha values in the bitmaps that define the layered windows to be at least 1 (so no zeroes, no completely transparent pixels), as it seems hit testing by windows with layered windows is based ont he alpha pixel value, if the pixel has a 0 alpha value (completely transparent) then there's no hit, otherwise there is. I just don't know how reliable this method is and also if it can produce any noticable visual anomalies (a "ghosty" rectangle around the bitmap"). For now i will just take this for simplicity, althorough i don't much like it...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
modified on Monday, May 10, 2010 6:23 AM

QuestionSystem Time Zone Pin
john56329-May-10 6:45
john56329-May-10 6:45 
AnswerRe: System Time Zone Pin
Software_Developer9-May-10 7:46
Software_Developer9-May-10 7:46 
AnswerRe: System Time Zone Pin
Randor 9-May-10 9:21
professional Randor 9-May-10 9:21 
QuestionAfx.h / Win32 Pin
Fareed Rizkalla8-May-10 11:34
Fareed Rizkalla8-May-10 11:34 
AnswerRe: Afx.h / Win32 Pin
Garth J Lancaster8-May-10 13:25
professionalGarth J Lancaster8-May-10 13:25 
GeneralRe: Afx.h / Win32 Pin
Fareed Rizkalla8-May-10 16:15
Fareed Rizkalla8-May-10 16:15 
AnswerRe: Afx.h / Win32 Pin
Stephen Hewitt8-May-10 20:59
Stephen Hewitt8-May-10 20:59 
QuestionLocalization for languages using XML Pin
punyah20108-May-10 9:02
punyah20108-May-10 9:02 
AnswerRe: Localization for languages using XML Pin
CPallini8-May-10 9:53
mveCPallini8-May-10 9:53 
GeneralRe: Localization for languages using XML Pin
punyah20108-May-10 10:34
punyah20108-May-10 10:34 
GeneralRe: Localization for languages using XML Pin
CPallini8-May-10 11:17
mveCPallini8-May-10 11:17 
AnswerRe: Localization for languages using XML Pin
Iain Clarke, Warrior Programmer8-May-10 22:24
Iain Clarke, Warrior Programmer8-May-10 22:24 
QuestionRegGetValue / Win32 Pin
Fareed Rizkalla8-May-10 8:25
Fareed Rizkalla8-May-10 8:25 
AnswerRe: RegGetValue / Win32 Pin
Chris Losinger8-May-10 8:50
professionalChris Losinger8-May-10 8:50 
GeneralRe: RegGetValue / Win32 Pin
Fareed Rizkalla8-May-10 8:59
Fareed Rizkalla8-May-10 8:59 
GeneralRe: RegGetValue / Win32 Pin
Kelly Herald8-May-10 9:13
Kelly Herald8-May-10 9:13 
QuestionC++ Pointer Help [Solved] Pin
Tom Moore8-May-10 2:08
Tom Moore8-May-10 2:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.