|
Try asking this in the Lounge, and good luck for the interviews.
~RaGE();
|
|
|
|
|
Hi,
How are you all?
This is my first post here. I am new to MFC and just a college passout.
I hope to have nice answers here for all the "Greats"!
My program is having memory leakage.
In my view function,
I use
CDC *pdc=GetDC()
But I am not releasing it.
Can this be a reason for leak?
In view function what is the best method to use Contect devices to avoid such errors? Should CClientDC be used?
I assume I am understandable here .
--
LinDaSu
|
|
|
|
|
Hi
What you have there is not a regular memory leak... it could be a GDI resource leak. But that is depending on how the window class is created. If any of the following styles were used CS_CLASSDC, CS_OWNDC or CS_PARENTDC, then the above is not a resource leak, other wise you should use ReleaseDC to reclaim the GDI resources.
Also for you information, VS C++ will not report GDI resource leaks only normal memory leaks from the built in memory handler.
Magnus
|
|
|
|
|
give me a sample for service in c++,mfc
|
|
|
|
|
Have you tried Googling for such an example?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
|
We need to create an IE instance from our application,navigate to a particular site programmatically and load the DOM document tree for that page.
When we do it from a ATL GUI application ,and create the IE instance on the click of the Button control,the browser duly fires the beforenavigate,navigatecomplete and documentcomplete events ,and we can load the DOM tree on documentcomplete.
However,when we try to do the same from a win32 console application ,the browser fires the 'beforenavigate' event and waits.
It fires the remaining events and navigates to the site only after we exit out of the application.
How do we make the browser complete the navigation to the site,without exitting from the program?We have even tried to fire the navigate event on a separate thread,but to no avail.
int main()
{
CoInitialize(NULL);
IIEdispatcher* disp;
HRESULT hr;
hr=CoCreateInstance(CLSID_IEdispatcher,NULL,CLSCTX_INPROC_SERVER,IID_IIEdispatcher,(void**)&disp);
if(SUCCEEDED(hr))
{
disp->createIE();//this method navigates the browser to a url
}
CoUninitialize();
}
The browser completes it navigation only after we exit out of this process.We are creatign the browser as a out-of-proc component.
|
|
|
|
|
Hi all,
I have to send tag points to two differnt operators(A&B).
Till we are sending to one operators.But now i have to send two different set of tag points to two different operators.
My coding
BOOL OpenReadFile()
{
CString strFileName;
strFileName = WorkDirectory;
if(FodFlag==TRUE)//Its for A operator
{
strFileName += "\\FODCS\\Tag.FODCS";
}
if(OPSTATION == CENTUMXL)//it may be B opr
{
strFileName += "\\YXL\\Tag.YXL";
}
else if(OPSTATION == CS3000)//it may be B opr
{
strFileName += "\\YCS\\Tag.YCS";
}
else if(OPSTATION == HONEYWELL)//it may be B opr
{
strFileName += "\\TDC\\Tag.TD3";
}
else if(OPSTATION == FOXBORO)//it may be B opr
{
strFileName += "\\FOX\\Tag.FOX";
}
else
{
AfxMessageBox(IDS_OPSTATION);
return 0;
}
if(!PFile.Open( strFileName, CFile::modeRead ))
{
AfxMessageBox("Failed to read Tag Point information");
return 0;
}
return 1;
}
The StrFile Name refers C:\\ABC
As we have to select two operators at a time,the file path got wrong and display the ("Failed to read Tag Point information")
Pls help me
|
|
|
|
|
I think you have to filter out everything that is your application specific: we cannot understand what you are looking for. Explain the problem in a way that is understandable for us (remember that we cannot see your screen and the project you are working on).
We don't know what a tag point and an operator are (in the context of your application I mean).
|
|
|
|
|
Here I will explain my problem in detail…
First here Operator means my trainee. and I am a Trainer.From my trainer coding I have to send some Tag details(Tag Name like Controller,Indicator,Guage ;Scale value;Alarm color) to my trainee coding.Each trainee should receive different tag details.
I have two different trainee coding as AA and BB. I have saved the tag details in a file in C Drive as c:\\FOD file for Trainee AA and c:\\YCS file for BB. I have to send details at a time.
Till now my application is running by having one trainee as BB.So, my coding referring the file with out any confusion. Now I have to develop for two trainee codings.
So I changed my previous coding by adding these two lines,
if(FodFlag==TRUE)//Its for A operator
{
strFileName += "\\FODCS\\Tag.FODCS";
}
I set a flag for the selection of AA trainee. But it’s the wrong way Coz’
For eg; If I choose A operator as well as OPSTATION == CS3000 operator..then the file directory get changed and showed the error message box.
BOOL OpenReadFile()
{
CString strFileName;
strFileName = WorkDirectory;
///Newly added coding
if(FodFlag==TRUE)//Its for AA operator
{
strFileName += "\\FODCS\\Tag.FODCS";
}/////end of new coding
if(OPSTATION == CENTUMXL)//it may be BB opr
{
strFileName += "\\YXL\\Tag.YXL";
}
else if(OPSTATION == CS3000)//it may be BB opr
{
strFileName += "\\YCS\\Tag.YCS";
}
else if(OPSTATION == HONEYWELL)//it may be BB opr
{
strFileName += "\\TDC\\Tag.TD3";
}
else if(OPSTATION == FOXBORO)//it may be BB opr
{
strFileName += "\\FOX\\Tag.FOX";
}
else
{
AfxMessageBox(IDS_OPSTATION);
return 0;
}
if(!PFile.Open( strFileName, CFile::modeRead ))
{
AfxMessageBox("Failed to read Tag Point information");
return 0;
}
return 1;
}
Among Two trainees,Here AA is compulsory Trainee and BB may any of the above BB operator.
|
|
|
|
|
I didn't understand anything. Could you make abstraction of your program (so explain the problem clearly without digging with the details of your application that in fact, we don't care). What is the problem ? What do you have actually as code (explain what it should do and what it does exactly) ?
If we don't understand what the problem is, it will be difficult to provide you with a solution.
|
|
|
|
|
hai
i want to apply Microsoft XP visual styles to my dialogs.i have gone through the article"using windows XP styles in your MFC/Win32 applications" by Kluch and i have developed an application according to him but i couldnot see any effect.even iran his demo but no result.can anybody help me out this problem.
sathish
|
|
|
|
|
mosali satish wrote: i want to apply Microsoft XP visual styles to my dialogs.
You have to specify a manifest file for your project.
Open your RC file and add the following line...
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST ".\\YourApp.manifest"
YourApp should be replaced by the exe name of your project.
Nibu thomas
Software Developer
Faqs by Michael dunn
|
|
|
|
|
Hi,
I use an owner draw menu (handling WM_MEASUREITEM, WM_DRAWITEM, WM_MENUSELECT, WM_MENUCHAR messages).
Under MFC, if you use a popup menu with several menu items
(for example: recent files), two automatic menu scroll button appear on the top and the bottom of the list.
These buttons appear when there isn't enough place on the screen to display the menu items.
How can i change the default drawing of this buttons?
|
|
|
|
|
Hi,
Has anybody worked on MixerControl API.. I want to find the audio level from my microphone attached to the PC. I am using mixerGetLineControls function to get the volume. but it is not returning the correct volume. always returns some negative value.
Can anybody help me in this issue.
Thanks in advance
Poornima
|
|
|
|
|
You're asking for way too much to hope for a reply here. Vector graphics means that to zoom, all you need to do is scale all the vectors before drawing. You need to post some code, and ask specific questions about where you're getting stuck.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I am quite sorry that the only help I can offer is the following:
Check out ZedGraph on SF and the articles here on CP. ZedGraph is a Graphing Control capable of zooming into and out of Graphs. Looking at it's source might help you to find a solution. It was written in C#, though.
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
Sebastian Schneider wrote: ZedGraph is a Graphing Control capable of zooming into and out of Graphs
Mmmhh, I don't think this will help. I don't know ZedGraph but for a chart control, the most logical way of zooming and unzooming is simply to change the min and max values of the axis. And the rest should be done automatically .
|
|
|
|
|
|
Hai All,
Can any one help me to give the source code of Voice Communication using VoIP.Is it diffcult.
Plz.....Any one help me .....
Jeeva
|
|
|
|
|
|
Is there a way to use both EN_CHANGE & EN_KILLFOCUS for edit controls(dynamic edit controls)
I need to use EN_KILLFOCUS bcoz when the focus is changed from edit control to another edit control,the value entered should be validated.
and now if i change a value in the edit control and try to close the application,the value should be saved!!
So,the problem is that when i try to close the application,the focus changes,thus calling EN_KILLFOCUS..
So plz help me whether both can be used at the same time?
|
|
|
|
|
These are two different events and they are not used 'at the same time'. EN_CHANGE will be fired each time you change something in the edit (each time you press a key, it will be fired) and EN_KILLFOCUS is fired only when the control looses the focus. So, why do you see a problem there ?
|
|
|
|
|
See, the problem is that when there is a change in the edit box and then if i try to close my application(Either by File->Exit or Alt+F4),both EN_CHANAGE and EN_KILLFOCUS fires.
I use EN_KILLFOCUS to validate the entered text/value in edit control when there is a change focus.
So when i exit my application after changing the value,it should prompt for SAVING,it does but it also handles the EN_KILLFOCUS when a invalid value is entered.
|
|
|
|
|
zxc89 wrote: I use EN_KILLFOCUS to validate the entered text/value in edit control when there is a change focus.
So when i exit my application after changing the value,it should prompt for SAVING,it does but it also handles the EN_KILLFOCUS when a invalid value is entered.
Why don't you try One Time Validation?
This means validate before you save the data.
Personally I don't like message boxes to come up when I press tab saying "You have to enter proper data". Lol it's very irritating.
Nibu thomas
Software Developer
Faqs by Michael dunn
|
|
|
|