Thursday, April 11, 2013

Force opencv image window to always on top

Recently I needed to make an opencv(Open Source Computer Vision) image window always on top of any other windows. I followed the answers in Stackoverflow but couldn't make it really work. The solution proposed by it was to use setWindowPos API to make the image window TOPMOST.

I have to say today is my lucky day. I finally found if we set the parent of that image window to TOPMOST, then it works like a charm.
        HWND cvHwnd = (HWND )cvGetWindowHandle("window");
        HWND cvParent = ::GetParent(cvHwnd);
        ::ShowWindow(cvParent, SW_MINIMIZE);
        ::ShowWindow(cvParent, SW_RESTORE);
        ::SetWindowPos(cvParent, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);

6 comments:

Anonymous said...

Hi colleagues, pleasant article and good urging commented
at this place, I am truly enjoying by these.


My web blog - シャネル 時計

Anonymous said...

Hi there! Do you know if they make any plugins to protect against hackers?

I'm kinda paranoid about losing everything I've worked hard on.
Any tips?

Also visit my web page; wiki.oxtli.com.mx

Anonymous said...

dating sites uk http://loveepicentre.com/ jennifer aniston dating again
enchanted evenings dating [url=http://loveepicentre.com]carbon dating scientist sujihara[/url] classmates dating site
dating for single [url=http://loveepicentre.com/taketour/]national dating websites[/url] dating japan indians [url=http://loveepicentre.com/user/juliet4u28/]juliet4u28[/url] dating offenbach germany

Anonymous said...

best dating internet http://loveepicentre.com/taketour/ free hiv dating personals
dating site for cooks [url=http://loveepicentre.com/faq/]online dating website relationship[/url] columbian girl dating
aratron dating [url=http://loveepicentre.com/contact/]history of courting dating[/url] adult dating mobile [url=http://loveepicentre.com/user/dropdeadbeauty/]dropdeadbeauty[/url] ideas for group dating

Anonymous said...

changes in dating over the years http://loveepicentre.com/map/ single ads dating online
singles sex dating santa clarita ca [url=http://loveepicentre.com/]hemel hempstead dating[/url] dating tip sights
joanna hillman editor dating [url=http://loveepicentre.com/]disabled singles dating clubs[/url] patent numbers for dating [url=http://loveepicentre.com/user/tideboy/]tideboy[/url] adult dating internet sites

Anonymous said...

chubby dating web sites http://loveepicentre.com/taketour/ are zack and vanessa dating
dating netherlands [url=http://loveepicentre.com/articles/]european farm dating[/url] online dating warnings
married dating agencies in uk [url=http://loveepicentre.com/faq/]juicy dating[/url] one good love dating site reviewd [url=http://loveepicentre.com/user/24012000/]24012000[/url] anastacia russian dating