Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Bug report Collapse All
Subject Author Date
Rado Manzela May 14, 2007 - 1:28 AM

I’m using this frame window: class CMainFrame : public CExtNCW < CFrameWnd >
I need to do some action when user minimizes the application, but overrided OnSysCommand() is never called, only once when application is closed.

Other thing is that CExtPopupMenu::TrackPopupMenu() is not working properly when its parent window is not foreground window. Clicking to another application does not hide the menu and clicking to menu command asserts (I don’t have the line# here but I can check it later if you need it) - you can reproduce this for example when you insert icon into system tray and will try to create the popup menu after clicking to this icon.

Thank you.

Rado Manzela May 16, 2007 - 5:11 AM

Thank you, I was just wondering what was the reason for not calling user’s OnSysCommand().
Have you looked at the problem with meni in the sample?

Technical Support May 16, 2007 - 9:53 AM

The WindowProc() virtual method of the CExtNCW template class invokes the PreWindowProc() and PostWindowProc() methods of the CExtNcFrameImpl class where required for skinning messages are handled. The CExtNcFrameImpl class is base of the CExtNCW template class but not the first in the inheritance list. The first base class of the CExtNCW template class is always CWnd-based class. It is not possible to access CWnd handlers map from the CExtNcFrameImpl class methods.

The menu problem is not a problem. It is the requirement both for Prof-UIS and Win32 menus: the thread which will track the menu should bring some of its windows to foreground.

Rado Manzela May 16, 2007 - 11:48 AM

Menu problem:

It is strange. How can you implement popup menu after right click on the application’s tray icon when application is hidden?
I don’t have that project here but I think it was working for me with standard CMenu and it is not working with CExtPopupMenu

Technical Support May 16, 2007 - 12:18 PM

The SetForegroundWindow() API relates both to the visible and invisible windows absolutely equally. And you should use it in exactly the same way with Prof-UIS and MFC/Win32’s menus.

Rado Manzela May 17, 2007 - 3:06 AM

thank you, it works with SetForegroundWindow()

Rado Manzela May 15, 2007 - 2:15 AM

Don’t you plan to call user’s OnSysCommand() handler in future?

Here is sample project for the menu (try the view’s context menu) :
http://rrrado.szm.sk/sdi.zip

Technical Support May 15, 2007 - 10:24 AM

You can add the following virtual to the CMainFrame() class to test events received when the frame is closed:

LRESULT CMainFrame::WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
{
      if( message == WM_SYSCOMMAND && wParam == SC_CLOSE )
      {
            ::AfxMessageBox( _T("Exiting via SC_CLOSE system command") );
      }
      if( message == WM_COMMAND && wParam == ID_APP_EXIT )
      {
            ::AfxMessageBox( _T("Exiting via ID_APP_EXIT MFC’s command") );
      }
      if( message == WM_CLOSE )
      {
            ::AfxMessageBox( _T("WM_CLOSE message received") );
      }
      return CExtNCW < CFrameWnd > :: WindowProc( message, wParam, lParam );
}
You will see that the WM_CLOSE notification is the most universal in the case of closing the main frame window by the user. The frame can be closed through

1) ALT+F4
2) Clicking the X button
3) Double clicking the caption icon
3) File | Exit menu

If the DestroyWindow() API is invoked programmatically, then you will not receive the WM_CLOSE message.

Technical Support May 14, 2007 - 9:04 AM

1. The WM_SYSCOMMAND message is completely handled by the CExtNCW::WindowProc() virtual method if the paint manager implements skinned non-client window areas. So if you handle this message in the CMainFrame::WindowProc() virtual method before invoking the CExtNCW < CFrameWnd > :: WindowProc() parent class method, that may fix the problem.

2. Would you send us some sample project that reproduces this problem?

Thank you.