Visual C++ :: SetTimer / OnTimer Causes File Menu To Flicker
Nov 26, 2012
I have a (large) application that works perfectly under XP. When I run it under Windows 7 the "File Edit View..." menu in my application flickers when everything is otherwise idle.
I have traced this down to SetTimer and its associated OnTimer function. OnTimer usually does nothing, so I have commented out everything leaving this:
Code:
void MyView::OnTimer(UINT nIDEvent) { }
I have also changed the SetTimer call to give one tick every five seconds.
I now see the same behaviour: the File menu is very briefly greyed-out every five seconds, leading to the flicker. Nothing else in the window is exhibiting this flicker.
So, I have a call to a null function every five seconds that manages to affect a menu.
what may be causing this?
View 12 Replies
ADVERTISEMENT
May 6, 2013
I am working on this project where I need two differnt timers on a dialog. I have tried to add two timers but it is giving me problems. Are you allowed to have two different timers, I would think you can if you have two timer IDs. Below is what I have:
void SettingsDlg::display() {
Settimer(1,100,NULL);
Settimer(2,500,NULL);
[Code] ....
When declaring two OnTimer() in the header I get the following error msg: OnTimer(UINT_PTR): member function already defined of declared.
View 4 Replies
View Related
Nov 15, 2013
I have a C++/MFC application that displays a count in a window:
The count (text) is displayed via a `CStatic` control. The mechanism is very simple. I call it every 1000 ms and update the text as such:
Code:
void CTestCountdownFlickerDlg::RedrawCounter(LPCTSTR pText)
{
CStatic* pTxtBox = (CStatic*)this->GetDlgItem(IDC_STATIC_COUNTER);
ASSERT(pTxtBox);
[Code]....
What happens is that the `CStatic` control updates without any issues on the OS with visual themes enabled, but if I run it on the OS with the Windows Classic theme (for instance, the screenshot above is from Windows 7) the `CStatic` control produces a visible flicker every time it updates the text.
Well, I understand that I'm nitpicking here, still I would really like to get rid of this flicker.
Here's what I tried:
1. In my actual project I tried subclassing the `CStatic` control and removed the processing of `WM_ERASEBACKGROUND` by simply returning 1. That didn't work.
2. In the same subclass for `CStatic` control I tried to override `WM_PAINT`, but that didn't work at all. So I'm not sure if I'm going too far with it at this point.
I'm attaching the C++/MFC source code for my test project .....
View 14 Replies
View Related
Jan 9, 2014
I am developing a CFormView MFC app. When I go to click something on the menu, it takes awhile before the event happens. The project is build optimized in release mode. I have 3 additional threads and I thought they might be blocking the internal MFC framework stuff, but I use the Sleep() call in each thread to yield to the MFC main app.
View 7 Replies
View Related
Mar 14, 2013
I have an MDI application using different menus depending on the current document template in use.
I need to show the top-level File Menu from the IDR_MAINFRAME window when a command is sent from the active document.
I would like to application to deactivate the active child window and then show the File menu as if the alt-F key was pressed from the keyboard.
I have tried CMenu *pMenu=AfxGetMainWnd()->GetMenu();
but this does not display the menu at all.
View 2 Replies
View Related
May 15, 2013
I derived a class from CRecentFileList in order to set the number of displayed chars for MRU.
The problem is that if I open the app with 256 set for this number (it is read from .ini file) the display is correct. But after I change it to 10 for e.g., File menu width remains unchanged altghough MRU are correctly displayed on 10 (or at least file name lenghts) chars.
how can I tell to the menu to shrink to actual width?
View 10 Replies
View Related
Sep 15, 2014
I have two menu items. When item 1 is disabled, I want item 2 to be disabled as well. In the OnUpdate handler of menu item 1, I have tried to use "t_pMenu = pCmdUI->m_pMenu;", "t_pMenu = pCmdUI->m_pSubMenu;" and "t_pMenu = pCmdUI->m_pParentMenu;" but I always get NULL t_pMenu. How can I achieve this purpose?
Code:
void CDummyView::OnUpdateMenuItem1(CCmdUI* pCmdUI)
{
if(m_bShowMenuItem1) {
pCmdUI->Enable(TRUE);
[Code]....
View 14 Replies
View Related
Aug 19, 2013
I am trying to write a menu program that will be broken down into a series of calls to function for each of the menu items. Two of the menu items will be simple programs which I wrote.
I want two of the functions to run one of the two programs I am trying to include as items in the menu.
So far I am only familiar with variables, loops, if statements, and I just learned how to write functions.
The problem I am have is that I don't quite understand how to write a function that will run one of the two programs. Also I am having a hard time writing the program in away that would allow the user to select the menu items.
View 2 Replies
View Related
Apr 7, 2014
I'm creating a program that is based on a menu system. Basically each menu is its own user-defined function. The problem is at each menu you can input 'b' to go to the previous menu. I just have it call the function of that menu.
However, do the functions need to complete themselves eventually? If I just keep calling functions will I just keep going further and further deeper into ever running functions?
If so how do I avoid this and yet keep the option to go back to a previous menu/function?
View 2 Replies
View Related
Dec 23, 2013
Normally, menu bar resides below the title bar. See attachment MenuBarOriginal.JPG
Is there a way that we can position the menu bar? For example,place it on the side or anywhere on the dialog box?
MenuBarModified.JPG is some sample of menu bar positions that I want to place.
I want to do this on a dialog box.
View 6 Replies
View Related
Aug 6, 2014
I'm using this tutorial for making an owner draw menu. [URL] ...
When I go into the .rc file and remove all of the MENUITEM SEPARATORs all the menu options are squished to the left of the menu as in the screenshot. As long as there is just one MENU SEPARATOR anywhere the menu is fine. If I could make the application without MENU SEPARATORs that would be awesome.
View 7 Replies
View Related
Jul 30, 2014
Can change the menu bar font size in CMainFrame::OnCreate()? Here's what I have:
Code:
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) {
CRect rect;
GetClientRect(&rect);
if (CFrameWnd::OnCreate(lpCreateStruct) == -1) {
return -1;
[Code] ....
The line "m_wndToolBar.SetFont(&m_font);" does nothing.
View 2 Replies
View Related
Dec 17, 2012
I want create menu button to change font of CString displyed in main window. We can see string "SAMPLE",and when i press menu button that i created i want to string "SAMPLE" to display with different font,i already created CFont object and added italic style with CreateFont;
This is my menu function:and CString m_text and CFont font1 are declared in FesbDoc.h
ON_COMMAND(ID_EDIT_FONT, &CFesbView::OnEditFont)
void CFesbView::OnEditFont() {
CFesbDoc* pDoc = GetDocument();
::::WHAT TO ADD HERE:::::::
Invalidate();
}
View 5 Replies
View Related
Feb 11, 2013
I wish to add the item 'Website' to an MFC Dialog app System Menu so that it can activate the following method:
Code:
void CMyDlg::OnWebpage()
{
ShellExecute( NULL, NULL, _T("[URL]..."), NULL, NULL, 0 );
}// OnWebpage()
I have tried this:
Code:
#define IDM_WEBSITE (WM_USER + 101)
//..
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
pSysMenu->AppendMenuW(MF_STRING, IDM_WEBSITE, _T("Website"));
}
[Code]...
The code compiles without error but and the 'website' item appears on the System Menu but it doesnt do anything.
I've inspected the following but don't really understand how it works and it seems to me there should be a simpler way to accomplish my end.
Modifying the System Menu By John Simmons 26 Jan 2007 [URL]....
View 8 Replies
View Related
Feb 21, 2015
I quite often use an ide written in assembler: RadAsm3[URL] .....
It has a menu item to explore current path. I have used other ide's that have a similar feature but:
The one in RadAsm3 will activate a current Explorer window if the current path is the same as the one requested.
All others open a new Explorer window.
I would like to implement the RadAsm3 approach using Visual Studio 2013 Community c++ as my host compiler for testing.
I tried to get the title of current windows but it appears ShellExecute "explore" does not produce a conventional window???
View 1 Replies
View Related
Apr 7, 2014
This is what I have so far, it gives me a nice menu to select from and it all works but after I make a selection it closes the program. I tried to return to it but it won't work for me
#include <stdio.h>
int main() {
int choice;
int deposit;
int balance = 500; {
printf(" CHOOSE FROM THE FOLLOWING
[code]....
View 14 Replies
View Related
Dec 2, 2012
I'm attaching a project that demonstrates the issue. I need to display a context menu with anti-aliased bitmaps. I wrote my own method to convert an icon into a bitmap (see the CreatePARGBBitmapFromIcon() method) but the resulting bitmap seems to lose all anti-aliasing when displayed in a menu. What is interesting is that the same bitmap is displayed without any issues in a CStatic 'stPic1' control (the one in the middle.) The visual artifact also seems to be different on different OS. Take a look at the screenshots attached.
View 1 Replies
View Related
Jun 4, 2013
I was reading a c++ code written in embarcadero ide to add vertical colour text in popup menu.
While reading the code, I had seen following instructions.
private:
Code:
void __fastcall ExpandMenuItemWidth(TObject *Sender, TCanvas *ACanvas,int &Width, int &Height);
Code:
void __fastcall DrawNewItem(TObject *Sender, TCanvas *ACanvas, const TRect &ARect, bool Selected);
The above two methods used in the code like below:
Code:
PopupMenu1->Items->Items[i]->OnMeasureItem = ExpandMenuItemWidth;
PopupMenu1->Items->Items[i]->OnDrawItem = DrawNewItem;
What is happening when we are using member function without parameters like above?
I found above code at: [URL] ....
View 2 Replies
View Related
Jan 8, 2014
My problem is ToolTips are not shown if any of the tool-bar menu items is disabled/inactive.
They are shown when all tool bar menus are active/enabled.
I am using TTS_ALWAYSTIP while creating Tool-Bar.
What to do to enable/display tool-tips always.
View 5 Replies
View Related
Apr 12, 2013
I'm very new to MFC & VisualC++. I'm using MSVS2010 Pro. I am trying to write/debug a simple form that saves and restores the content of some edit controls. It seems to work as expected, except the file saves only to the Project Folder, regardless of where I browse and select to save the file.
Code:
void CMFC_FileDialogDlg::OnBnClickedbtnsave() {
this->UpdateData();
CFile f;
//Kinda Correct, Works but still saves in Project Folder
BOOL b_OpenFileDialog = FALSE;//this doesn't act as bool in CFileDialog?
[Code] ....
My only experience is a little simple VB programming in Excel, so any specific examples??? Also, rules seem to change from version to version? I have to "update" a number of undocumented programs.
View 4 Replies
View Related
Jun 11, 2014
I would like to make a program that automatically launches and loads a file when a file of that file type is double clicked within windows. As said I am unsure where to look for some information as to how to do that, and so turn to you all. Is there a simple way of doing such a thing without using any external libraries, if so, a simple tutorial or link to a reference for this; if there is no way of doing this without externals what would be a small and simple to use library for this?
View 2 Replies
View Related
Oct 29, 2014
So, I was trying to code a menu for a personal movie database. But I'm having some problems.So, this is what I did,
Code:
#include<stdio.h>
int main();
{
do
{printf("Menu
[Code]...
But this is not working.Furthermore I would also like add a sub menu.
View 7 Replies
View Related
Mar 8, 2014
I'm new to C programming and I need to write a "small" expandable menu framework and I don't know where to start off.
This is my task: Create an expandable menu framework in C where you can add a infinite number of entries and Sub menus containing other Menu points or where the entries refer to a external function. So far I've created the structures I need
Code:
//Menu structure
struct menu {
char mtitel[MAX];
struct mpoint point;
struct menu *next, *prev;
[Code] .....
View 2 Replies
View Related
Oct 23, 2014
Here is a simplified version of my Menu class, where submenus can be inserted arbitrarily deep. I need to add a new functionality "go back to previous menu", which I would like to be activated by entering 0 (universal command for all Menu instances). I considered the Memento Pattern, but that doesn't seem to quite fit. add that functionality to my Menu class.
#include <iostream>
#include <cstring>
using namespace std;
const int END = -1, NO_SUBMENU = 0;
[code]....
View 3 Replies
View Related
May 31, 2013
I'm working on a project that uses type char instead of type int to make selections in a menu that calls functions. I'm really hitting a wall with the while loop, I'm pretty sure my syntax is wrong for type char.
#include <iostream>
#include <cmath>
using namespace std;
// ***********************************************************************
void ShowMenu();
void SquareRoot(double UserEntry);
[Code] .....
View 1 Replies
View Related
Nov 1, 2013
I am using a switch statement as a menu. If I enter a non-integer value as my choice, I expect the error message , "Invalid entry", to display but instead the output keeps running.
View 2 Replies
View Related