|
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.
|
|
|
|
|
i think there wouldnt be any difference whether you use an array or something else. as far as you get the ctrl's address it enough.
___________________________
"Think big, think fast, think ahead. Ideas are no one's monopoly"
|
|
|
|
|
I am looking for some guidelines on quality "Windows-Friendly" applications. I am trying to complete a project that has taken me some years to complete and running into some difficulty with windows.
1. I hate the memory management of Windows, it can't handle lots of calls to malloc() with small structures. I found by building large blocks of memory and obtaining nodes from it was better. Only, this adds additional code, and prohibits memory expansion. I think most applications use this same scheme, but looking for a better solution.
2. My program is a process, not an event-driven application. Therefore, a timer is required that calls the routine at a fixed interval so that the process can operate on the information. This appears to work, but not sure if Windows likes this. I like to set the timer between 50 and 200ms.
Overall, the program functions, but Windows does not seem to like it. I don't have any problems with using Windows and other Win-based apps while my process is running, but when the process is complete and shutdown, Windows stays lethargic!? After awhile, Windows seems to wake up and operate more effectively. I would like some comments on what people do to overcome this. Is this a tuning issue, a memory problem (No Leaks!) or something else?
Also, if one was ambitious, I could use some help. I am not a traditional Windows programmer, good C type though. Contact me at mfeldhake@ccoreinnovations.com if you are interested. I could offer some cash but would prefer some stock incentives (I’m incorporated). Person would need to be highly experienced in scientific applications.
Thanks in Advance
Michael Feldhake
www.ccoreinnovations.com
|
|
|
|
|
iltallman wrote:
1. I hate the memory management of Windows, it can't handle lots of calls to malloc() with small structures. I found by building large blocks of memory and obtaining nodes from it was better. Only, this adds additional code, and prohibits memory expansion. I think most applications use this same scheme, but looking for a better solution.
This is not a Windows restriction, this a restriction of your C/C++ Runtime Library. You need a better (for you) heap manager. Remember that a malloc call is not instantaneous.
iltallman wrote:
2. My program is a process, not an event-driven application. Therefore, a timer is required that calls the routine at a fixed interval so that the process can operate on the information. This appears to work, but not sure if Windows likes this. I like to set the timer between 50 and 200ms.
Huh? What are you trying to accomplish?
Kant wrote:
Actually she replied back to me "You shouldn't fix the bug. You should kill it"
|
|
|
|
|
1) Look at: "Fast memory allocation library for multithreaded applications
" http://www.garret.ru/~knizhnik/sal.html[^]
2) I've seen this sort of behaviour on W9x I think where your app has allocated a large chunk of memory and when it shuts down it takes Windows a while to discard it from VM or something like that. You don't see this on NT based versions of Windows. If you are running NT/W2K/WXP and this is happening having a look in Task Manager Performance may shed some light on things.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|