|
Any GDI object that you select into a device context must be selected out of the device context before you can delete it. The easiest way to do this is to use the SaveDC and RestoreDC functions.
CDC MemDC;
MemDC.CreateCompatibleDC(NULL);
int Saved = MemDC.SaveDC();
MemDC.RestoreDC(Saved);
Also have a look at http://www.codeproject.com/gdi/csavedc.asp[^]
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Thanks a lot
But on the artice u pointed out i saw a thread that says these GDI leaks are on win 9X systems only !
And i have win 98 what do u know about this
|
|
|
|
|
These types of resource leaks occur on all versions of windows. That false rumor is spread because NT based systems have a much larger limit on the number of available GDI handles. So a leak on 9x will crash your app a lot quicker than a leak on NT/2K/XP, but they will crash your app if your app runs long enough.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Hello guys...
Now, i am currently working to develop an application for my school project. My project is making communication between two computer via telephone line using modems.I wanted to enhance my application, and here is my question :
How do I add an event sound to my application? (i.e. when one computer making call to another, and its receive "RING" message from modem and produce sound (ring.wav)
->> I mean, when one computer receive "RING" message (its shows in edit box), i want the computer produce ringing tone.(some sound alert for the user)
Beside that, when the transfer of data is complited, the computer produce sound for this event.
I have surfed the web for examples and tutorials, but majority of them seem to be a little too advance for me. If someone out there can explain the basics to me, along with a simple example, I would really appreciate it.
|
|
|
|
|
Hi,
you can use the PlaySound(..) function. Have a look @ the following link which contains a sample which uses this function
http://msdn.microsoft.com/library/en-us/vcsample98/html/_sample_mfc_speakn.asp
Sujan
|
|
|
|
|
Hi dudes,
I have a small problem with my tree control. I want to know how to get the text of the Item of the tree control when the user right clicks on it.
I tried with the GetSelectedItem(). But it is not working because user when right clicks on items of the tree control it is not considered as selected.
Thanks in Advance.
best Regards,
Deliver
If you have faith in the cause and
the means and in God, the hot
Sun will be cool for you.
|
|
|
|
|
See this[^] article to determine the HTREEITEM of a right-clicked tree item.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi,
Have a look @ this article
http://www.codeguru.com/Cpp/controls/treeview/misc-advanced/article.php/c691
Sujan
|
|
|
|
|
In OnDraw, I use font on the pDC, and it works fine, But when printing and print preview , it didn`t do the font. Where should I attach the font to the printing DC, and why, Thanks
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
You can attach HDI objects to a printer DC in OnPreparePrinting OR OnBeginPrinting Handlers. If you want to do it in OnDraw, you can check if DC is printing or not by using
if(pDC->IsPrinting())
After that, you can do what you want with DC.
goodmast3r wrote:
and why
well, you better see some printing tutorials for this. Too much already available on printing stuff.
<marquee> STUCK STUCK STUCK STUCK
Stuck to Programming through an unbreakable bond
My Articles | My Blog
|
|
|
|
|
Can anyone explain to me how to use this function.
Function:
CopyResourceToFile(char*, int);
It havent seen any kind of documentation of source files with this . A friend of mine brought it up and I got curious on what it is for and how to impliment it. Any chance of solving this question?
|
|
|
|
|
Hi,
Is it associated with VC++. I think it is related with java. Have a look @ the following link.
http://www.st.cs.uni-sb.de/eclipse/javadoc/de/uds/cs/st/dd/util/FileUtils.html
Sujan
|
|
|
|
|
Actually it's related to VC++.
|
|
|
|
|
where did you see this function
There is no spoon.
mail
|
|
|
|
|
Hi,
I don't think that this is a VC++ function. Nothing related 2 this is present in the newsgroup.
No idea.
From the following link
http://www.st.cs.uni-sb.de/eclipse/javadoc/de/uds/cs/st/dd/util/FileUtils.html
i think that it is related 2 java
Sujan
|
|
|
|
|
I saw this function in one of my friends small programs. It seemed to export a file from that same program. Which was kind of cool and weird at the same time. Of course he isnt sharing the source. So I tryed to see if I replicate this function. It compiles fine. The only thing is it doesnt work and I dont know how or what it is exactly for. All I know is it looked like this
CopyResourceFromFil("File.exe", 232);
My guess now is that it "232" might be the name of a resource being exported in Bin? and that "File" is named of the exported file? Still confused about this. I know its a VC++ function because it compiles without error.
|
|
|
|
|
About DirectDraw................
I want to create a surface to receive the data from a videoport,but the overlay surface is unsupported.
Well,What kinds of surface should I create?
Please give me some suggestion
free like a bird
|
|
|
|
|
Hi,
Firstly, I am new to MFC so any help appreciated. I am building a single document MFC application without Doc/View Architecture support. In my application I want to be able to show different CView subclasses such as CListView, CFormView instead of the CChildView. I need to change to different views by click of a button Tool bar. So how can I achieve this? I have looked on the forums and articles on this site and have found nothing on the subject.
I appreciate any kind of help you can offer.
Robert Buldoc
|
|
|
|
|
Hi,
i do think that you must have to write a mdi application. Only mdi application can handle different types of view automatically.
have a look @
Multiple Document Types, Views, and Frame Windows
@ msdn
Sujan
|
|
|
|
|
Thanks for the reply,
I am thinking of getting the CWnd rect and using it as a place holder for other forms.
|
|
|
|
|
Is there a real simple way to disable a toolbar item programmically. I am trying CCmdUI however it doesn't seem to be working. The one difference here is that the toolbar I am working with in trying to enable and disable items is on a separate toolbar, not the mainframe or document toolbar.
Thanks!
|
|
|
|
|
Try this:
m_wndToolBar.GetToolBarCtrl().SetState(IDC_TOOLBARBUTTON1,~(TBSTATE_ENABLED))
here m_wndToolBar is the variable for that Toolbar and IDC_TOOLBARBUTTON1 is Button's ID.
<marquee> STUCK STUCK STUCK STUCK
Stuck to Programming through an unbreakable bond
My Articles | My Blog
|
|
|
|
|
thanks! Actually did figure out my issues. The resource ID's did not match any of the event ID if you know what I mean so they were all greyed out. This information you give here, though, I still may need. Thanks for the tip!
|
|
|
|
|
hi everyone..
i'm having this stupid problem that i don't know how to solve:
DWORD Size = GetFileSize(..);
int Arr[Size];
the problem is that Arr doesn't accept Size to be the number of elements!!!
|
|
|
|
|
I don't think arrays like to be dymically allocated. I think you have to give it a constant number.
Try using CStringArray instead.
Hope this helps.
|
|
|
|