|
Hi,
I've developed a NT Service using ATL. My service performs some functionality which uses database, XML files and HTTP communication. For database access I am using a COM component which I developed. Though the functionality intended by the service is performed ok, but the service fails to stop after running for sometime. After digging into the problem I found out that the service waiting for returning CoUninitialize() method which is taking too much time. I've ensured that I release all the COM interfaces before reaching CoUninitialize() method.
Can anybody suggest me what could be potential problem.
Thanks
Abhishek.
|
|
|
|
|
Hi,
I am a new in MFC.
I want to call a dialog box on Help button on a propety sheet in MFC.How can I do this? Please help me.
rajesh
|
|
|
|
|
depends on what you would like to do.
If you just want to display a message:
AfxMessageBox("somestring"); will do.
If you would like more options create your new dialog box and do.
yourdialogclassobjectname.DoModal();
DoModal returns an int so you can catch IDOK or IDCANCEL if you like.
Hope this helps.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
In the property sheet, override the OnCommand() method. Then add the following code:
if (BN_CLICKED == HIWORD(wParam) && IDHELP == LOWORD(wParam))
{
return TRUE;
}
return CPropertySheet::OnCommand(wParam, lParam);
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
"In the MFC application the dialog is initialised or called using Create function like this
dlg->Create(IDD_DIALOG, this);
This will call the OnInitDialog() function automatically, when the application is configured in Debug mode, but it is not called when it is in Release mode. Can anybody tell me what could be the reason?"
thanks
vidya
|
|
|
|
|
How are you verifying that the OnInitDialog() method is not being called?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
In debug mode i can confirm this using break point but in release mode i put one messagebox inside the oninitdialog fucntion which didnt not called in release mode.....and in that function only i am showing the controls in dialog like this....
e.g m_Combo.ShowWindow(SW_SHOW);
since oninitdialog is not called my controls in the dialog are displayed.
vidya
|
|
|
|
|
By chance are there any ActiveX controls on the dialog? What happens if you use a modal, instead of a modeless, dialog?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Yes ....there is an Active-X control in that dialog...
here i am explaining in detail.....
This dialog is added as a property page into the propertysheet. This dialog contains 2 static texts, 2 combo boxes and one MSChart Active-X control.
and in release mode all are not displayed where they are shown in
OnInitDialog() function which has been not called.
Thanks
vidya
|
|
|
|
|
Just for grins, remove the ActiveX control from the dialog template and see if that makes a difference. If it does, it sounds like the ActiveX control is not properly registered, or a call to AfxEnableControlContainer() has not been made (correctly).
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I have deleted the mschart active x control and tested still the other controls like combo boxes are not displayed. The active x control has been registered in windows registry using the following command
regsvr32 C:\winnt\system32\mschrt20.ocx
and the function AfxEnableControlContainer() is also called in InitInstance() function and the required header file #include <afxdisp.h> is also included in the stdafx.h file.
Still the problem exists. Please help me to solve this problem as soon as possible. we have a release by this week end.
thanks
vidya
|
|
|
|
|
I have deleted the mschart active x control and tested still the other controls like combo boxes are not displayed. The active x control has been registered in windows registry using the following command
regsvr32 C:\winnt\system32\mschrt20.ocx
and the function AfxEnableControlContainer() is also called in InitInstance() function and the required header file afxdisp.h is also included in the stdafx.h file.
Still the problem exists. Please help me to solve this problem as soon as possible. we have a release by this week end.
thanks
vidya
|
|
|
|
|
nnvidya wrote:
This dialog is added as a property page into the propertysheet.
Does that mean you are using a CPropertyPage (instead of a CDialog ) object? If so, have you looked at the OnSetActive() method?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
sorry to tell you that we are using CDialog only....not property page....
the problem is CResults is a class devired from CPropertyPage, and to this property page.....at the down i am adding 4 more pages (CChart, CSummary...etc) which are derived from CDialog.
Dialogs are not displayed in CChart, which dont have OnSetActive() function as it is a CDialog and here i am using Active-X control.
vidya
|
|
|
|
|
nnvidya wrote:
we are using CDialog only....not property page
CResults is a class devired from CPropertyPage
Don't these two statements contradict each other?
nnvidya wrote:
at the down...
I'm not sure what this means.
It sounds to me like you have a CPropertySheet -based application, with four CPropertyPage objects on the sheet. Is that correct?
You may e-mail me the project if you wish where I'll be more apt to tell what is wrong. Send a PM for my address.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Because you have a bug somewhere
OnInitDialog is a handler to WM_INITDIALOG, a Windows-message sent to all dialogs when they are created. You will want to make sure that the handler is not called (for example, by adding a message box that pops up some message).
Other than that, it painful checking and rechecking of the code that is the order of the day.
|
|
|
|
|
Hi
As an optimization for my app, I plan to incorporate some lookup tables into my class for functions such as since, power-of, etc. I have some questions though regarding how I can accomplish this:
1. Since the lookup table will clearly be shared among all objects of that class, where's the best way to place the lookup tables? I am thinking of defining them as static private members. This means that the lookup table will be initiated once during the first instantiation of the class and not during subsequent instantiation, doesn't it? Or is there some better place to put the lookup tables?
2. I am wondering though, will lookup table provide performance improvement over ordinary calculation for simple arithmetic such as power of two?
Thanks!
|
|
|
|
|
I did only some tests with SQRT(x)
LookupTable (source taken from NVIDIA)
sqrt function from the CRT
sqrt with the FPU
and the winner is.... FPU!
the LookUp table was the slowest version!
|
|
|
|
|
Lookup tables can be faster, depends on your needs, and your CPU. The CPU will calculate out to as many decimals as it can, if the first thing you do after getting an answer is round to the nearest intiger, then the lookup table is likely to be faster. However there are issues of cache that make it really hard to say. The larger the table the less advantage it has. (most operations you lookup are tight loops that can run entirelly in cache on a modern CPU with FEW stalls, while searching the table means a pipeline stall while loading the correct value from memory.
Go back a few generations and try to run on a 8088 CPU and the lookup table will scream. No FPU, and even if there was, memory access compared to CPU cycles is a lot cheaper However memory available is much less so you might not have room for the table.
In fact the faster answer might depend on if you are using a celeron, PPC, P4, or athalon just to name a full current CPUs. How portable do you need to be?
One question: I assume you are not doing premature optimization. That is your have your app running, it is too slow on the targeted CPU, and your profiler has determined that these operations are taking a lot of time. Remember, if the operation you are optimizing takes 0.1% of the CPU time no optimization can make a significant difference no matter how good. If it takes 50% of your CPU time you can make a big difference.
|
|
|
|
|
I am using the listview control from mscomctl.ocx in an MFC dialog.
When I right click on an item in the control, I find that the parent window(the dialog box)receives TWO WM_CONTEXTMENU messages, instead of one. When I click on an empty are of the control where there is no item yet, only one WM_CONTEXT message is generated.
What is the reason for this? Anyway to fix this?
thanks
Man Learns from History that he never learns from History
|
|
|
|
|
How to put more than one Toolbar in a single document MFC application?
How active it? http://paginas.terra.com.br/informatica/souza.bruno/toolbar.jpg
Thanks.
sdfs
|
|
|
|
|
Try to search for
CFrameWnd::DockControlBar( CControlBar * pBar, UINT nDockBarID = 0, LPCRECT lpRect = NULL );
usage.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
hi:
my application have five module,and i switch them with dialog like propertysheet.there is a setup modul that set system parameter.now,i want to know whether the data in setup-module dialog have been modified when i switch to another module automaticly(because i want to ask user whether to save the modification when data are modified,or else not).I dont want to set duty-mark for every control and only check whether the dialog-data have been modified(if i can).could u give me some suggestion.
thank u!
best regards!
Paul
|
|
|
|
|
The article at http://www.codeproject.com/cpp/checksum.asp[^] gives a decent overview of using checksums to see if a dialog (property page) has been modified. I use a modified version of it in one of my apps. I use a CRC32 checksum instead of the one provided in the article.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
i need to use some CEdit member functions on an edit box. but how do i access these? i guess i need a pointer to the edit box control, but how do i obtain it? i tried CWnd::GetDlgItem() but it returns a pointer to a CWnd object so i can't access CEdit member functions such as LineScroll(). i would appreciate ANY help.
|
|
|
|