Or do this: MainContainer mc=(MainContainer)(this.theTopMenu.ParentForm) Then: mc.SomeMethod() mc.AnotherMethod() Jerzy
JerzyPeter
Posts
-
Accessing methods/properties in the initial form... -
Accessing methods/properties in the initial form...Just cast to you class: (MainContainer )(this.theTopMenu.ParentForm).SomeMethod() Jerzy
-
Using OCX controls in .NETAgree, but what about using other OCXes, or using DLLs or unsafe code. Should we totally avoid using them and stick only with managed code? Jerzy
-
Using OCX controls in .NETMS Toolbar Control in mscomctl.ocx has a HotImageList property where as the .NET ToolBar doesn't. Are there any disadvantages or problems using the MS Toolbar Control, or any other COM Components and distributing the mscomctl.ocx with my .NET application? Jerzy
-
Using OCX controls in .NETMS Toolbar Control in mscomctl.ocx has a HotImageList property where as the .NET ToolBar doesn't. Are there any disadvantages or problems using the MS Toolbar Control, or any other COM Components and distributing the mscomctl.ocx with my .NET application? Jerzy
-
Can I play MPEG in Video for Windows?Is there any way to play MPEG file in vfw (Video for Windows)? Jerzy
-
Can I play MPEG in Video for Windows?Is there any way to play MPEG file in VFW (Video for Windows)? Jerzy
-
How to get the width and height of a window? (MFC)CRect rect; GetWindowRect(&rect); int nWidth=rect.Width(); int nHeight=rect.Height(); Jerzy
-
Adding Menus to Dialog BoxesCreate a menu. Right-click on your dialog box. Select Properties. You will see Menu: combobox. Select ID of your menu. That's all Jerzy
-
How do I disable system menu buttonsTo disabled the maximize button do this in PreCreateWindow() BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs cs.style&=~WS_MAXIMIZEBOX; return TRUE; } To disable system menu do this: cs.style&=~WS_SYSMENU; Jerzy
-
About SDK programmingUse this line: #define _WIN32_WINNT 0x0500 Should work, Jerzy
-
AutocompleteI think it's enough to delete XXX.ncb file Jerzy
-
Scroll Barsm_List.SetExtendedStyle(m_List.GetExtendedStyle()|LVS_EX_FLATSB); Jerzy
-
Adding CStatic Icon to a dialog boxAdd CStatic myStatic in your class. In OnInitDialog(): myStatic.Create(_T("my static"), WS_CHILD|WS_VISIBLE|SS_ICON|SS_CENTERIMAGE, CRect(10,10,150,50), this); myStatic.SetIcon(::LoadIcon(::AfxGetInstanceHandle(),MAKEINTRESOURCE(IDI_QUESTION)));
-
Adding CStatic Icon to a dialog boxYou can do that this way: 1. Insert a picture control on your Dialog. 2. In properties of this control enter Type: Icon and Image: IDI_QUESTION. Jerzy
-
Change background color of Static controlWhy creating a brush doesn't accept high colors (only pure 16 colors)? This will create a red brush: m_rcBackColor=RGB(255,0,0); Cbrush br(m_rcBackColor); or br.CreateSolidBrush(m_rcBackColor); But this will create a gray brush: m_rcBackColor=RGB(254,0,0); Cbrush br(m_rcBackColor); A high color is changed to the closest pure color. I'm trying to put some text (as Static Control) on the main window and I want the text to have the same background as the window. If window has a pure color like white, or gray, or red, there's no problem. But if my window has a background set to, let's say, RGB(255,0,100), the text is displayed in gray background. Static control uses, by default, color of Dialog's background. Any ideas? Jerzy.
-
How to dynamically modify menu in MDI appHi Tomek, Thank you very much for this tip. It works. I had to only call DrawMenuBar() to refresh the menu. Without this call the menu was updated only when the mouse was over the menu. (This is only when the application starts). When all documents were closed and then I opened a new one the menu was shown correctly. Dziekuje, Jerzy :)
-
How to dynamically modify menu in MDI appHi Tomek, Thanks for the solution. It works - it ataches a new popup to IDR_XXXTYPE menu. But the problem is that I don't know where this code should be placed. If I put it in OnCrete() of ChildFrm, then the new popup is atached as many times as ChildFrm frames were created. MSDN says something that this menu is loaded during the construction of the document templates. Can I override this? Thanks for any suggestions. Jerzy
-
How to dynamically modify menu in MDI appHi, I don't know what you mean to use GetSubMenu()? This code is working, it ataches a new popup to the main menu. The problem is that it ataches this submenu to the IDR_MAINFRAME menu (after main frame is created). I need to do the same for IDR_VIEWTYPE menu. I don't know in what moment that menu is created. If I use this code in that moment, the new popup would be attached to IDR_VIEWTYPE menu. Jerzy
-
How to dynamically modify menu in MDI appHello everybody! I´m writing a MDI app. Application Wizard generates two menus: One (IDR_MAINFRAME), which is displayed when no document is open, the other (IDR_XXXTYPE) when there is at least one document opened. This code below (from CMainFrame::OnCreate) modifies the first menu. I want to do the same modification to the other menu. How to do that? Thank you for any comments. Jerzy CMenu PopupMenu; PopupMenu.CreateMenu(); for(int i=0;i<3;i++) { CString str; str.Format("Item %d",i); PopupMenu.AppendMenu(MF_STRING,IDM_ITEM+i,str) ; } CMenu *m=GetMenu(); m->AppendMenu(MF_POPUP¦MF_STRING,(UINT)PopupMenu.m_hMenu,"&Items"); PopupMenu.Detach();