Skip to main content

Topic: Focuses, windows... (Read 2492 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • K_S
  • [*]
Focuses, windows...
I'm writing plugin and have some problems with window (or Windows).
1) I want to create an invisible window (then working with this window in a thread and show in this thread). I just don't know how to hide a window on create. If I omit WS_VISIBLE my window is still visible. I create and hide this window with ShowWindow(SW_HIDE), but it's still shows my window for a fraction of second. Creating an invisible window should be so easy, but how to do this?
2) I don't know specifically how to return focus to Foobar window after closing my window. I have core_api::get_main_window() in Create method, but Foobar doesn't reciving focus after my window is closed. Only if I click in Foobar window and then close my window. What I'm missing?

BTW my plugin - it's 'cover downloader' - is here: http://www.mode.ugu.pl/foo_covdow.dll (still alpha/beta). I have a big problem with correctness of my writing in English, when I was walking to the school they taught Russian :-). Could somebody told me how I should call options in preferences, please...?

  • K_S
  • [*]
Focuses, windows...
Reply #1
I managed (hope so) with my problem with focus - if window of thread (progress bar and abort button) as parent has Foobar, then focus after closing my window is returned. I used my window as parent and had problems.

My problem with window 'invisible but blinking on Create' is irritating obstinate and I decided to dodge it, not resolve: show my window even when not needed (when thumbnails are downloaded from Google). It's something in WinAPI+ATL/WTL, not Foobar SDK, so maybe OT.
  • Last Edit: 25 October, 2011, 08:14:21 AM by db1989

  • foosion
  • [*][*][*][*][*]
  • Moderator
Focuses, windows...
Reply #2
There are only few situations where you should need to manage the focus explicitly. As for creating an invisible window, WTL may be trying to help you by providing some default behaviour and window styles there. I remember I had a similar problem once. It is too far ago unfortunately, so I don't remember the details. It might help, if you posted the code that defines and creates your window.
http://foosion.foobar2000.org/ - my components for foobar2000

  • K_S
  • [*]
Focuses, windows...
Reply #3
Sorry for delayed reply

There are only few situations where you should need to manage the focus explicitly.


I don't want to - only my component displays a few windows: main with thumbnails, additional with clicked picture, windows of threads - and if any of this window doesn't have 'core_api::get_main_window()' as parent, after closing my component main window focus doesn't return to Foobar main window. I made some errors, but I don't know where.

Quote
As for creating an invisible window, WTL may be trying to help you by providing some default behaviour and window styles there. I remember I had a similar problem once. It is too far ago unfortunately, so I don't remember the details. It might help, if you posted the code that defines and creates your window.


I created a better version of my plugin - showing downloaded thumbnails, I don't need to hide window - so this is not a big problem now for me.

Window class:

Code: [Select]
typedef CWinTraits<WS_TILEDWINDOW, WS_EX_TOOLWINDOW>//I've tested other combinations, of course
    CovWinTraits;
class CovWin : public CFrameWindowImpl<CovWin,CWindow,CovWinTraits>//CFrameWindowImpl, because I wanted a CreateSimpleStatusBar
        //Tested with CWindowImpl too


then I have a global object

Code: [Select]
static CovWin g_dlg; //I know - this could be done better, but I made this for quick experiments


and in function of context menu:

Code: [Select]
    try{//(...)
        if ( !g_dlg.IsWindow() ){
            RECT rc = {100, 100, 500, 700};//Later cfg_popup_window_placement
            g_dlg.Create(core_api::get_main_window(),rc);//this window is visible
        }
        g_dlg.ShowWindow(SW_HIDE);//A window will disappear, after blinking in Create();
//(...)