# React on changing window appearance

This topic is 1476 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Ok, here I am again, thinking about starting another project. You guys helped me alot the last time, and since I don't really know where to start, I thought I'd just ask a few questions here first.

It's a little tough to explain what I'm trying to do, but I'll give my best:

I want to make an application which basically does the following:

1) I want to drag and drop several windows from other applications inside my application window, so that they are stacked there (and don't take up my desktop space)

2) then I want to react to changes in the window appearance (this probably needs a fast algorithm or something). All I need to do is, once a fixed pixel inside this window changes it's color, I want to click that window.

I've never programmed anything like that before, so I really have no clue where to start and what to google for. I thought maybe you could give me a few keywords or tools with which I could achieve the above.

##### Share on other sites

Ok, I got this somehow working. I'm able to capture window handles as children now.

I still get some weird bugs with the window handles from time to time, though. I'm capturing the handles with the following code:

/* Set as child */
HWND parent = (HWND)ui.widget->winId();
MoveWindow(handle, 0, 0, 0, 0, true); //place handle at (0,0) with a minimum size
SetParent(handle, parent);
DWORD style = GetWindowLong(handle, GWL_STYLE); //get the child style
//style &= ~(WS_POPUP | WS_CAPTION); //reset the "caption" and "popup" bits
style |= WS_CHILDWINDOW; //set the "child" bit
SetWindowLong(handle, GWL_STYLE, style); //set the new style of b
EnableWindow(handle, FALSE); // disabled the child
UpdateWindow(parent);


And I'm releasing it by:

/* Release child */
DWORD style = GetWindowLong(handle, GWL_STYLE);
//style &= ~(WS_POPUP | WS_CAPTION);
style &= ~WS_CHILDWINDOW; //remove the "child" bit
SetWindowLong(handle, GWL_STYLE, style);
SetParent(handle, NULL); // NULL to free it? what else should I put here?
MoveWindow(handle, 0, 0, 200, 200, true); //place at (0,0,200,200)
EnableWindow(handle, TRUE);
UpdateWindow(NULL);


I'm getting the Pixel Colors with

GetPixel(GetDC(hwnd), x, y)


And here I get weird bugs from time to time. The console says:

QWindowsBackingStore::flush: GetDC failed()

In addition to that, when I move my mainwindow, containing a child, the window gets weird paint bugs, the widget just don't get repainted right anymore.

What am I doing wrong?

1. 1
2. 2
3. 3
4. 4
5. 5
Rutin
15

• 14
• 9
• 9
• 9
• 10
• ### Forum Statistics

• Total Topics
632912
• Total Posts
3009183
• ### Who's Online (See full list)

There are no registered users currently online

×