|
Hi Sir:
I am glad to meet you. Can you tell me your ICQ or MSN number? May be we will have a talk if we have free time. Thanks
|
|
|
|
|
Grr, yet another simple problem has me floundering at the CP god's feet. I have some radio buttons, and a combobox. If the radio buttons are not checked, the combobox is greyed out. I'm using the line
GetDlgItem( IDC_CAL_TRANSDUCER )->EnableWindow(m_bitControls[bool_cal_xducer]);
to do this. My problem lies with re-enabling it. I have my OnBnClicked() thingamajobber, but i have no idea what to put in there to re-enable it. I've tried a ton of different functions, but they either completely hide the combobox or just don't do anything.
any help?
*.*
cin >> knowledge;
|
|
|
|
|
Doesn't EnableWindow(true) work?
modified 12-Sep-18 21:01pm.
|
|
|
|
|
argh, i new it was something simple! thanks.
*.*
cin >> knowledge;
|
|
|
|
|
You're welcome!
modified 12-Sep-18 21:01pm.
|
|
|
|
|
keegan wrote:
I'm using the line
GetDlgItem( IDC_... )->EnableWindow(...)
Instead of GetDlgItem, use a control-variable. Classwizard can make that for you if you tell it to make your variable of type CComboBox (or whatever your control is).
As for enabling:
m_ComboBoxCtrl.EnableWindow(true);
does not work?
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
yeah i'm using a control variable, i just wrote it like that so it would be a little more clear what i was trying to do
*.*
cin >> knowledge;
|
|
|
|
|
or use ON_UPDATE_COMMAND_UI to get the CCmdUI* pCmdUI.
You could call
pCmdUI->Enable(true) to enable it.
This is applicable to all UI component which response to CCmdUI
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
I would like to have a "MDI" application that displays a bunch of reports in separate windows within a main frame. I would like to define each report using a dialog resource. This is what I have tried:
1. Create a dialog resource for each report and use classwizard to generate a class for each. The dialogs have the WS_CHILD style.
2. Create a menu resource which will allow selection of each report.
3. Have cwinnapp::initinstance create a CFrameWnd and add the menu to it.
4. When the user selects one of the reports from the menu then display the associated report dialog modelessly with the main cframewnd as the parent.
This sort of works. The problem is that the modeless dialog never gets the focus (even when I click on it). Is there a way to fix this or is there a better way to do this?
|
|
|
|
|
What are you using to create the dialog? are you using
m_your_dialog.Create();
m_your_dialog.ShowWindow(SW_SHOW);
This is how i create my modaless diags, and it brings them into focus automatically.
*.*
cin >> knowledge;
|
|
|
|
|
I have tried that, no luck.
My current code is:
if(rpt_cpu_category == NULL) {
rpt_cpu_category = new dlg_rpt_cpu_category;
rpt_cpu_category->Create("RPT_CPU_CATEGORY",this);
}
rpt_cpu_category->BringWindowToTop();
rpt_cpu_category->SetActiveWindow();
rpt_cpu_category->UpdateWindow();
"RPT_CPU_CATEGORY" is the name of the dialog resource.
The last 3 lines are redundant as they seem to have no effect, they were just my latest effort to try and get the dlg to take the focus. I have also tried using setfocus() (no luck).
BT
|
|
|
|
|
Anonymous wrote:
rpt_cpu_category->Create("RPT_CPU_CATEGORY",this);
A string literal is certainly NOT suitable to select a dialog resource.
[later correction]
A string literal is indeed suitable as a dialog resource.
[/later correction]
Why do you need to give it a dialog resource in the first place? What did you do to the perfectly working class the class wizard made for you?
You should have one class for every dialog resource you designed, and the connection between resource and class is internal to that class (look for IDD in the dialog-class if you are interested).
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
jhwurmbach wrote:
A string literal is certainly NOT suitable to select a dialog resource.
Why not?
CDialog::Create() is overloaded to accept both UINT and LPCTSTR resource IDs...
I agree that he probably shouldn't be using the resource ID from outside the class, but why can't string literals be used?
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Ryan Binns wrote:
CDialog::Create() is overloaded to accept both UINT and LPCTSTR resource IDs...
Uh-Oh.
Yes.
I have never used this, never seen this being used, so I have skipped the second definition in the MSDN a thousand times.
He can use the name.
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
I tried using the class the classwizard makes for a dialog. I still get the same problem: I can't set focus to the dialog. As soon as I make the dialog a child window of the main frame I can no longer set focus to it.
|
|
|
|
|
I am working on a project that is supposed to mimic Vidcap or AmCap except I am having difficulty figuring out a way to open video in a dialog. Any suggestions?
|
|
|
|
|
Does anyone have, or know where I can find, the code that is used to shade the icons on the Windows desktop when the user clicks an icon? I want to use it to shade a bitmap. The bitmap will have a white background that I want to remain unshaded.
Any Ideas?
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
The normal way of doing it is to add it to an image list and then using the imagelist to draw it with the ILD_SELECTED style (CImageList::Draw() or ImageList_Draw() for Win32). It should work for a bitmap, as long as you create a mask (just use a black-and-white version of the original image) to mask off the areas you don't want shaded. If it shades the wrong part of the image, try inverting the mask (white<->black). I can't remember which way around its supposed to be .
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
1. How do I get text and its font in an object, Excel?
2. How do I read header and footer in word
3. How do I get all text and their own font from text or objects.
Thanks
Jason Chang
tmsnhien@yahoo.com
|
|
|
|
|
This thread might get you close:
http://www.codeproject.com/script/comments/forums.asp?msg=559045&forumid=1647#xx559045xx
|
|
|
|
|
|
Hey all,
I went to the launch of VC.NET 2003 in Ottawa a few months back, and during the Visual C++ presentation, we were shown a new feature that would save me a heck of a lot of time, unfortunately, I dont remember how to toggle this guy on or off!
Ok, you have a dialog, which contains a list control for example. There's an option for that control that you could specify that control to resize as the dialog does, without any extra code in your WM_SIZE message. From what I remember, you can specify the control to "hug" to TOP/BOTTOM/LEFT/RIGHT... I've searched high and low through the help and resource editor and I can't seem to find anything.
Our project is Win32, but I created a dummy dialog in VC++, and still no go.. Anyone farmilliar with this guy?
Mike.
doner@obtain.com
|
|
|
|
|
That "feature" is only for C# or VB.NET projects. Standard win32/MFC projects don't get this. Of course, I don't have 2003 version, but I don't think they added this. Maybe in a Managed C++ app, but I don't know.
Joel Lucsy
|
|
|
|
|
Today I profiled [using Rational Quantify] one of our applications in which a certain action took more and more time. I found the reason of the problem, but also noticed something else very strange.
Although the application runs most of the time in single-threaded mode, it has some actions that run multi-threaded. Therefore, some important datastructures were protected with a CriticalSection.
I noticed that the CriticalSection functions take about 15% of the total CPU time of the application. But there's more.
Consider the following small application:
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
CRITICAL_SECTION Cs;
const long MAX_LOOPS=10000;
main ()
{
InitializeCriticalSection (&Cs);
for (long i=0;i<MAX_LOOPS;i++)
{
EnterCriticalSection (&Cs);
Sleep (1);
LeaveCriticalSection (&Cs);
Sleep (1);
}
DeleteCriticalSection (&Cs);
}
If this program is run through Quantify, it shows the following information:
Function Calls F Time F+D Time F(%) F+D(%) Avg F Min F Max F
mainCRTStartup 1 10617888 12589139 84,34 100,00 10617888 10617888 10617888
.Root. 0 0 12589139 0,00 100,00 0 0 0
.main_0. 0 0 12589139 0,00 100,00 0 0 0
LeaveCriticalSection 10000 1265606 1265606 10,05 10,05 126 71 1186
ExitProcess 1 378351 378351 3,01 3,01 378351 378351 378351
GetModuleHandleA 2 103729 103729 0,82 0,82 51864 1617 102112
GetVersionExA 1 69788 69788 0,55 0,55 69788 69788 69788
GetFileType 3 52111 52111 0,41 0,41 17370 11315 29385
HeapAlloc 40 21896 21896 0,17 0,17 547 239 7388
HeapCreate 1 17844 17844 0,14 0,14 17844 17844 17844
The function LeaveCriticalSection is indeed called 10000 times, but according to this table EnterCriticalSection is nowhere called in the application. There is no trace of the EnterCriticalSection function in the Rational Quantify reports.
It seemed like the compiler optimized EnterCriticalSection away, even if I compile with /Od /Zi. Can anybody explain this?
The second strange thing is that the maximum function time (Max F) of LeaveCriticalSection is much and much larger than the minimum function time (Min F). This means that in lot of cases the function was quite fast, but in some calls, the function was much slower. Can anybody explain this?
Of course simply removing the critical sections makes the application about 10-15% faster, but introduces a big risk when the application performs a multi-threaded action.
Nevertheless I thought that CriticalSections were the fastest way of synchronizing threads.
Does anybody know a method of improving the performance of CriticalSections or can anybody explain why LeaveCriticalSection takes much more time than EnterCriticalSection?
Thanks in advance.
Enjoy life, this is not a rehearsal !!!
My Articles:
- Implementing a Subject/Observer pattern with templates
- Different ways of writing class factories
- AutoRunner: a template class to automatically run start- and cleanup-code in code blocks
</
|
|
|
|
|
My guess is that the profiler isn't telling the truth. The fact that it isn't showing EnterCriticalSection rings alarm bells. Run the program in the debugger and verify that EnterCriticalSection is indeed being called. It must be. If there is a bottleneck it will be at EnterCriticalSection when another thread has it locked. LeaveCriticalSection should be instantaneous.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|