|
You don't need a progress dialog to delete a file. It's a one-step operation that takes but a second.
|
|
|
|
|
Im writing a C++ program, and I need to add a member variable to a class. This member variable is an object that takes 2 parameters to it's contructor. How do I declare the variable in the header of my class, and initialize it in the constructor of the class that I am using it in?
ROY! Please don't go!
Kevin Shaffer
Student of Computer Science
University of Kansas
kshaff03@msn.com
|
|
|
|
|
class Fred
{
Fred() : x(whatever, whatever)
{
}
CFoo x;
};
<pre>
<hr>
<font size="-2" color="#6060af">Image tools: <a href="http://www.smalleranimals.com/thumb.htm">ThumbNailer</a>, <a href="http://www.smalleranimals.com/bobber.htm">Bobber</a>, <a href="http://www.smalleranimals.com/tiffass.htm">TIFFAssembler</a></font>
|
|
|
|
|
When you hit the enter key in VS6 it inserts "\r\n" which drops you down a line. This is normal behavior in windows, however I'm editing C++ files that are being used in unix and the \r is an annoyance there.
My question is, does anyone know how to stop VS from inserting the \r -or- Is there a way to run a small script that would strip this out when you save the file?
-Jack
|
|
|
|
|
Go to "File|Advanced Save Options..." For Line Endings select "Unix (LF)"
Unfortunately, this applies only to the active file (note the singular).
|
|
|
|
|
Is this in VC++ 6.0 ? Because I don't see "Advanced Save Options" under the File menu.
Thanks,
Jack
There are 10 types of people in this world, those that understand binary and those who don't.
|
|
|
|
|
Sorry, I was thinking VC7.
I don't believe there is a solution in VC6 except to write a little program. (In fact VC6 will take files that have just LF and convert them automatically to CR/LF. By default, VC7 will preserve the original style.)
|
|
|
|
|
Mine seems to be preserving the original style. It only inserts the \r when I add a line.
Do you happen to know if it is possible to write a little script/program and have it be ran on the file when you hit save? Like a filter or something.
-Jack
There are 10 types of people in this world, those that understand binary and those who don't.
|
|
|
|
|
There is an event to tell you a document has been saved, but I don't think there is the ability to do what you want.
One solution would be to write an add-in and call it directly.
|
|
|
|
|
Ok, Thanks for your help. Would you happen to know how to access this event? I wouldn't mind writing a program that cleans up the file right after each save.
-Jack
There are 10 types of people in this world, those that understand binary and those who don't.
|
|
|
|
|
Check out the add-in documentation. You probably could also do this as a macro, but I don't remember how (the last Visual Studio macro I wrote was three years ago.)
|
|
|
|
|
If you are working with Unix and Windows at the same time, I recommend you installing Cygwin[^].
One of their utilities is u2d and d2u (Unix to Dos/Dos to Unix), which make the conversion you need.
I know that installing Cygwin just for this is overkill, but I think you should give it a try, since it can really ease when you are working with multiplatform code.
It's not the fall that kills you: it's the sudden stop - Down by Law, Jim Jamursch (1986)
|
|
|
|
|
I'm trying to find a way to programatically turn on/off the "Show Web Content" from the active desktop. Essentially seting the check in the system menu under Active Desktop.
|
|
|
|
|
|
A little confusion.
We can override OnOk(), or PreTranslateMessage(), but not SetWIndowText() right? What makes a function overridable? Is it that only event handlers are overridable? I'm reading about the word "virtual" but dont see it in the members of say CWnd...like GetWindowTExt etc. I looked in "Input Message Hanfdlers" which has functions like OnHScroll, OnKeyDOwn etdc which are ones that I've seen overridden yet they dont say "virtual" in the declaration (in MSDN)
Appreciate your help,
ns
|
|
|
|
|
|
Thanks for the link....
Actually I looked up OnChar in afxwin.h and its not got a "virtual" but its
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
and I believe its a function we can override. SO having the keyword "virtual" isnt necessary to make a function overridable it seems.
Appreciate your help,
ns
|
|
|
|
|
ns wrote:
and I believe its a function we can override. SO having the keyword "virtual" isnt necessary to make a function overridable it seems.
No, you can't override the function, what you can do is have an handler for it in the CWnd derived class you have.
you can only override virtual methods.
Max.
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
Providing a handler is not the same as overriding. Thats also a place I wasnt clear about. Thanks for this info!
Appreciate your help,
ns
|
|
|
|
|
ns wrote:
SO having the keyword "virtual" isnt necessary to make a function overridable it seems.
true, sortof.
the virtual option affects who calls your override. if you override a non-virtual function, your function will not be called if the caller thinks he's using a base-class object. ie. if the caller only has a CWnd pointer and calls a non-virtual function on your CMyWnd object, he will end up in the base class function, not your override. the effect of the virtual keyword is to allow callers without knowledge of derived classes to call function in the derived class.
-c
Image tools: ThumbNailer, Bobber, TIFFAssembler
|
|
|
|
|
virtual only applies when the object is being passed as a reference to it's base class.
Say you have a base class foobase, and a derived class fooderived,
and you have a virtual override of OnOk() in your fooderived.
The virtual means that the virtual function will be selected if the fooderived is passed to a function that needs foobase as a param.
The fooderived is casted to foobase, but all virtual functions in fooderived will take precedence even though your fooderived is being cast as a foobase.
hey
|
|
|
|
|
Remember that MFC is a thin wrapper over the Win32 API. MFC's CWnd class provides virtual functions that can be overridden in your derived class, as you already know. Some of these virtual functions are actually callback handlers, such as OnSize() , OnGetMinMaxInfo() , etc. They are what get called when a WM_SIZE , WM_GETMINMAXINFO , etc. message is sent/posted to the window.
Now to the interesting part...
MFC provides a back door to allow you to handler *any* Windows message, not just one that's handled by a provided overridable. This is done by the virtual function OnWndMsg() . You can provide custom handling for WM_SETTEXT here. Just be sure to call the base class method for all other messages, or else you could have some seriously weird windowing behavior on your hands!
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
All the responses were really informative and helpful. I think lightbulbs are going on in me mind....
ns
|
|
|
|
|
My program is a small GIS and I was using GDI to display maps and informations. Now I would like to use GDI+ and I didn't find any function to draw a pixel ? Do I have to use GDI to draw pixels and GDI+ to draw the other stuff ?
Thanks !
|
|
|
|
|
You can use Graphics.SetPixel, but it is quite slow. You can also use Bitmap.GetData, which returns a BitmapData object, whose Scan0 property is a pointer to the bitmap's data (in BGR format, not RGB format).
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|