|
i want to change quick launch path and start menu shortcut path for existing shortcuts.... also rollback to original path..
|
|
|
|
|
Is this a C++ question?
I must get a clever new signature for 2011.
|
|
|
|
|
There are some articles on CodeProject that will help you get started: here, here, and here.
|
|
|
|
|
In my application initailly i set menu in resource file as
File Display Help Exit
Like this i added first main menu.But dynamically i want to add submenus for Display and Exit.
Under Display,four of five menus should be display.I will add this dynamically by reading it from seperate file.
I tried InsertMenu,Append Menu
but nothing happens.
Pls help me..
Anu
|
|
|
|
|
Anu_Bala wrote: I tried InsertMenu,Append Menu
but nothing happens.
Then you must be doing something wrong, but we cannot guess what happens in your code without seeing some of it.
I must get a clever new signature for 2011.
|
|
|
|
|
Actually i tried
CMenu *pMenuBar = this->GetMenu();
ASSERT_VALID(pMenuBar);
CMenu *pSubMenu = pMenuBar->GetSubMenu(0);
pSubMenu->AppendMenu(MF_STRING | MF_ENABLED, ID_COMMAND_1, "First Item");
pSubMenu->AppendMenu(MF_STRING | MF_ENABLED, ID_COMMAND_2, "Second Item");
By this i can add.but in the mainmenu already one Exit submenu is there.But i dont want that.
So i deleted that sub menu in resource file itself.And when i gave this code it shows assert error.
If i didnot delete Exit menu ,then after running application my FILE menu shows
FILE
Exit
FirstItem
Second Item
Anu
|
|
|
|
|
Anu_Bala wrote: Exit //Actually i dont want this
So can you not just remove it from the .rc file?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
If i remove this Exit from .RC menu editor.When im runnong application it shows Unhandled Exception error.
So what i did,i coded like
pSubMenu->RemoveMenu(0, MF_BYPOSITION);
This will remove the Exit dynamically and then i added my menu by
pSubMenu->AppendMenu(MF_STRING | MF_ENABLED, ID_COMMAND_1, "First Item");
pSubMenu->AppendMenu(MF_STRING | MF_ENABLED, ID_COMMAND_2, "Second Item");
Now i want to rename the main menu text dynamically.
I dont know how can i do that?
Anu
|
|
|
|
|
Anu_Bala wrote: If i remove this Exit from .RC menu editor.When im runnong application it shows Unhandled Exception error.
And that doesn't concern you?
Anu_Bala wrote: pSubMenu->RemoveMenu(0, MF_BYPOSITION);This will remove the Exit dynamically...
Employing a "band-aid" fix is not the right answer.
Anu_Bala wrote: Now i want to rename the main menu text dynamically.
I dont know how can i do that?
How about ModifyMenu() ?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
You can override OnInitMenuPopup() and insert and remove menu items there.
What is happening is that your menu template (in the .rc file) is being loaded automatically. Until it is loaded, trying to insert or append will have no effect. OnInitMenuPopup() gives you a chance to modify the menu before it is displayed.
|
|
|
|
|
Anu_Bala wrote: I tried InsertMenu,Append Menu
but nothing happens.
What do those two functions return? Have you tried calling ::InsertMenu() or ::AppendMenu() instead?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
If the menu is already selected into the mainframe at time of modification, you need to call DrawMenuBar() after updating it for changes to take effect (be shown)
If you vote me down, my score will only get lower
|
|
|
|
|
There is a requirement to hide the vertical scrollbar of listbox .
|
|
|
|
|
There is a requirement to hide the vertical scrollbar of listbox when items exceed the display area. There is no option to hide vertical scrollbar but there is a option for to hide horizontal scroolbar.
|
|
|
|
|
Can't you remove the 'Verical scroll' style from the list box property, or remove WS_VSCROLL window style?
|
|
|
|
|
Hi im haveing CPtrList and im adding this list by gettign data from xlsheet.What happened after adding details to list,the list having the same last data.suppose the list count is 3,then 3 listitems are same data.Here the code
CPtrList GrPageList;
void CGraphConfig::OnImportgraph()
{
CString TempString,TempInfo,sExt;
int PointCount=0,iRow=0;
CString sFileName = _T("");
SGrPgConf *pDetl = new SGrPgConf;
if(pDetl == NULL)
{
AfxMessageBox("Memory Allocation Failure ");
return;
}
GrPageList.RemoveAll();
CFileDialog oFileOpen(1,"xls",0,0,"MicroSoft Excel Files(*.xls)|*.xls|Tag Detail Grid File(*.tdl)|*.tdl||");
oFileOpen.m_ofn.lpstrTitle="Import From...";
if(oFileOpen.DoModal() == IDOK)
sFileName=oFileOpen.GetPathName();
sExt=sFileName.Right(3);
sExt.MakeLower();
if(!strcmp(sExt,"xls"))
{
CExcelSheet TagDet(sFileName,"Sheet1",FALSE);
for(iRow=2;iRow <= TagDet.GetTotalRows();iRow++)
{
TagDet.ReadCell(TempString,1,iRow);
pDetl->iPageNo = atoi(TempString);
TagDet.ReadCell(TempString,2,iRow);
sprintf(pDetl->sPageTitle ,"%s",TempString);
TagDet.ReadCell(TempString,3,iRow);
sprintf(pDetl->sPanelDetail[0] ,"%s",TempString);
TagDet.ReadCell(TempString,4,iRow);
sprintf(pDetl->sPanelDetail[1] ,"%s",TempString);
GrPageList.AddTail(pDetl);
POSITION hPos = GrPageList.GetHeadPosition();
while(hPos)
{
SGrPgConf *pData = (SGrPgConf *)GrPageList.GetAt(hPos);
GrPageList.GetNext(hPos);
}
}
TagDet.Commit();
}
}
When i check the list the pData shows the same data(last row - pageno-3.0) three times,GrPageList count is 3.
My XLSheet shows like
PageNo PageTitle FirstKey SecKey
1.0 graph1 Group01 Group02
2.0 graph2 TREND01 TREND02
3.0 graph3 Group01 Group02
Pls help me..
Anu
modified on Thursday, February 24, 2011 1:17 AM
|
|
|
|
|
you are updating the value at the same pointer and adding the same pointer to the CPtrList every time. So all the entries point to same data.
Do SGrPgConf *pDetl = new SGrPgConf; inside the for loop. Remember to delete all entries in list when they are no longer needed.
for(iRow=2;iRow <= TagDet.GetTotalRows();iRow++)
{
SGrPgConf *pDetl = new SGrPgConf;
TagDet.ReadCell(TempString,1,iRow);
pDetl->iPageNo = atoi(TempString);
GrPageList.AddTail(pDetl);
}
|
|
|
|
|
It Works.Thank u so much.
Anu
|
|
|
|
|
In the following function replacing "number - 1" does not yield the same correct result as "--number"? Why is that so? Am I'm missing something?
int sum( int number )
{
int result;
if (number == 1)
return number;
else
{
result = sum(number - 1) + number;
return result;
}
}
|
|
|
|
|
--number changes the value of number, number - 1 does not.
say number is 10:
sum(number - 1) + number; is sum(9) + 10;
and
sum(--number) + number; is sum(9) + 9;
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
The first line was enough! Thank you very much! Sometimes, well maybe most of the time I'm so stupid. That's so obvious!
|
|
|
|
|
Being a bit pedantic here (but it's necessary!)...
Since the order of evaluation is not defined by the language spec, the compiler writer is free to choose, so your second example
sum(--number) + number; could come out either way (but number will always wind up decremented). There are lots of examples of confusion over this.
Cheers,
Peter
[edit]formatting[/edit]
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
I concur, at least for C. I just don't know for recent versions of C++.
And I would never write a statement like that.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
|
Hello
i am currently facing this problem, i am doing a kind of game where when the user presses a key like the 'a' key it makes jump the object, but how to detect key press in a way to know how much jump, if you press the key for a tiny time do a little jump or if you got pressed the button too much jump only a maximum.
Thanks
|
|
|
|