|
Who can tell me how to solve this problem?
How to realize a Sequential-Verify test on floppy disk in VC?
Thank you!
LeonOrient
|
|
|
|
|
In MDI program , five documents have beed opened , Now the current document is fifth , How do I change the current document is first or else , of course I mean that I use program to do it ,not mouse . in a word ,I want to realize the WINDOW menu function.
Thank you !
|
|
|
|
|
You need to call MDIActive() on the view of the document you want to be active. If your in doc5, you can get a pointer to doc1 through the CDocTemplate object
CDocTemplate *pTemplate = GetDocTemplate();
iterate it to get the correct document pointer using GetFirstDocPosition() and GetNextDoc(). From there you can use the GetFirstViewPosition() and GetNextView() to get the view for the document you want to active. If you use GetParent() on this and cast it to a CChildFrm object I think you can call MDIActivate on that.
This is all from memory, so some or all of the steps may be slightly incorrect.
Hope its of help.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
|
I created an ActiveX control including a property sheet in it.
in the method COleControl::OnCreate()
I create a property sheet with 3 pages as child and show it.The property sheet is not wizard-mode.
When I use the control in a modal dialog,the dialog cannot DoModal() and the control is dead.When in a modaless dialog,the control displays right ,but if I use a method of the control ,it is dead again!
why???
|
|
|
|
|
Hi,
How can I show the progress ( of a series background operations )on child dialog with progress control bar, after I press a start button in parent dialog?
(that means the child dialog will pop up after pressing the "start" button in parent dialog)
thx
|
|
|
|
|
What are the series background operations, such as...
Do you mean your own function operations or others?
|
|
|
|
|
I mean there is a function like uploading a file to ftp.
|
|
|
|
|
If the child dialogue is a modal dialogue, here are two ways to realize that(I think so):
1.Do with the propress control in the parent dialogue. Since the modal dialogue monopolizes your processing time, you maybe create a new thread to handle the progress event, that is to set the position of the child parent' progress control when necessary.
2.Do with the propress control in the child dialogue. This way needs you to get the parent's vars and then get the state of operations by the parent class, finally you can set the position of the progress control in child dialogue.
How do you think about these two ways?
|
|
|
|
|
I prefer second way as it can seperate the progress from parant and set the status in a new dialog, but I don't know where to start the function (uploading file) where can show its progress.
[i.e how can i start a function automatically after the child dialog is displayed, and show the status in child dialog]
|
|
|
|
|
I want to know where you upload the file to,the file type,whether you do read the file's content into your control or another file. Above all, what's your aim to upload the file?
I will upload the file a block and a block, so I can know the uploading progress.
|
|
|
|
|
o i c
thx
|
|
|
|
|
Does anyone have any idea why EnableMenuItem in case seven is being totally ignored? I get a beep when I put one there. The code is being reached but calls to it are returning zero and nothing is happening. All the menu selections appear enabled and won't grey out no matter what I do. GetMenuItemID is actually getting a value. I'm a bit lost on this....
void CSacmanSetupApplicationView::OnRclickSetupTree(NMHDR* pNMHDR, LRESULT* pResult) <br />
{<br />
int x=0,y=0,index = 0;<br />
<br />
CString itemText;<br />
<br />
DWORD mousePosition;<br />
DWORD itemData;<br />
<br />
<br />
mousePosition = ::GetMessagePos();<br />
<br />
x = GET_X_LPARAM(mousePosition);<br />
y = GET_Y_LPARAM(mousePosition);<br />
<br />
<br />
CMenu newMenu;<br />
CMenu *submenu;<br />
CGate* pGate = NULL;<br />
<br />
itemData = this->m_ctrlSetupTree.GetItemData(this->m_ctrlSetupTree.GetSelectedItem());<br />
this->SetSelectedTreeItem(this->m_ctrlSetupTree.GetSelectedItem());<br />
<br />
itemText = this->m_ctrlSetupTree.GetItemText(this->m_tiSelectedItem);<br />
<br />
switch(itemData)<br />
{<br />
<br />
case 7:<br />
<br />
newMenu.LoadMenu(IDR_SYSTEM_MENU);<br />
submenu = newMenu.GetSubMenu(7);<br />
<br />
pGate =this->m_oCanalManager.GetGate(itemText);<br />
<br />
if(pGate)<br />
{<br />
<br />
if(pGate->IsPiped())<br />
{<br />
Beep(444,44);<br />
<br />
submenu->EnableMenuItem(submenu->GetMenuItemID(0),MF_BYPOSITION||MF_GRAYED);<br />
submenu->EnableMenuItem(submenu->GetMenuItemID(1),MF_BYPOSITION||MF_GRAYED);<br />
submenu->EnableMenuItem(submenu->GetMenuItemID(2),MF_BYPOSITION||MF_GRAYED);<br />
}<br />
else if(pGate->IsRectangular())<br />
{<br />
<br />
submenu->EnableMenuItem(submenu->GetMenuItemID(0),MF_BYCOMMAND||MF_ENABLED);<br />
submenu->EnableMenuItem(submenu->GetMenuItemID(1),MF_BYCOMMAND||MF_ENABLED);<br />
submenu->EnableMenuItem(submenu->GetMenuItemID(2),MF_BYCOMMAND||MF_ENABLED);<br />
<br />
}<br />
}<br />
<br />
submenu->TrackPopupMenu(TPM_CENTERALIGN,x,y,::AfxGetMainWnd(),NULL);<br />
<br />
break;<br />
<br />
case 8:<br />
<br />
newMenu.LoadMenu(IDR_SYSTEM_MENU);<br />
submenu = newMenu.GetSubMenu(5); <br />
submenu->TrackPopupMenu(TPM_CENTERALIGN,x,y,::AfxGetMainWnd(),NULL); <br />
break;<br />
<br />
case 9:<br />
<br />
newMenu.LoadMenu(IDR_SYSTEM_MENU);<br />
submenu = newMenu.GetSubMenu(8); <br />
submenu->TrackPopupMenu(TPM_CENTERALIGN,x,y,::AfxGetMainWnd(),NULL);<br />
<br />
break;<br />
<br />
default:<br />
Beep(999,99);<br />
break;<br />
<br />
}<br />
<br />
*pResult = 0;<br />
}
What's up with that???
|
|
|
|
|
|
A while back I read your MFC FAQ page and I followed your advice about using UPDATE_COMMAND_UI feature. After a few days of struggling with this feature, I was not able to enable or disable menu items through UPDATE_COMMAND_UI. Actually I could disable them but I couldn't get them to appear as grayed. On the other hand CCmdUI has only 5 member functions, and none of them offers the option of graying out the menu.
MFC provides CMenu and if you can't use this class to enable and disable menu items then what good is this menu class for? It would really help if you could elaborate a little bit more on this topic on your FAQ page, because to this day I am still confused.
Personally I use:
GetMenu()->EnableMenuItem( ID_OF_MENU_ITEM, MF_GRAYED );
GetMenu()->EnableMenuItem( ID_OF_MENU_ITEM, MF_BYCOMMAND | MF_ENABLED );
and these calls work just fine for me.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
Hi. I am trying to get the cut, copy, and paste commands on a toolbar to update (enable and disable) whenever those options are usable or not. I can handle the checking part of it, i just don't know where to put it. Is there some sort of function that gets called whenever something changes in the CEdit control?
-- Steve
|
|
|
|
|
One solution is to add a handler for ON_UPDATE_COMMAND_UI of one menu item. Another solution is ON_UPDATE_COMMAND_UI_RANGE for multiple menu items.
ON_UPDATE_COMMAND_UI(ID_EDIT_COPY, OnUpdateEditCopy)
void SomeClass::OnUpdateEditCopy(CCmdUI* pCmdUI)
{
...
}
Kuphryn
|
|
|
|
|
Hello!
i want to get help for a problme that i have while working on a mathematical project.
i need to get the first derivative and integration of simple quadratic and trignometric equations( which is actually out of my project scope to develop them). Can some one point out any link to such a code part or Thankfully provide it.
Thanx
Zaki
|
|
|
|
|
Have a look at a numerical recipes textbook like the one at
http://www.library.cornell.edu/nr/bookcpdf.html
It's written for C but you should be able to get enough out of it to do what you need to do. Alternatively you might be better off to calculate general solutions and then substitute into them.
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
I have a big matrix of buttons in a dlg-based MFC app wizard generated program. When any button is clicked, the focus remains on that button even after the handler is called; until another button is clicked.
Then I modified the handler - this is the first line in the handler now:
GetDlgItem(IDC_STATIC1)->SetFocus();
I'm setting the focus on another static control now. The handler is for the Dialog class, of course.
What happens is that the first time I click on a button, it retains the focus. When I click on the same button again, it loses focus (which is what I want).
I tried repeating the call to SetFocus() , but it doesn't help.
Can anybody suggest a way of taking the focus away completely, please? (I don't want to disable the button)
Thanks,
Vikram.
-----------------------------
KI klike KDE kand kuse kit, kbut KI kmust kadmit, kstarting kall knames kwith K kis ksilly. KI khope kthey kwill kgive kup kthis kwhole kscheme ksoon kand kcome kup kwith kreal knames.
pI vThink aHungarian nNotation vIs iA aWonderful nThing cAnd pEveryone
avShould vUse pIt aAll dThe nTime, adNo nMatter pWhat dThe nContext,
adEven adWhen vSpeaking.
|
|
|
|
|
One solution is Win32 API's SendMessage().
Kuphryn
|
|
|
|
|
There are various problems changing focus to other controls upon some UI action in a dialog. Typically it comes down to the order things happen. In your case of a button click it may be that you are changing focus on the button down, and then when the button up happens Windows puts the focus back on the current control. To resolve issues like this in ED I use PostMessage() with a user defined message, which sets the focus where I want. Hope that helps.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Thanks, I'll check it out and let you know.
Regards,
Vikram.
-----------------------------
KI klike KDE kand kuse kit, kbut KI kmust kadmit, kstarting kall knames kwith K kis ksilly. KI khope kthey kwill kgive kup kthis kwhole kscheme ksoon kand kcome kup kwith kreal knames.
pI vThink aHungarian nNotation vIs iA aWonderful nThing cAnd pEveryone avShould vUse pIt aAll dThe nTime, adNo nMatter pWhat dThe nContext, adEven adWhen vSpeaking.
|
|
|
|
|
I dont think what you did will create problem. i simulated the same condition here in one test dialog box and could see things working fine.
what i did?
On button click i am setting focus on some statis text ctrl. thus, after the button is clicked the button looses the focus.
bhaskar
___________________________
"Think big, think fast, think ahead. Ideas are no one's monopoly"
|
|
|
|
|
BhaskarBora wrote:
I dont think what you did will create problem.
It does.
BhaskarBora wrote:
what i did?
On button click i am setting focus on some statis text ctrl. thus, after the button is clicked the button looses the focus.
Did you create an array of buttons? I don't place the buttons on the dialog box using the dialog editor - there are 200 of them and they must be aligned perfectly. So I create them using an array of CButton s in OnInitDialog() .
Regards,
Vikram.
-----------------------------
KI klike KDE kand kuse kit, kbut KI kmust kadmit, kstarting kall knames kwith K kis ksilly. KI khope kthey kwill kgive kup kthis kwhole kscheme ksoon kand kcome kup kwith kreal knames.
pI vThink aHungarian nNotation vIs iA aWonderful nThing cAnd pEveryone avShould vUse pIt aAll dThe nTime, adNo nMatter pWhat dThe nContext, adEven adWhen vSpeaking.
|
|
|
|