Jump to content
  • Advertisement
Sign in to follow this  
.chicken

React on changing window appearance

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

If you intended to correct an error in the post then please contact us.

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.

 

Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement

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?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!