|
do you know c++ class ?
<br />
class CYOUView : public CView<br />
{<br />
int m_int;<br />
};<br />
If you try compile that string:
<br />
... GetActiveView()->m_int ...<br />
you got error "m_int not member of class CView"
but if you write:
<br />
... ((CYOUView*)GetActiveView())->m_int ...<br />
that will compile, and work whith no error's
|
|
|
|
|
Hi All,
I'm sure this has been asked coutnless times before but i'm buggered if i can find the answer anywhere.
Got an MFC dialog app. I want to DoModal on the first dialog, and then if the ok button was clicked, create a different dialog and DoModal on that.
But the second dialog just returns immediately.
Any ideas?
Jon
|
|
|
|
|
Remove m_pMainWnd assigment from CWinApp::InitInstance and will work
|
|
|
|
|
make sur the second dialog is a member variable of the first dialog class. and is created with new , not just created on the stack in the function that creates the second dialog.
something like
m_pSecondDialog = new MySecondDialogClass;
m_pSecondDialog->Create( ... );
instead of
MySecondDialogClass dlg;
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
I was using the code for high color bitmaps in "http://www.codeguru.com/Cpp/G-M/bitmap/article.php/c1721/" and i created a class which can be used for image loading and displaying from a resource the CBitmap and Cpalette are member vars of the class .
I used the class in a game where there are different levels and the number of images is incresed as the level increases then i noticed that the program occasionaly faces the from of creating a compatible dc then i noticed that using the resource meter that level after level the GDI resource is falling in the class destructor i used detach and deleteObject for each CBitmap and Cpalette member but the gdi resource starts falling to a critical level and thats when the program fails to create a compatible dc after closing the window the GDI is restored to its orignal level but as the level increases the GDI level falls?????
what can be done after each level to restore the GDI resources
|
|
|
|
|
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.
|
|
|
|