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.
|
Subject |
Author |
Date |
|
|
Stephane Leger
|
May 13, 2010 - 7:11 AM
|
Hi Team,<o:p></o:p> I need some help on this problem. I created an SDI application based on your DynamicBars. I implemented a plugin framework to create my entire Dynamic control bar childs in regular DLL using MFC. Everything works very well until yesterday when I tried to add a WebBrowser in a child dialog. If I keep my child dilaog heritance with the CDialog everything works fine. When I change it to the CExtResizableDialog the ColeControlSite is not created and the application crashed in the CWnd::ShowWindow when calling on the m_pCtrlSite->ShowWindoW(nCmdShow)<o:p></o:p> I debug it and found that the CreateSite(COleControlContainer* pCrtlCont) in my CCustomOccManager is not called when I used your dialog but it is called when I used the CDialog. I am not sure but I think that something is missing in your CResDlg implementation or I missed something. Do you have some suggestion because I started with the webbrowser but I am sure I will have to use more ActiveX in the future? Thanks. Stephane.
|
|
|
Technical Support
|
May 21, 2010 - 7:35 AM
|
We received your e-mail and replied it.
|
|
|
Technical Support
|
May 16, 2010 - 1:14 PM
|
We inserted a web browser into CExtResizableDialog-based window without any problems and compiled the following test project with Visual C++ 6.0 and Visual Studio 2008:
http://www.prof-uis.com/download/forums/TestWebBrowserOnDialog.zip
Did you invoke the AfxEnableControlContainer() API in the InitInstance() virtual method of the CWinApp-derived class in your project?
|
|
|
Stephane Leger
|
May 19, 2010 - 1:36 PM
|
Yes I invoked it. I found the problem and I modified your test program to reproduce it. I am sending it to you by E-mail to both account: profuis@gmail.com; support@prof-uis.com. Thank you again for your Help. Stephane.
|
|
|
Gunasekaran Velu
|
May 12, 2010 - 12:50 AM
|
Hi I am using ProfUIS 2.64 version, i am using date time control in my sample application i want to validate the year while kill focus from the datetime control. How can i do that? or its any alternative method for validate the year when kill focus from the CExtDateTimeWnd control. Kindly help Thanks Guna
|
|
|
Technical Support
|
May 13, 2010 - 12:52 PM
|
Here is it:
class CMyDateTimeWnd : public CExtDateTimeWnd
{
public:
virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
{
LRESULT lr = CExtDateTimeWnd::WindowProc( message, wParam, lParam );
switch( message )
{
case WM_KILLFOCUS:
//
//
// TO-DO: Validate the date-time data like you need.
//
//
break;
}
}
}
|
|
|
Gunasekaran Velu
|
May 13, 2010 - 1:09 AM
|
Hi Thanks for the quick reply. If you have any sample code for this WM_KILLFOCUS can you send it to me? Thanks Guna
|
|
|
Technical Support
|
May 12, 2010 - 9:57 AM
|
Please create your own CExtDateTimeWnd-derived class and handle the WM_KILLFOCUS message in it.
|
|
|
Therese P
|
May 11, 2010 - 4:13 PM
|
Hi, thanks for all the helpful reponses. I am wondering if it is possible with the PaintManager to pass throught all the UI and somehow darkening everything (icons, bmp etc) like a X% darker or tell which color to be replaced by another. Would something like CExtPaintManager::stat_RGB_Enlight() do the trick?
|
|
|
Technical Support
|
May 12, 2010 - 9:57 AM
|
Most of the paint managers use bitmap based elements for painting UI items. The ProfSkin paint manager is 100% bitmap based. The Studio 2010, Office 2010 and Office 2007 are partially bitmap based and only some controls are painted using solid/gradient fills. These paint managers cannot become darker by simple color replacements. The older paint managers are not bitmap based and you can make them darker like demonstrated in the ThemeColorizer sample application.
|
|
|
Ralph Stadie
|
May 11, 2010 - 8:10 AM
|
Hi, There seems to be a bug in the way that the WidthFromContent function of CExtStatusBar behaves for certain themes on Windows 7 (and presumably Vista). For example, if I run the standard ZoomScrollBar sample and select the VS2005 theme, the text in the status pane is truncated, however if I select one of the newer themes, such as Office 2007, then it’s ok. Loosely, I’ve determined that only appears to work correctly for the Office 2007 and Office 2010 themes and for all the rest the text is truncated. I’ve only noticed this behaviour on Windows 7, as it seemed to work fine on Windows XP (I can’t confirm what it’s like on Vista). It’s not a serious issue as the workaround is to select one of the newer Office themes, but I thought I’d point it out in case anyone can offer up a simple solution to fix it. Cheers, Ralph
|
|
|
Technical Support
|
May 11, 2010 - 12:55 PM
|
Thank you for reporting this issue. To fix it please update the source code for the following method:
void CExtStatusControlBar::WidthFromContent( int nIndex )
{
ASSERT_VALID( this );
ASSERT((nIndex >= 0 && nIndex < m_nCount) || m_nCount == 0);
_STATUSBAR_PANE_ * pPane = GetPanePtr( nIndex );
ASSERT( pPane != NULL );
if( pPane == NULL )
return;
CRect rcText(0,0,0,0);
if( !pPane->strText.IsEmpty() )
{
HFONT hFont = (HFONT)PmBridge_GetPM()->m_FontNormal.GetSafeHandle();
CClientDC dcScreen( NULL );
HGDIOBJ hOldFont = NULL;
if( hFont != NULL )
hOldFont = dcScreen.SelectObject( hFont );
dcScreen.DrawText(
pPane->strText,
pPane->strText.GetLength(),
&rcText,
GetPaneDrawTextFlags( nIndex ) | DT_CALCRECT
);
if( hOldFont != NULL )
dcScreen.SelectObject( hOldFont );
} // if( !pPane->strText.IsEmpty() )
CStatusBarCtrl & _ctrl = GetStatusBarCtrl();
HICON hIcon = (HICON)
_ctrl.SendMessage(
SB_GETICON,
WPARAM(nIndex)
);
// ICON 2.53
CSize szIcon = CSize(0,0);
// if( hIcon != NULL )
// szIcon = CExtCmdIcon::stat_GetIconSize( hIcon );
if( hIcon != NULL )
{
CExtCmdIcon _icon;
_icon.AssignFromHICON( hIcon, false );
szIcon = _icon.GetSize();
}
SetPaneWidth(
nIndex,
szIcon.cx + rcText.Width() + 2
);
RepositionControls();
}
|
|
|
Ralph Stadie
|
May 12, 2010 - 2:46 AM
|
Thanks - that did the trick!
|
|
|
Therese P
|
May 10, 2010 - 11:46 AM
|
Hi, after your answer for input user icons in the grilder filter header. I used
CExtPaintManager * pPM = PmBridge_GetPM();CExtBitmap l_oBitmap;l_oBitmap.LoadBMP_File( _T("Path/FILTER_UNAPPLIED.BMP")); ... g_CmdManager.OnSysColorChange( pPM, this );
and it works great, thanks! But now we want to do something similar with the filter-popup-menu icons (clearing the filter, sorting from A to Z and Z to A). It looks like you do it in CExtGridCellHeaderFilter::OnInitializeFilterPopupMenu(). Is there a simple way without creating a child class to CExtGridCellHeaderFilter and overriding the method? Because in our case, we would have to change major parts of our desing and implementation and it does not seem worth it for just 3 icons, but we reaaly do need to put our customer required icons. So we are looking for something more global like for the filter header.
Thank You
|
|
|
Technical Support
|
May 11, 2010 - 12:54 PM
|
|
|
|
|
Chris G.
|
May 8, 2010 - 11:53 AM
|
Hello Prof-UIS team, when i create a new Prof-UIS MFC project everything is skinned correctly except the about dialog. There the icon and the static text has a gray background. Everything else looks like it should. What do i need to do to make those items also have Prof-UIS style? I’m using Prof-UIS 2.85. Best regards, Chris
|
|
|
Chris G.
|
May 11, 2010 - 2:25 PM
|
Thank you! That did the trick! Best regards, Chris
|
|
|
Technical Support
|
May 11, 2010 - 12:53 PM
|
Please ensure your About dialog is derived from the CExtNCW < CExtResizableDialog > class and it invokes the SubclassChildControls() API in its OnInitDialog() virtual method.
|
|
|
Therese P
|
May 7, 2010 - 10:35 AM
|
Hi, I am looking to access the "funnel icon" for filtering in the grid. I need to modify it or even input my own icon. Is there a method (maybe in CExtGridWnd) thats allows to input our own icon? Thanks
|
|
|
Technical Support
|
May 7, 2010 - 12:14 PM
|
The CExtPaintManager::m_bmpFilterApplied and m_bmpFilterUnApplied properties are CExtBitmap objects containing icons you want to change. You can simply load your own bitmaps into these objects. Please note they will be reloaded on theme changing.
You can also override the CExtGridCellHeaderFilter::OnPaintButton() virtual method in your CExtGridCellHeaderFilter-derived class and completely repaint the fliter button like you need.
|
|
|
Jeff Ernst
|
May 6, 2010 - 5:47 PM
|
I am using a CExtDynamicControlBar for a dialog window similar to the "Input Fields" in the Skinable example. I am using the Office2007 paint theme with prof-uis free version 2.88. The bar is connected to a button on the mainframe that shows or hides the window using: m_pStrategyBar->BarStateSet(CExtDynamicControlBar::__EDBS_DOCUMENT, true); I would like to know how to: 1) Control the window size 2) Disable maximize capability. Also, when the window is maximized or restored there is excessive painting occurring. It seems to paint a thinner frame first, then the thick frame. 3) How do I suppress painting while the window is being recalculated. Thanks
|
|
|
Jeff Ernst
|
May 8, 2010 - 5:29 AM
|
I was able to solve the issues by overriding the OnMoveChildToDocument() virtual function. 
|
|
|
Technical Support
|
May 7, 2010 - 12:12 PM
|
The second item (Disable maximize capability) lets us suppose all the three items are related to the main frame window rather to the dynamic resizable control bar window. The resizable control bar cannot be maximized. The window size is controlled by handling the WM_GETMINMAXINFO standard message. If your main frame class is based on the CExtNCW template class, then please handle the WM_GETMINMAXINFO message in the main frame’s WindowProc() virtual method. To disable the maximize button you should disable the SC_MAXIMIZE menu item in the main frame’s window system menu:
CMenu * pSysMenu = pMainFrame->GetSystemMenu( FALSE );
if( pSysMenu != NULL )
pSysMenu->EnableMenuItem(
SC_MAXIMIZE,
MF_DISABLED|MF_GRAYED|MF_BYCOMMAND
);
Please provide us with more information about item three. Which kind of unwanted repainting and/or flicker effects occurs in your app and when? Whether the same things occur in any of Prof-UIS sample apps? Which Prof-UIS version, Visual C++ and Windows versions were used in your tests?
|
|
|
Dylan da Silva
|
Apr 30, 2010 - 3:08 PM
|
I’m using several CExtDateTimeWnd controls and it looks great but I’d like to format the date DD/MM/YYYY instead of what seems to be the only option of MM/DD/YYYY. I’m aware that this might be associated with the locale settings on the computer but I can’t count on them being set consistently from system to system. Is there a way to change the formatting in code? Or a quick and dirty way of changing the locale for that window or something?
|
|
|
Technical Support
|
May 3, 2010 - 8:22 AM
|
The CExtDateTimeWnd control is not a text edit based window. It’s designed as a container for several editable fields and text label fields. The CExtDateTimeWnd::OnInitializeItemsArray() virtual method initializes all these fields by invoking several CExtDateTimeWnd::OnInitializeItem***() virtual methods responsible for initialization of each particular field. You can override any of these virtual methods and perform your own initialization sequence.
|
|
|
Jean-Yves Tremblay
|
Apr 29, 2010 - 12:38 PM
|
Dear Support,
I extended SubclassChildControls() to subclass dialogs in the same way.
Here is the code that I use :
void SubclassChildControls(HWND hWndParent)
{
...
GetClassName(hWndParent, szClassName,
sizeof(szClassName)/sizeof(szClassName[0]));
//Subclass *THIS* DIALOG
if (_stricmp(szClassName, WC_DIALOG2) == 0) // WC_DIALOG2[] = "#32770";
{
pWndParent = CWnd::FromHandlePermanent(hWndParent);
if (pWndParent == NULL)
{
pWndParent = new CTheDynamicDialog;
pWndParent->SubclassWindow(hWndParent);
}
}
...
}
class CTheDynamicDialog : public CExtNCW < CExtResizableDialog >
{
protected:
CVABExtMenuControlBar m_wndMenuBar;
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
virtual void PreSubclassWindow();
virtual void PostNcDestroy()
{
delete this;
}
};I also wanted to use the prof-uis menu bar if the "unsubclassed" dialog had one : CTheDynamicDialog::PreSubclassWindow()
{
CExtNCW < CExtResizableDialog >::PreSubclassWindow();
HMENU hMenu = NULL;
CMenu *pOldMenu = NULL;
//Menu deja subclasse
if (::IsWindow(m_wndMenuBar.GetSafeHwnd()))
{
return;
}
//Pas de menu a subclasser
pOldMenu = GetMenu();
if (pOldMenu == NULL)
{
return;
}
SetMenu(NULL);
if (!m_wndMenuBar.Create(NULL, this, 59397, 0x50402034))
{
pOldMenu->DestroyMenu();
return;
}
hMenu = pOldMenu->Detach();
m_wndMenuBar.LoadMenuBar(hMenu);
CWnd::RepositionBars(0,0xFFFF,0);
}I overrided CExtMenuControlBar::LoadMenuBar() to load an existing HMENU instead of loading one from resource : BOOL CVABExtMenuControlBar::LoadMenuBar(HMENU hMenu)
{
if( m_menuDoc.GetSafeHmenu() != NULL )
{
VERIFY( m_menuDoc.DestroyMenu() );
}
if( m_menuFrame.GetSafeHmenu() != NULL )
{
VERIFY( m_menuFrame.DestroyMenu() );
}
if( m_pDockSite != NULL )
{
if ( GetSafeHwnd() == NULL
|| (!::IsWindow(GetSafeHwnd()))
|| m_menuFrame.GetSafeHmenu() != NULL
)
{
ASSERT( FALSE );
return FALSE;
}
}
//~~DC_100402 -->
/*
if( ! g_ResourceManager->LoadMenu( m_menuFrame, nResourceID ) )
{
ASSERT( FALSE );
return FALSE;
}
*/
if (!m_menuFrame.Attach(hMenu))
{
ASSERT(FALSE);
return FALSE;
}
//~~DC_100402 <--
ASSERT( ::IsMenu(m_menuFrame.GetSafeHmenu()) );
if( !g_CmdManager->UpdateFromMenu(
g_CmdManager->ProfileNameFromWnd( GetSafeHwnd() ),
m_menuFrame.GetSafeHmenu()))
{
ASSERT( FALSE );
return FALSE;
}
return _UpdateMenuBar();
}Until then, all seems to work perfectly but when I click on an item in the menu, all the sub-items that pop-up are grayed. I suspect that it’s related to the command manager. I didn’t register any profile with the subclassed dialog since it has one by default. (I tried to register my own profile, but it makes no difference). Stangely, the only command that works is ID_APP_EXIT (0xE141) I also have some predefined commands like ID_FILE_OPEN and ID_FILE_SAVE. What remains is just custom commands, beginning at 32771 It’s worth noting that the dialog to subclass is created in a dll while the subclassing take place in the exe side. The dll is loaded via LoadLibrary, not linked with a lib. Any suggestion ? Thanks in advance ! David
|
|
|
Technical Support
|
May 4, 2010 - 9:33 AM
|
The popup menus displayed from the menu bar use the standard MFC’s CCmdUI-based command updating mechanism for controlling enabled / checked / radio states of all the menu’s command items. If there are no command/updating handlers found for particular menu items, such menu items get auto-disabled. The menu command items with system command range identifiers are not auto-disabled. You can simply handle/update your dynamic menu bar’s commands in the OnCmdMsg() virtual method.
|
|
|
Dylan da Silva
|
Apr 28, 2010 - 9:59 AM
|
We are in the process of updating our context menus with prof-UIS but we can’t seem to get them working at all. The following code shows what I mean (taken from DrawCLI sample application):
CMenu menu;
/*if( !menu.LoadMenu(ID_POPUP_MENU) )
{
ASSERT( FALSE );
return;
}*/
menu.CreatePopupMenu();
menu.AppendMenu(MF_STRING,ID_EDIT_CUT,"Cut");
HWND hWnd = AfxGetMainWnd()->GetSafeHwnd();
ASSERT( hWnd != NULL );
ASSERT( ::IsWindow( hWnd ) );
CExtPopupMenuWnd * pPopup = new CExtPopupMenuWnd;
VERIFY( pPopup->UpdateFromMenu( hWnd, &menu ) ); <--- fails here
VERIFY(
pPopup->TrackPopupMenu(
TPMX_OWNERDRAW_FIXED|TPMX_HIDE_KEYBOARD_ACCELERATORS,
point.x,
point.y
)
);
|
|
|
Technical Support
|
Apr 29, 2010 - 6:31 AM
|
Then you don’t need the command manager. Just invoke the CExtPopupMenuWnd::UpdateFromMenu() method with the bNoRefToCmdMngr parameter set to true.
|
|
|
Dylan da Silva
|
Apr 29, 2010 - 7:36 AM
|
So I changed the line with the error to:
VERIFY( pPopup->UpdateFromMenu( hWnd, &menu, true, true, true ) ); I get the same error as before. I’m not understanding what’s wrong here. After the AppendMenu() call, I can call TrackPopupMenu() and see a non-Prof-UIS menu, but Prof-UIS doesn’t seem to like that same menu object when it’s passed to UpdateFromMenu(). BTW, stepping back through the call stack when the VERIFY fails shows that the variable m_bTopLevel is false when we specifically set it to true. There has to be an extra step or something that’s missing.
|
|
|
Technical Support
|
May 3, 2010 - 8:21 AM
|
There are two types of menu resources:
1) Simple menu resources which typically used for the standard window menu line implemented as a window non-client area near the window caption.
2) Popup menu resources which are used for Win32 context menus only. These menu resources have only one popup menu item at the top level.
Please specify the correct flag value in the bPopupMenu parameter of the CExtPopupMenuWnd::UpdateFromMenu() method:
BOOL CExtPopupMenuWnd::UpdateFromMenu(
HWND hWndCmdRecv,
CMenu * pBuildMenu,
bool bPopupMenu, // = true
bool bTopLevel, // = true
bool bNoRefToCmdMngr // = false
)
|
|
|
Technical Support
|
Apr 28, 2010 - 12:43 PM
|
There are two types of menu items:
1) The menu items which are based on the command manager and updated via the MFC’s command updating mechanism. This is the default menu item type. Such menu items appear in the CExtPopupMenuWnd popup menu when the CExtPopupMenuWnd::ItemInsert() method is invoked or when the CExtPopupMenuWnd::LoadMenu() / CExtPopupMenuWnd::UpdateFromMenu() methods are invoked with the bNoRefToCmdMngr parameter set to false. These menu items use the command manager for retrieving menu item text and icon. That’s why the icons appear in menu command items automatically. But such UI design of popup menu window requires the command manager updating from all the menu resources used in your application.
2) The menu items which are NOT based on the command manager and NOT updated via the MFC’s command updating mechanism. Such menu items appear in the CExtPopupMenuWnd popup menu when the CExtPopupMenuWnd::ItemInsertCommand() method is invoked or when the CExtPopupMenuWnd::LoadMenu() / CExtPopupMenuWnd::UpdateFromMenu() methods are invoked with the bNoRefToCmdMngr parameter set to true. This not the default case. But such menu items are very handy for constructing dynamic popup menus containing dynamic menu item counts.
You should choose which menu items do you need? Whether you should simply update the command manager from all the menu resources or whether you need fully dynamic context menus?
|
|
|
Dylan da Silva
|
Apr 28, 2010 - 1:39 PM
|
Thank you for your response. However, if you look at the code I pasted originally I need THAT to work. All of our context menus are dynamically created like in the example there. From what you have told me I would need to add every single pop-up menu Command ID to the Command Manager to get it working the way we want it to?
|
|
|
Bart Kampers
|
Apr 28, 2010 - 9:41 AM
|
I have created a CExtGridWnd having __EGWS_BSE_SORT_COLUMNS set. How can I force the grid to sort on a column after populating it?
|
|
|
Technical Support
|
May 6, 2010 - 1:47 PM
|
To avoid the ascending/descending sorting order switching the CExtGridWnd::GridSortOrderSetup() should be invoked with the bUpdateExistingSortOrder parameter set to false and the bInvertIntersectionSortOrder parameter false. If the CExtGridDataSortOrder object does contains zero count of the CExtGridDataSortOrder::ITEM_INFO objects, then the sorting rules are completely removed and all the header cells does not display sort arrows. Please check this again.
|
|
|
Bart Kampers
|
May 7, 2010 - 1:14 AM
|
I checked gridDataSortOrder.m_arrItems and is has m_nSize == 1, however the column has more than one cell This is my code:
CExtGridDataSortOrder gridDataSortOrder;CExtGridDataSortOrder::ITEM_INFO itemInfo(DATE_COLUMN, false);gridDataSortOrder.m_arrItems.Add(itemInfo);m_ArchiveGrid.GridSortOrderSetup(false, gridDataSortOrder, false, false);
Note that the documentation for CExtGridWnd::GridSortOrderSetup says: "bInvertIntersectionSortOrder makes sense only if bUpdateExistingSortOrder is set to true."
|
|
|
Technical Support
|
May 7, 2010 - 12:13 PM
|
We suspect your project uses some code which loads the CExtGridDataSortOrder sorting rules from somewhere (registry or file) and applies the restored sorting rules to the grid window after you invoked the code in your message. The code in your message is physically unable to sort the grid window in different directions when you running your app several times. Please set breakpoint inside the GridSortOrderSetup() method and check when it’s invoked and how many times.
|
|
|
Technical Support
|
Apr 28, 2010 - 12:42 PM
|
Here is how to sort the CExtGridWnd grid control programmatically and independently of whether the __EGWS_BSE_SORT_*** styles were applied:
LONG nColNoToSort = . . .
bool bSortAscending = . . .
CExtGridWnd & wndGrid = . . .
CExtGridDataSortOrder _gdso;
CExtGridDataSortOrder::ITEM_INFO _ii( nColNoToSort, bSortAscending );
_gdso.m_arrItems.Add( _ii );
wndGrid.GridSortOrderSetup( false, _gdso );
|
|
|
Bart Kampers
|
May 6, 2010 - 3:41 AM
|
This works nice for one time . But when I repopulate the grid and invoke GridSortOrderSetup again the order is always inverted, no matter what combination of bUpdateExistingSortOrder and bInvertIntersectionSortOrder I choose.
|
|
|
Swetha Kishan
|
Apr 28, 2010 - 6:26 AM
|
Hi ! I have few issues when using CExtComboBox under ProfUIs 2.5 version (with Visual Studio 2005). 1) When I try to use CExtComboBox for Unicode buid(created a var of this type and tried to add strings using AddString), I get link errors LNK2019 and LNK2001 for Create() function under CResDlg and for ProfileSetup(). 2) When I tried MBCS build, the prj gets built very well but no strings are displayed under combo box (used AddString() to add strings to Combo box). 3) I tried the same code with ProfUIs 2.88 libraries. Under unicode build, it works perfectly fine !! but the same code under MBCS build the same above (pt.2) problem comes. Strings are not displayed in combo box. I am confused totally. Can anyone help in this ? I greatly appreciate the quickest response. Regards SK
|
|
|
Swetha Kishan
|
Apr 29, 2010 - 6:26 AM
|
Hi,
I think I am asking you novice questions ! Please clarify the follow -
1) Does ProfUI 2.50 work for unicode configuration applications or only later versions support Unicode ?
2) Do we need to create ProfUI controls only at run time ? Can’t we create it at compile time ? If so, I want to use Visual Studio’s toolbox to drag and drop the controls onto dialog box. In this case, I create a control, say combo box through VS’s toolbox; but my code has CExtComboBox’s variable for which I add strings. Now, how does VS understand that the combo box created must be mapped to CExtComboBox ? I even used DDX_Control with combo box’s id with respective variable. But I don’t see any strings added to combo box when I run the app.
3) I saw in your portal that ProfUI’s seperate toolbox is provided. Is it not for FreeWare ?
4) I got the installable "95727-profuis250_trial.exe" for 2.5 version. But I realized after installation that very few include files are present in Include dir and ’Src’ folder has just few .h files and not source files. I was getting compiler errors (asking for remaining .h files) when building ProfUISLib project. As I had a different copy of 2.5 version (not installable, direct files ! ) I copied entire Include and Src folders after this installation. I just want to know if any thing went wrong there.
4) Here is a small sample prj (SampProfUI) that has just one combobox and an edit control in a dialog box :
4.1) SampProfUI.h
#pragma
once __AFXWIN_H__
#error "include ’stdafx.h’ before including this file for PCH"
#endif
#include "resource.h" // main symbols
class
{ CSampProfUIApp : public CWinApp
public
CSampProfUIApp();
~CSampProfUIApp(); :
public
DECLARE_MESSAGE_MAP()
};
4.2) SampProfUI.cpp :virtual BOOL InitInstance();
// SampProfUI.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "SampProfUI.h"
#include "SampProfUIDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define
BEGIN_MESSAGE_MAP(CSampProfUIApp, CWinApp)
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
CSampProfUIApp::CSampProfUIApp()
{
}
CSampProfUIApp::~CSampProfUIApp()
{
}
CSampProfUIApp theApp;
BOOL CSampProfUIApp::InitInstance()
{
VERIFY( AfxOleInit() );
VERIFY( AfxInitRichEdit() );
free( (
m_pszProfileName = _tcsdup( _T(
ASSERT( m_pszProfileName != NULL );
VERIFY( g_CmdManager->ProfileSetup(m_pszProfileName) );
SetRegistryKey(_T(
ASSERT( m_pszRegistryKey != NULL );
CSampProfUIDlg dlg;
m_pMainWnd = &dlg;
dlg.DoModal();
}
4.3) SampProfUIDlg.h CMD_PROFILE_NAME _T("SK-profile")if( m_pszProfileName != NULL )void*)m_pszProfileName );"SK_Sample_Controls") );"SK_Sample"));return FALSE;
#pragma
class
{ once CSampProfUIDlg : public CExtResizableDialog
public
DECLARE_DYNAMIC(CSampProfUIDlg)
CSampProfUIDlg(CWnd* pParent = NULL);
~CSampProfUIDlg();
:enum { IDD = IDD_SAMPPROFUI_DIALOG };protected:virtual void DoDataExchange(CDataExchange* pDX); virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
protected
HICON m_hIcon; :
virtual
afx_msg
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP() BOOL OnInitDialog();void OnPaint();
public
afx_msg :void OnBnClickedOk();
private
CExtEdit m_Edit;
CExtComboBox m_Combo;
CString m_ComboStr; :
public
afx_msg
afx_msg
}; :void OnBnClickedCancel();void OnCbnSelchangeCombo1();
4.4) SampProfUIDlg.cpp
// SampProfUIDlg.cpp : implementation file
//
#include "stdafx.h"
#include "SampProfUI.h"
#include "SampProfUIDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
IMPLEMENT_DYNAMIC(CSampProfUIDlg, CExtResizableDialog)
CSampProfUIDlg::CSampProfUIDlg(CWnd* pParent )
: CExtResizableDialog(CSampProfUIDlg::IDD, pParent)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
CSampProfUIDlg::~CSampProfUIDlg()
{
}
void
{
CExtResizableDialog ::DoDataExchange(pDX);
DDX_Control(pDX, IDC_EDIT1, m_Edit);
DDX_Control(pDX, IDC_COMBO1, m_Combo);
}
BEGIN_MESSAGE_MAP(CSampProfUIDlg, CExtResizableDialog)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDOK, &CSampProfUIDlg::OnBnClickedOk)
ON_BN_CLICKED(IDCANCEL, &CSampProfUIDlg::OnBnClickedCancel)
ON_CBN_SELCHANGE(IDC_COMBO1, &CSampProfUIDlg::OnCbnSelchangeCombo1)
END_MESSAGE_MAP()
BOOL CSampProfUIDlg::OnInitDialog()
{
{
ASSERT( FALSE );
}
SetIcon(m_hIcon, TRUE);
SetIcon(m_hIcon, FALSE); CSampProfUIDlg::DoDataExchange(CDataExchange* pDX)if (!CExtResizableDialog ::OnInitDialog())return FALSE;
m_Combo.AddString(
m_Combo.AddString(
m_Combo.AddString(
m_Combo.AddString(
m_Combo.AddString(
} "Ramakrishna");"Kishan Rao");"Rama");"Saritha");"Shobitha");return TRUE;
void
{
{
CPaintDC dc(
CExtMemoryDC dcExt(&dc);
SendMessage(WM_ICONERASEBKGND,
CRect rect;
GetClientRect(&rect);
dcExt.DrawIcon(x, y, m_hIcon);
}
CSampProfUIDlg::OnPaint()if (IsIconic())this); reinterpret_cast<WPARAM>(dcExt.GetSafeHdc()), 0);int cxIcon = GetSystemMetrics(SM_CXICON);int cyIcon = GetSystemMetrics(SM_CYICON);int x = (rect.Width() - cxIcon + 1) / 2;int y = (rect.Height() - cyIcon + 1) / 2;else
{
CExtResizableDialog ::OnPaint();
}
}
HCURSOR CSampProfUIDlg::OnQueryDragIcon()
{
}
LRESULT CSampProfUIDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
LRESULT lResult = CExtResizableDialog :: WindowProc( message, wParam, lParam );
} return static_cast<HCURSOR>(m_hIcon);return lResult;
void
{
CString str;
m_Edit.GetWindowText(str);
AfxMessageBox(str);
AfxMessageBox(m_ComboStr);
} CSampProfUIDlg::OnBnClickedOk()
void
{
CExtResizableDialog::OnCancel();
} CSampProfUIDlg::OnBnClickedCancel()
void
{
CString temp;
m_Combo.GetLBText(iComboSelInd, temp );
m_ComboStr =
m_ComboStr.Append(temp);
} CSampProfUIDlg::OnCbnSelchangeCombo1()int iComboSelInd = m_Combo.GetCurSel();"You selected : " ;
4.5) stdafx.h
#pragma
#ifndef once _SECURE_ATL
#define _SECURE_ATL 1
#endif
#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN
#endif
#ifndef WINVER
#define WINVER 0x0501
#endif
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
#ifndef _WIN32_WINDOWS
#define _WIN32_WINDOWS 0x0410
#endif
#ifndef _WIN32_IE
#define _WIN32_IE 0x0600
#endif
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS
#define _AFX_ALL_WARNINGS
#include <afxwin.h>
#include <afxext.h>
#include <afxdisp.h>
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxdtctl.h>
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h>
#endif
#include <Prof-UIS.h>
#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type=’win32’ name=’Microsoft.Windows.Common-Controls’ version=’6.0.0.0’ processorArchitecture=’x86’ publicKeyToken=’6595b64144ccf1df’ language=’*’\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type=’win32’ name=’Microsoft.Windows.Common-Controls’ version=’6.0.0.0’ processorArchitecture=’ia64’ publicKeyToken=’6595b64144ccf1df’ language=’*’\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type=’win32’ name=’Microsoft.Windows.Common-Controls’ version=’6.0.0.0’ processorArchitecture=’amd64’ publicKeyToken=’6595b64144ccf1df’ language=’*’\"")
#else
#pragma comment(linker,"/manifestdependency:\"type=’win32’ name=’Microsoft.Windows.Common-Controls’ version=’6.0.0.0’ processorArchitecture=’*’ publicKeyToken=’6595b64144ccf1df’ language=’*’\"")
#endif
#endif
I think I am running short of time for my project and I am strucked at the very initial stage! Can you please guide me step-by-step how to create an exe (Static-Static for EXE build configuration) ? I want to create controls through Visual Studio IDE (tool box) and if possible I want to totally avoid run time creation of controls .
Eagerly looking for the response.
Regards
Swetha Kishan
#ifndef
|
|
|
Technical Support
|
Apr 30, 2010 - 5:16 AM
|
Here are the answers to your questions:
1) Yes. It works. But please note, 2.50 is enough old version and it may not work and even may not with the latest Visual C++ versions, especially 64 bit targets.
2) You can create Prof-UIS controls either at run time or use the Custom Control item in toolbox for creating Prof-UIS controls on dialogs. MFC does not support user defined items in Visual Studio toolbox. Here is the article describing how to insert custom controls, including Prof-UIS controls, into the dialog template resources:
http://www.codeproject.com/KB/miscctrl/customcontrol.aspx
3) You probably saw the toolbox controls of the Elegant UI product. Please note, the Elegant UI is absolutely different product and it’s not related neither to Prof-UIS, nor to MFC, nor to C++.
4) Prof-UIS trial version is provided without source code. You cannot compile the ProfUISDLL and ProfUISLIB projects because their CPP files are not included into the Prof-UIS trial installation. The compiled libraries are provided instead.
5) We recommend you that read the following articles first of all:
http://www.prof-uis.com/prof-uis/tech-support/feature-articles/getting-started-with-prof-uis.aspx http://www.prof-uis.com/prof-uis/tech-support/feature-articles/prof-uis-build-configurations.aspx
You can drop us an e-mail with your test project compressed into ZIP file to the support mail box at this web site. This will let us to review it better and provide you with advices
|
|
|
Technical Support
|
Apr 28, 2010 - 10:25 AM
|
We can compile any configuration of any sample app with combo box using VS 2005. May be you can create some simplest possible project demonstrating this issue and send it to us?
|
|
|
Borremans Pierre
|
Apr 28, 2010 - 1:02 AM
|
We use a CAnimateCtrl in a CExtResizableDialog. The CAnimateCtrl plays an avi. When we show the window we see the first image but the animation doesn’t start. How to play the animation and haw to have a themed canimatectrl ?
|
|
|
Technical Support
|
May 6, 2010 - 1:36 PM
|
We are sorry for the delay with this reply. The solution we advised you in this forum threads worked on Windows 2000 and Windows XP and we used this approach in our project. But it looks like this solution is no longer working on Windows XP SP3, Windows Vista and Windows 7. This means we need to play an AVI file directly using appropriate AVI file processing APIs. The following article describes how to do this and provides sample project download:
http://www.codeguru.com/cpp/g-m/multimedia/video/article.php/c1595
Here is our Prof-UIS based remix of the sample project meant in the article above:
http://www.prof-uis.com/download/forums/TestAviWnd.zip
|
|
|
Technical Support
|
Apr 28, 2010 - 10:25 AM
|
|
|
|
|
Borremans Pierre
|
Apr 29, 2010 - 2:18 AM
|
I try the two links but the background is grey ou black. In our application we use the CExtPaintManagerOffice2003 not a bitmap How to have a transparent background ?
|
|
|
Borremans Pierre
|
Apr 28, 2010 - 8:12 AM
|
Or how to play a avi file in a cextresizabledialog ?
|
|
|
Borremans Pierre
|
Apr 23, 2010 - 11:50 PM
|
In our application we want to use the CExtPaintManagerOffice2003. Is it possible to have a paintmanager on a CFontdialog from MFC, or do you have the same control in the profuis ?
|
|
|
Technical Support
|
Apr 28, 2010 - 10:24 AM
|
The themed CFontDialog is in our TO-DO list.
|
|
|
Therese P
|
Apr 22, 2010 - 1:34 PM
|
Hi, could you give an example using CExtGridWnd::FilterStateForOuterRowSerialize() to keep the filter information on a grid and then apply it on the grid after its data has been updated? Thanks
|
|
|
Technical Support
|
Apr 28, 2010 - 10:26 AM
|
The FilteredGrids sample application invokes ***FilterState*** functions for CExtGridWnd, CExtTreeGridWnd and CExtReportGridWnd controls.
|
|
|
Dylan da Silva
|
Apr 21, 2010 - 2:36 PM
|
The first issue is that the title bar flickers between Prof-UIS and old school classic windows when ever you drag the window around or resize it. And if you change the text in the title bar at regular intervals it will sometimes appear (drawn) like classic windows until I interact with the menu or toolbar. The second issue is that I have a dialog derived from CExtResizableDialog and I have several controls like a slider, etc. all of which are surrounded by a Group Box. When the slider is moved the Group Box (which has a control attached because i change the text periodically while using the dialog) flickers. it’s not just once in a blue moon it’s the entire time I’m dragging any of the 5 sliders in the dialog around. Inside and outside the boundary of the group box. These seem related somehow. Like Windows is still rendering the window whatever way it used, but then Prof-UIS jumps in and paints over that. Regardless, how can i make the flickering stop?
|
|
|
Dylan da Silva
|
Apr 27, 2010 - 10:56 AM
|
1) Your dialog template resource has both WS_CLIPCHILDREN|WS_CLIPSIBLINGS styles.
Yes.
2) The Z-order of all the group boxes should be larger than the Z-orders of all the controls "inside" groupboxes. Yes.
|
|
|
Technical Support
|
Apr 28, 2010 - 10:15 AM
|
The dialog controls should also have the WS_CLIPCHILDREN|WS_CLIPSIBLINGS styles set on, including group boxes. Do you have any DirectX/OpenGL/Video output in your dialog? If yes, then the hardware accelerated output should be performed in a standalone window create as a child of your dialog.
|
|
|
Dylan da Silva
|
Apr 28, 2010 - 11:32 AM
|
It did not fix the issue. I strongly believe this issue is related to the title bar issue. I have managed to alleviate the flickering int he dialog by only calling SetWindowText() on SB_ENDSCROLL. But the title bar could changed as often as once a second.
|
|
|
Technical Support
|
Apr 28, 2010 - 12:43 PM
|
Then we need your help in reproducing this flickering issue with any of our sample applications or with some simple test project.
|
|
|
Dylan da Silva
|
Apr 29, 2010 - 8:27 AM
|
How should I go about getting the binary to you? Email?
|
|
|
Technical Support
|
May 3, 2010 - 8:22 AM
|
|
|
|
|
Dylan da Silva
|
May 11, 2010 - 7:20 AM
|
Okay, I’m sorry it took so long. I found an application that could be modified easily enough. In Prof-UIS sample FunnyBars, add the following code to the end of the _UpdateHotBar function:
CString str;
srand((unsigned int)time(NULL) ˆ clock());
str.Format("This is a random number: %d",rand());
this->m_wndBoxBrightness.SetWindowText(str);
str.Format("Another random number: %d",rand());
this->m_wndBoxFont.SetWindowText(str);You’ll see that as you drag the brightness slider around the group boxes for Brightness and Font flicker. The flickering is noticeable when using any theme but is most noticeable when using the Office 2007 Obsidian and Office 2010 Black.
|
|
|
Technical Support
|
May 11, 2010 - 12:55 PM
|
Thank you for reporting this issue. To fix it, please update the source code for the following method:
LRESULT CExtGroupBox::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
#if (defined WM_UPDATEUISTATE)
ASSERT( WM_UPDATEUISTATE == 0x0128 );
#endif
// WM_UPDATEUISTATE causes repaint without WM_PAINT, so we eat it
if( message == 0x0128 )
return 0;
if( message == WM_SETTEXT
|| message == WM_ENABLE
)
{
SetRedraw( FALSE );
LRESULT lResult = CButton::WindowProc(message, wParam, lParam);
SetRedraw( TRUE );
Invalidate();
UpdateWindow();
return lResult;
}
if( message == WM_PRINT || message == WM_PRINTCLIENT )
{
CDC * pDC = CDC::FromHandle( (HDC)wParam );
CRect rcClient;
GetClientRect( &rcClient );
DoPaint( pDC, rcClient );
return (!0);
}
return CButton::WindowProc(message, wParam, lParam);
}
|
|
|
Dylan da Silva
|
May 12, 2010 - 6:34 AM
|
This fix worked. Thank you. Any movement on the non-client window title bar redraw issue?
|
|
|
Technical Support
|
May 12, 2010 - 9:56 AM
|
Still didn’t reproduce the window caption flicker. We used the modified version of the PageContainer sample application where we added the following code into the beginning of the CMainFrame::PreTranslateMessage() message:
if( pMsg->message == WM_TIMER && pMsg->hwnd == m_hWnd && pMsg->wParam == 111 )
{
static unsigned long garbage = 0;
CString str;
str.Format("This text has been set %d times...",garbage++);
SetWindowText(str);
return TRUE;
}
We started the timer in the following method: void CMainFrame::OnSetFocus(CWnd* pOldWnd)
{
pOldWnd;
// forward focus to the view window
CView * pView = GetActiveView();
if( pView != NULL )
pView->SetFocus();
SetTimer( 111, 200, NULL );
}
|
|
|
Dylan da Silva
|
May 12, 2010 - 12:27 PM
|
I never tried it with PageContainer because it doesn’t accurately represent our application which is an MDI application with one or more threads that that signal a window title change. The header and source file I posted previously is almost exactly what we’re doing. That has to work. In the MDI application, we instantiate the App then create a child window that we maximize immediately. So all the user sees a single window filling their entire screen. Now at any instant we could change the window text. For the sample I posted earlier, I chose 1 second interval to demonstrate the issue in an efficient manner. What you should see if you double click the title bar is the window shrink slightly, then when you click maximize the window fills the screen again and the titlebar will be redrawn like old school windows. If you cannot reproduce the bug then I’ll go so far as to screen grab or FRAPS the event and send it to you. Keep in mind that this isn’t a consistent event, but it happens frequently enough that it’s very, very noticeable.
|
|
|
Technical Support
|
May 13, 2010 - 12:52 PM
|
It would be very helpful if you show us how to reproduce this issue using any of our sample apps.
|
|
|
Dylan da Silva
|
May 13, 2010 - 5:10 PM
|
From May 12th, 2010: "I never tried it with PageContainer because it doesn’t accurately represent our application which is an MDI application with one or more threads that that signal a window title change. The header and source file I posted previously is almost exactly what we’re doing. That has to work." From April 23rd, 2010: I had some spare time while I was waiting for an answer so I fooled around with the "MDI" sample project. Copy the following code into the project, file->new, maximize the child window, maximize the main window. What you should see is the title bar turning into classic windows (or whatever theme you have on your PC) and staying that way. // ChildFrm.h : interface of the CChildFrame class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_CHILDFRM_H__24FC4FC8_9EB2_47D0_8A72_FBE881021D1D__INCLUDED_)
#define AFX_CHILDFRM_H__24FC4FC8_9EB2_47D0_8A72_FBE881021D1D__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "ChildView.h"
// my stuff ///// begin
class CMyThread : public CWinThread
{
public:
CMyThread(CFrameWnd* wnd) : m_wnd(wnd), m_working(TRUE) {}
~CMyThread(void) {}
CFrameWnd* GetWnd(void) { return m_wnd; }
BOOL IsNotDone(void) { return m_working; }
void StopThread(void) { m_working = FALSE; }
private:
CFrameWnd* m_wnd;
BOOL m_working;
};
// my stuff ///// end
class CChildFrame : public CExtNCW < CMDIChildWnd >
{
DECLARE_DYNCREATE(CChildFrame)
public:
CChildFrame();
// Attributes
public:
private:
HICON m_hChildFrameIcon;
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CChildFrame)
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
virtual BOOL PreTranslateMessage(MSG* pMsg);
//}}AFX_VIRTUAL
// Implementation
public:
// view for the client area of the frame.
CChildView m_wndView;
virtual ~CChildFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
// Generated message map functions
protected:
//{{AFX_MSG(CChildFrame)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code!
afx_msg void OnFileClose();
afx_msg void OnSetFocus(CWnd* pOldWnd);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnDestroy(void);
// my stuff ///// begin
afx_msg LRESULT OnChangeTitleMessage(WPARAM wparam, LPARAM lparam);
// my stuff ///// end
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
// my stuff ///// begin
private:
CMyThread* m_thread;
// my stuff ///// end
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_CHILDFRM_H__24FC4FC8_9EB2_47D0_8A72_FBE881021D1D__INCLUDED_) // ChildFrm.cpp : implementation of the CChildFrame class
//
#include "stdafx.h"
#include "MDI.h"
#include "ChildFrm.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// my stuff ///// begin
UINT MyThreadProc( LPVOID pParam );
// my stuff ///// end
static int count = 0;
static const UINT MPM_CHANGE_TITLE_MESSAGE = ::RegisterWindowMessage("MPM_CHANGE_TITLE_MESSAGE");
/////////////////////////////////////////////////////////////////////////////
// CChildFrame
IMPLEMENT_DYNCREATE( CChildFrame, CMDIChildWnd )
BEGIN_MESSAGE_MAP( CChildFrame, CMDIChildWnd )
//{{AFX_MSG_MAP(CChildFrame)
ON_REGISTERED_MESSAGE(MPM_CHANGE_TITLE_MESSAGE,OnChangeTitleMessage)
ON_COMMAND(ID_FILE_CLOSE, OnFileClose)
ON_WM_SETFOCUS()
ON_WM_CREATE()
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// my stuff ///// begin
LRESULT CChildFrame::OnChangeTitleMessage(WPARAM, LPARAM)
{
// do Fibanacci
unsigned long long garbage = 24;
for(int i=0;i<1000;++i)
garbage *= (unsigned long long)i;
// then set window text
CString str;
str.Format("This text has been set %d times...",count++);
SetWindowText(str);
return 0;
}
// my stuff ///// end
/////////////////////////////////////////////////////////////////////////////
// CChildFrame construction/destruction
CChildFrame::CChildFrame()
{
// TODO: add member initialization code here
m_hChildFrameIcon = NULL;
HINSTANCE hInstResource =
AfxFindResourceHandle(
MAKEINTRESOURCE(IDR_MDITYPE),
RT_GROUP_ICON
);
ASSERT( hInstResource != NULL );
if( hInstResource != NULL )
{
m_hChildFrameIcon =
(HICON)::LoadImage(
hInstResource,
MAKEINTRESOURCE(IDR_MDITYPE),
IMAGE_ICON,
16,
16,
0
);
ASSERT( m_hChildFrameIcon != NULL );
}
}
CChildFrame::~CChildFrame()
{
if( m_hChildFrameIcon != NULL )
{
::DestroyIcon( m_hChildFrameIcon );
}
}
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( ! CExtNCW < CMDIChildWnd > :: PreCreateWindow( cs ) )
return FALSE;
cs.style |= WS_CLIPCHILDREN|WS_CLIPSIBLINGS;
cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
cs.lpszClass = AfxRegisterWndClass( 0 );
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CChildFrame diagnostics
#ifdef _DEBUG
void CChildFrame::AssertValid() const
{
CExtNCW < CMDIChildWnd > :: AssertValid();
}
void CChildFrame::Dump(CDumpContext& dc) const
{
CExtNCW < CMDIChildWnd > :: Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CChildFrame message handlers
void CChildFrame::OnFileClose()
{
// To close the frame, just send a WM_CLOSE, which is the equivalent
// choosing close from the system menu.
SendMessage(WM_CLOSE);
}
int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if( CExtNCW < CMDIChildWnd > :: OnCreate( lpCreateStruct ) == -1 )
return -1;
ASSERT( m_hChildFrameIcon != NULL );
SetIcon( m_hChildFrameIcon, FALSE );
SetIcon( m_hChildFrameIcon, TRUE );
// create a view to occupy the client area of the frame
if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
{
TRACE0("Failed to create view window\n");
return -1;
}
// my stuff ///// begin
m_thread = new CMyThread((CFrameWnd*)this);
AfxBeginThread(MyThreadProc, m_thread);
// my stuff ///// end
return 0;
}
void CChildFrame::OnDestroy()
{
// my stuff ///// begin
m_thread->StopThread();
m_thread->Delete();
// my stuff ///// end
CExtNCW < CMDIChildWnd > :: OnDestroy();
}
void CChildFrame::OnSetFocus(CWnd* pOldWnd)
{
CExtNCW < CMDIChildWnd > :: OnSetFocus(pOldWnd);
if( m_wndView.GetSafeHwnd() != NULL )
m_wndView.SetFocus();
}
BOOL CChildFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
// let the view have first crack at the command
if( m_wndView.GetSafeHwnd() != NULL
&& m_wndView.OnCmdMsg( nID, nCode, pExtra, pHandlerInfo )
)
return TRUE;
// otherwise, do default handling
return CExtNCW < CMDIChildWnd > :: OnCmdMsg( nID, nCode, pExtra, pHandlerInfo );
}
BOOL CChildFrame::PreTranslateMessage(MSG* pMsg)
{
CMainFrame * pMainFrame =
DYNAMIC_DOWNCAST(
CMainFrame,
::AfxGetMainWnd()
);
ASSERT_VALID( pMainFrame );
if( pMainFrame->m_wndMenuBar.TranslateMainFrameMessage(pMsg) )
return TRUE;
return CExtNCW < CMDIChildWnd > :: PreTranslateMessage(pMsg);
}
// my stuff ///// begin
UINT MyThreadProc( LPVOID pParam )
{
CMyThread* pThread = (CMyThread*)pParam;
if (pThread == NULL)
return 1;
while (pThread->IsNotDone())
{
pThread->GetWnd()->PostMessage(MPM_CHANGE_TITLE_MESSAGE);
Sleep(1000);
}
return 0; // thread completed successfully
}
// my stuff ///// end
|
|
|
Dylan da Silva
|
May 11, 2010 - 1:21 PM
|
Any idea if something similar will fix the title bar repainting issue? Can I find a spot to make the same mod to ensure the Title bar is redrawn properly when we use mainFrame->SetWindowText()?
|
|
|
Technical Support
|
May 12, 2010 - 9:58 AM
|
We checked the title bar text changing in Prof-UIS 2.89 and it’s OK. The older Prof-UIS versions may require sending the WM_NCPAINT message after changing window text.
|
|
|
Dylan da Silva
|
May 12, 2010 - 12:20 PM
|
Should i just SendMessage(WM_NCPAINT) after I change the title text? Or is their a tighter way to make sure this bug is fixed?
|
|
|
Technical Support
|
May 13, 2010 - 12:51 PM
|
To sending a WM_NCPAINT message is enough. Please note, this issue with window text changing is gone in the latest Prof-UIS version.
|
|
|
Technical Support
|
Apr 27, 2010 - 10:28 AM
|
Please check the following:
1) Your dialog template resource has both WS_CLIPCHILDREN|WS_CLIPSIBLINGS styles.
2) The Z-order of all the group boxes should be larger than the Z-orders of all the controls "inside" groupboxes.
|
|
|
Dylan da Silva
|
Apr 23, 2010 - 1:52 PM
|
I had some spare time while I was waiting for an answer so I fooled around with the "MDI" sample project. Copy the following code into the project, file->new, maximize the child window, maximize the main window. What you should see is the title bar turning into classic windows (or whatever theme you have on your PC) and staying that way.
// ChildFrm.h : interface of the CChildFrame class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_CHILDFRM_H__24FC4FC8_9EB2_47D0_8A72_FBE881021D1D__INCLUDED_)
#define AFX_CHILDFRM_H__24FC4FC8_9EB2_47D0_8A72_FBE881021D1D__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "ChildView.h"
// my stuff ///// begin
class CMyThread : public CWinThread
{
public:
CMyThread(CFrameWnd* wnd) : m_wnd(wnd), m_working(TRUE) {}
~CMyThread(void) {}
CFrameWnd* GetWnd(void) { return m_wnd; }
BOOL IsNotDone(void) { return m_working; }
void StopThread(void) { m_working = FALSE; }
private:
CFrameWnd* m_wnd;
BOOL m_working;
};
// my stuff ///// end
class CChildFrame : public CExtNCW < CMDIChildWnd >
{
DECLARE_DYNCREATE(CChildFrame)
public:
CChildFrame();
// Attributes
public:
private:
HICON m_hChildFrameIcon;
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CChildFrame)
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
virtual BOOL PreTranslateMessage(MSG* pMsg);
//}}AFX_VIRTUAL
// Implementation
public:
// view for the client area of the frame.
CChildView m_wndView;
virtual ~CChildFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
// Generated message map functions
protected:
//{{AFX_MSG(CChildFrame)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code!
afx_msg void OnFileClose();
afx_msg void OnSetFocus(CWnd* pOldWnd);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnDestroy(void);
// my stuff ///// begin
afx_msg LRESULT OnChangeTitleMessage(WPARAM wparam, LPARAM lparam);
// my stuff ///// end
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
// my stuff ///// begin
private:
CMyThread* m_thread;
// my stuff ///// end
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_CHILDFRM_H__24FC4FC8_9EB2_47D0_8A72_FBE881021D1D__INCLUDED_)// ChildFrm.cpp : implementation of the CChildFrame class
//
#include "stdafx.h"
#include "MDI.h"
#include "ChildFrm.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// my stuff ///// begin
UINT MyThreadProc( LPVOID pParam );
// my stuff ///// end
static int count = 0;
static const UINT MPM_CHANGE_TITLE_MESSAGE = ::RegisterWindowMessage("MPM_CHANGE_TITLE_MESSAGE");
/////////////////////////////////////////////////////////////////////////////
// CChildFrame
IMPLEMENT_DYNCREATE( CChildFrame, CMDIChildWnd )
BEGIN_MESSAGE_MAP( CChildFrame, CMDIChildWnd )
//{{AFX_MSG_MAP(CChildFrame)
ON_REGISTERED_MESSAGE(MPM_CHANGE_TITLE_MESSAGE,OnChangeTitleMessage)
ON_COMMAND(ID_FILE_CLOSE, OnFileClose)
ON_WM_SETFOCUS()
ON_WM_CREATE()
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// my stuff ///// begin
LRESULT CChildFrame::OnChangeTitleMessage(WPARAM, LPARAM)
{
// do Fibanacci
unsigned long long garbage = 24;
for(int i=0;i<1000;++i)
garbage *= (unsigned long long)i;
// then set window text
CString str;
str.Format("This text has been set %d times...",count++);
SetWindowText(str);
return 0;
}
// my stuff ///// end
/////////////////////////////////////////////////////////////////////////////
// CChildFrame construction/destruction
CChildFrame::CChildFrame()
{
// TODO: add member initialization code here
m_hChildFrameIcon = NULL;
HINSTANCE hInstResource =
AfxFindResourceHandle(
MAKEINTRESOURCE(IDR_MDITYPE),
RT_GROUP_ICON
);
ASSERT( hInstResource != NULL );
if( hInstResource != NULL )
{
m_hChildFrameIcon =
(HICON)::LoadImage(
hInstResource,
MAKEINTRESOURCE(IDR_MDITYPE),
IMAGE_ICON,
16,
16,
0
);
ASSERT( m_hChildFrameIcon != NULL );
}
}
CChildFrame::~CChildFrame()
{
if( m_hChildFrameIcon != NULL )
{
::DestroyIcon( m_hChildFrameIcon );
}
}
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( ! CExtNCW < CMDIChildWnd > :: PreCreateWindow( cs ) )
return FALSE;
cs.style |= WS_CLIPCHILDREN|WS_CLIPSIBLINGS;
cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
cs.lpszClass = AfxRegisterWndClass( 0 );
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CChildFrame diagnostics
#ifdef _DEBUG
void CChildFrame::AssertValid() const
{
CExtNCW < CMDIChildWnd > :: AssertValid();
}
void CChildFrame::Dump(CDumpContext& dc) const
{
CExtNCW < CMDIChildWnd > :: Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CChildFrame message handlers
void CChildFrame::OnFileClose()
{
// To close the frame, just send a WM_CLOSE, which is the equivalent
// choosing close from the system menu.
SendMessage(WM_CLOSE);
}
int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if( CExtNCW < CMDIChildWnd > :: OnCreate( lpCreateStruct ) == -1 )
return -1;
ASSERT( m_hChildFrameIcon != NULL );
SetIcon( m_hChildFrameIcon, FALSE );
SetIcon( m_hChildFrameIcon, TRUE );
// create a view to occupy the client area of the frame
if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
{
TRACE0("Failed to create view window\n");
return -1;
}
// my stuff ///// begin
m_thread = new CMyThread((CFrameWnd*)this);
AfxBeginThread(MyThreadProc, m_thread);
// my stuff ///// end
return 0;
}
void CChildFrame::OnDestroy()
{
// my stuff ///// begin
m_thread->StopThread();
m_thread->Delete();
// my stuff ///// end
CExtNCW < CMDIChildWnd > :: OnDestroy();
}
void CChildFrame::OnSetFocus(CWnd* pOldWnd)
{
CExtNCW < CMDIChildWnd > :: OnSetFocus(pOldWnd);
if( m_wndView.GetSafeHwnd() != NULL )
m_wndView.SetFocus();
}
BOOL CChildFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
// let the view have first crack at the command
if( m_wndView.GetSafeHwnd() != NULL
&& m_wndView.OnCmdMsg( nID, nCode, pExtra, pHandlerInfo )
)
return TRUE;
// otherwise, do default handling
return CExtNCW < CMDIChildWnd > :: OnCmdMsg( nID, nCode, pExtra, pHandlerInfo );
}
BOOL CChildFrame::PreTranslateMessage(MSG* pMsg)
{
CMainFrame * pMainFrame =
DYNAMIC_DOWNCAST(
CMainFrame,
::AfxGetMainWnd()
);
ASSERT_VALID( pMainFrame );
if( pMainFrame->m_wndMenuBar.TranslateMainFrameMessage(pMsg) )
return TRUE;
return CExtNCW < CMDIChildWnd > :: PreTranslateMessage(pMsg);
}
// my stuff ///// begin
UINT MyThreadProc( LPVOID pParam )
{
CMyThread* pThread = (CMyThread*)pParam;
if (pThread == NULL)
return 1;
while (pThread->IsNotDone())
{
pThread->GetWnd()->PostMessage(MPM_CHANGE_TITLE_MESSAGE);
Sleep(1000);
}
return 0; // thread completed successfully
}
// my stuff ///// end
|
|
|
Dylan da Silva
|
Apr 22, 2010 - 4:06 PM
|
Some additional information: It’s an MDI application but only running one child window (document), when the entire window (mainframe) is smaller than the screen (not maximized) the title bar is fine (almost always, 99.9%) When the window is maximized it’s constantly painting the title bar wrong. When the mainframe is maximized but the document (child window) is not maximized the title bar is fine even when the window text is changed. It only seems to be an issue when both the main window is maximized and the child window within it is maximized. This also happens to be the normal state of the application while it’s being used.
|
|
|
Dylan da Silva
|
Apr 20, 2010 - 2:54 PM
|
My menus keep closing whenever a thread tries to send a COMMAND message to the frame. I used ZoomScrollBar to confirm the issue.
I added a resource to resource.h #define ID_JUNK_COMMAND 7000
Here are the modified source files:
// MainFrm.h : interface of the CMainFrame class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_MAINFRM_H__8AD8EDA0_FE43_4657_B159_597A63DD8A98__INCLUDED_)
#define AFX_MAINFRM_H__8AD8EDA0_FE43_4657_B159_597A63DD8A98__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "ChildView.h"
#if !defined(__EXT_TEMPL_H)
#include <ExtTempl.h>
#endif
// my stuff ///// begin
class CMyThread : public CWinThread
{
public:
CMyThread(CFrameWnd* wnd) : m_wnd(wnd), m_working(TRUE) {}
~CMyThread(void) {}
CFrameWnd* GetWnd(void) { return m_wnd; }
BOOL IsNotDone(void) { return m_working; }
void StopThread(void) { m_working = FALSE; }
private:
CFrameWnd* m_wnd;
BOOL m_working;
};
// my stuff ///// end
class CMainFrame : public CExtNCW < CFrameWnd >
{
public:
CMainFrame();
protected:
DECLARE_DYNAMIC(CMainFrame)
// Attributes
public:
private:
// window placement persistence
WINDOWPLACEMENT m_dataFrameWP;
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMainFrame)
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
virtual BOOL PreTranslateMessage(MSG* pMsg);
virtual BOOL DestroyWindow();
virtual void ActivateFrame(int nCmdShow = -1);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMainFrame();
virtual void RecalcLayout(BOOL bNotify = TRUE);
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
public: // control bar embedded members
class CMyStatusBar : public CExtStatusControlBar
{
protected:
virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
{
if( message == WM_HSCROLL || message == WM_VSCROLL )
return GetParent()->GetDlgItem(AFX_IDW_PANE_FIRST)->SendMessage( message, wParam, lParam );
return CExtStatusControlBar::WindowProc( message, wParam, lParam );
}
}; // class CMyStatusBar
CMyStatusBar m_wndStatusBar;
CExtMenuControlBar m_wndMenuBar;
CExtThemeSwitcherToolControlBar m_wndToolBarUiLook;
CChildView m_wndView;
// Generated message map functions
protected:
//{{AFX_MSG(CMainFrame)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSetFocus(CWnd *pOldWnd);
afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
//}}AFX_MSG
afx_msg void OnUpdateControlBarMenu(CCmdUI* pCmdUI);
afx_msg BOOL OnBarCheck(UINT nID);
// my stuff ///// begin
afx_msg void OnJunkCommand(void);
// my stuff ///// end
DECLARE_MESSAGE_MAP()
// my stuff ///// begin
private:
CMyThread* m_thread;
// my stuff ///// end
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MAINFRM_H__8AD8EDA0_FE43_4657_B159_597A63DD8A98__INCLUDED_) // MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "ZoomScrollBar.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// my stuff ///// begin
UINT MyThreadProc( LPVOID pParam );
// my stuff ///// end
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNAMIC( CMainFrame, CFrameWnd )
BEGIN_MESSAGE_MAP( CMainFrame, CFrameWnd )
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
ON_WM_SETFOCUS()
ON_WM_GETMINMAXINFO()
//}}AFX_MSG_MAP
ON_COMMAND_EX(ID_VIEW_MENUBAR, OnBarCheck )
ON_UPDATE_COMMAND_UI(ID_VIEW_MENUBAR, OnUpdateControlBarMenu)
// my stuff ///// begin
ON_COMMAND(ID_JUNK_COMMAND, OnJunkCommand )
// my stuff ///// end
ON_COMMAND_EX(ID_VIEW_UI_LOOK_BAR, OnBarCheck )
ON_UPDATE_COMMAND_UI(ID_VIEW_UI_LOOK_BAR, OnUpdateControlBarMenu)
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_LOCATION,
ID_ZOOM_VALUE_PANE,
ID_ZOOM_SCROLL_BAR_PANE,
// ID_INDICATOR_CAPS,
// ID_INDICATOR_NUM,
// ID_INDICATOR_SCRL,
};
void CMainFrame::OnUpdateControlBarMenu(CCmdUI* pCmdUI)
{
CExtControlBar::DoFrameBarCheckUpdate( this, pCmdUI, true );
}
BOOL CMainFrame::OnBarCheck(UINT nID)
{
return CExtControlBar::DoFrameBarCheckCmd( this, nID, true );
}
// my stuff ///// begin
void CMainFrame::OnJunkCommand(void)
{
// do Fibanacci
unsigned long long garbage = 24;
for(int i=0;i<1000;++i)
garbage *= (unsigned long long)i;
}
// my stuff ///// end
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
CWinApp * pApp = ::AfxGetApp();
ASSERT( pApp != NULL );
ASSERT( pApp->m_pszRegistryKey != NULL );
ASSERT( pApp->m_pszRegistryKey[0] != _T(’\0’) );
ASSERT( pApp->m_pszProfileName != NULL );
ASSERT( pApp->m_pszProfileName[0] != _T(’\0’) );
if( ! g_PaintManager.PaintManagerStateLoad(
pApp->m_pszRegistryKey,
pApp->m_pszProfileName,
pApp->m_pszProfileName
)
)
g_PaintManager.InstallPaintManager(
RUNTIME_CLASS(CExtPaintManagerOffice2007_R2_LunaBlue)
);
// if( ! g_PaintManager.PaintManagerStateLoad(
// pApp->m_pszRegistryKey,
// pApp->m_pszProfileName,
// pApp->m_pszProfileName
// )
// )
// {
// CExtPaintManagerSkin * pPM = new CExtPaintManagerSkin;
// bool bLoaded = true;
// if( ! pPM->m_Skin.SearchAndLoadSkinFile( _T("Aqua.Skin"), false ) )
// {
// if( ! pPM->m_Skin.SearchAndLoadSkinFile( _T("..\\..\\Skins\\Binary\\Aqua.Skin"), false ) )
// {
// bLoaded = false;
// ::AfxMessageBox( _T("Failed to load initial skin.") );
// delete pPM;
// }
// }
// if( bLoaded )
// g_PaintManager.InstallPaintManager( pPM );
// }
CExtPopupMenuWnd::g_bMenuExpanding = false;
CExtPopupMenuWnd::g_bMenuHighlightRarely = false;
// window placement persistence
::memset( &m_dataFrameWP, 0, sizeof(WINDOWPLACEMENT) );
m_dataFrameWP.length = sizeof(WINDOWPLACEMENT);
m_dataFrameWP.showCmd = SW_HIDE;
}
CMainFrame::~CMainFrame()
{
}
void CMainFrame::RecalcLayout(BOOL bNotify)
{
CExtNCW < CFrameWnd > :: RecalcLayout( bNotify );
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if( CExtNCW < CFrameWnd > :: OnCreate( lpCreateStruct ) == -1 )
return -1;
m_wndStatusBar.m_bDrawPaneSeparatorsInsteadOfBorders = true;
if( (! m_wndStatusBar.Create( this ) )
|| (! m_wndStatusBar.SetIndicators(
indicators,
sizeof(indicators)/sizeof(UINT)
) )
)
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
m_wndStatusBar.SetPaneWidth( 0, 10 );
m_wndStatusBar.GetStatusBarCtrl().SetMinHeight( 25 );
// create a view to occupy the client area of the frame
if( ! m_wndView.Create(
NULL,
NULL,
AFX_WS_DEFAULT_VIEW|WS_CLIPCHILDREN|WS_CLIPSIBLINGS,
CRect( 0, 0, 0, 0 ),
this,
AFX_IDW_PANE_FIRST,
NULL
)
)
{
TRACE0("Failed to create view window\n");
return -1;
}
CString strTitleOld = GetTitle(), strTitleNew;
strTitleNew.Format(
_T("%s - [%d objects loaded]"),
LPCTSTR( strTitleOld ),
m_wndView.GetObjectCount()
);
SetTitle( LPCTSTR( strTitleNew ) );
OnUpdateFrameTitle( FALSE );
CWinApp * pApp = ::AfxGetApp();
ASSERT( pApp != NULL );
ASSERT( pApp->m_pszRegistryKey != NULL );
ASSERT( pApp->m_pszRegistryKey[0] != _T(’\0’) );
ASSERT( pApp->m_pszProfileName != NULL );
ASSERT( pApp->m_pszProfileName[0] != _T(’\0’) );
ASSERT( pApp->m_pszProfileName != NULL );
HICON hIcon = pApp->LoadIcon( IDR_MAINFRAME );
ASSERT( hIcon != NULL );
SetIcon( hIcon, TRUE );
SetIcon( hIcon, FALSE );
g_CmdManager->ProfileSetup(
pApp->m_pszProfileName,
GetSafeHwnd()
);
VERIFY(
g_CmdManager->UpdateFromMenu(
pApp->m_pszProfileName,
IDR_MAINFRAME
)
);
if( ! m_wndMenuBar.Create(
NULL,
this,
ID_VIEW_MENUBAR
)
)
{
TRACE0("Failed to create menubar\n");
return -1;
}
if( (! m_wndToolBarUiLook.Create( NULL, this, ID_VIEW_UI_LOOK_BAR ) )
|| (! m_wndToolBarUiLook.ThemeSwitcherInit() )
)
{
TRACE0("Failed to create the m_wndToolBarUiLook toolbar\n");
return -1; // fail to create
}
m_wndToolBarUiLook.EnableDocking( CBRS_ALIGN_ANY );
if( ! CExtControlBar::FrameEnableDocking( this ) )
{
ASSERT( FALSE );
return -1;
}
if( ! CExtControlBar::ProfileBarStateLoad(
this,
pApp->m_pszRegistryKey,
pApp->m_pszProfileName,
pApp->m_pszProfileName,
&m_dataFrameWP
)
)
{
DockControlBar( &m_wndToolBarUiLook, AFX_IDW_DOCKBAR_LEFT );
RecalcLayout();
}
// my stuff ///// begin
m_thread = new CMyThread((CFrameWnd*)this);
AfxBeginThread(MyThreadProc, m_thread);
// my stuff ///// end
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( ! CExtNCW < CFrameWnd > :: PreCreateWindow( cs ) )
return FALSE;
cs.dwExStyle &= ~(WS_EX_CLIENTEDGE|WS_EX_LAYOUTRTL);
cs.style |= WS_CLIPCHILDREN|WS_CLIPSIBLINGS;
cs.lpszClass = AfxRegisterWndClass( CS_HREDRAW|CS_HREDRAW|CS_DBLCLKS );
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CExtNCW < CFrameWnd > :: AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CExtNCW < CFrameWnd > :: Dump( dc );
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers
void CMainFrame::OnSetFocus(CWnd* pOldWnd)
{
pOldWnd;
// forward focus to the view window
if( m_wndView.GetSafeHwnd() != NULL )
m_wndView.SetFocus();
}
BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
// let the view have first crack at the command
if( m_wndView.GetSafeHwnd() != NULL )
{
if( m_wndView.OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ) )
return TRUE;
}
// otherwise, do default handling
return CExtNCW < CFrameWnd > :: OnCmdMsg( nID, nCode, pExtra, pHandlerInfo );
}
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
{
if( m_wndToolBarUiLook.PreTranslateMessage( pMsg ) )
return TRUE;
if( m_wndMenuBar.TranslateMainFrameMessage(pMsg) )
return TRUE;
return CExtNCW < CFrameWnd > :: PreTranslateMessage(pMsg);
}
BOOL CMainFrame::DestroyWindow()
{
CWinApp * pApp = ::AfxGetApp();
ASSERT( pApp != NULL );
ASSERT( pApp->m_pszRegistryKey != NULL );
ASSERT( pApp->m_pszRegistryKey[0] != _T(’\0’) );
ASSERT( pApp->m_pszProfileName != NULL );
ASSERT( pApp->m_pszProfileName[0] != _T(’\0’) );
VERIFY(
CExtControlBar::ProfileBarStateSave(
this,
pApp->m_pszRegistryKey,
pApp->m_pszProfileName,
pApp->m_pszProfileName
)
);
VERIFY(
g_PaintManager.PaintManagerStateSave(
pApp->m_pszRegistryKey,
pApp->m_pszProfileName,
pApp->m_pszProfileName
)
);
g_CmdManager->ProfileWndRemove( GetSafeHwnd() );
// my stuff ///// begin
m_thread->StopThread();
m_thread->Delete();
// my stuff ///// end
return CExtNCW < CFrameWnd > :: DestroyWindow();
}
void CMainFrame::ActivateFrame(int nCmdShow)
{
// window placement persistence
if( m_dataFrameWP.showCmd != SW_HIDE )
{
SetWindowPlacement( &m_dataFrameWP );
CExtNCW < CFrameWnd > :: ActivateFrame( m_dataFrameWP.showCmd );
m_dataFrameWP.showCmd = SW_HIDE;
return;
}
CExtNCW < CFrameWnd > :: ActivateFrame( nCmdShow );
}
void CMainFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
{
CFrameWnd::OnGetMinMaxInfo( lpMMI );
lpMMI->ptMinTrackSize.x = g_PaintManager->UiScalingDo( 700, CExtPaintManager::__EUIST_X );
lpMMI->ptMinTrackSize.y = g_PaintManager->UiScalingDo( 300, CExtPaintManager::__EUIST_Y );
}
// my stuff ///// begin
UINT MyThreadProc( LPVOID pParam )
{
CMyThread* pThread = (CMyThread*)pParam;
if (pThread == NULL)
return 1;
while (pThread->IsNotDone())
{
pThread->GetWnd()->PostMessage(WM_COMMAND,MAKEWPARAM(ID_JUNK_COMMAND,0));
Sleep(1000);
}
return 0; // thread completed successfully
}
// my stuff ///// end
Looks like a bug but if it’s not then how would I modify the ZoomScrollBar project to fix the issue I’m having?
|
|
|
Dylan da Silva
|
Apr 21, 2010 - 4:30 AM
|
And the pasted header and source file were taken directly from the Prof-UIS Sample "ZoomScrollBar" so you can paste them right in.
|
|
|
Technical Support
|
Apr 22, 2010 - 5:25 AM
|
The problem is not with the WM_COMMAND message. The WM_CANCELMODE message is somehow becomes posted to the main UI thread and that’s why the popup menus become closed. We just verified this message is not sent by MFC and Prof-UIS source code. The following version of the WM_COMMAND method allows you to avoid menu closing: void CMainFrame::OnJunkCommand(void)
{
// do Fibonacci
unsigned long garbage = 24;
for(int i=0;i<1000;++i)
garbage *= (unsigned long)i;
MSG msg;
while( ::PeekMessage( &msg, NULL, WM_CANCELMODE, WM_CANCELMODE, PM_NOREMOVE ) )
{
if( ! ::PeekMessage( &msg, NULL, WM_CANCELMODE, WM_CANCELMODE, PM_REMOVE ) )
break;
}
}
|
|
|
Dylan da Silva
|
Jul 26, 2010 - 1:14 PM
|
Any movement on this issue? We still have a problem with the menus closing.
|
|
|
Technical Support
|
Jul 28, 2010 - 2:27 AM
|
|
| |