|
I have an application that writes to the registry to start itself on startup, but I need some function to get the application path. Anyone have any ideas?
Thanks in advance.
|
|
|
|
|
|
Great! Thanks a lot for that suggestion. I looked at it on MSDN, and there's only a small problem left. I am using a CString named path to store the path, and so for the buffer I used path.GetBuffer(0) like ::GetModuleFileName(NULL,path.GetBuffer(0),sizeof(path.GetBuffer(0))); . Unfortunately, the path, no matter what my executable is named, is C:\Dstrcore.cpp. Any clue as to what's going on? I suspect that it's something to do with the CString.
Also, is there any other way to get a buffer of modifyable length like the CString method GetBuffer? char* doesn't seem to work for me...I have to initialize it like path=new char [10], but I don't know how many characters the path will be...CString helps by null terminating the string and also by having a buffer of modifyable length...If anyone can figure out how to do this with a char*, I'd be really grateful.
Thanks again.
|
|
|
|
|
|
hxhl95 wrote: ...I used path.GetBuffer(0) like ::GetModuleFileName(NULL,path.GetBuffer(0),sizeof(path.GetBuffer(0)));.
Since GetBuffer() returns a pointer, you are passing 4 as the third argument to GetModuleFileName() . Try:
GetModuleFileName(NULL, path.GetBuffer(MAX_PATH), MAX_PATH);
path.ReleaseBuffer();
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
What's MAX_PATH? Never heard of it before
|
|
|
|
|
hxhl95 wrote: What's MAX_PATH?
See here[^], and also check your Include folder.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
How does a conversion operator works ?
Why it is created with overloading keyword "operator" ?
Why it does not have a return type, while with the "operator" keywork we have to have mention a return type ????
Please, all the gentlemen here, help me, i am trying to hone my C++ programming skills to a good level.
|
|
|
|
|
Zealous_Me wrote: i am trying to hone my C++ programming skills to a good level.
Why do you think forum based messages are an appropriate way to do that?
IMHO you would be better served working some tutorials and/or reading some books.
|
|
|
|
|
Hey if u don't know the answer then don't waste my time, and let somebody with enough knowledge to come up and respond. for your kind information i have read enough of my book ->>BY-> Robert Lafore but I couldn't find an answer thats why I put it here.
|
|
|
|
|
Zealous_Me wrote: i have read enough of my book
Also see Effective C++ series by Scott Meyers
|
|
|
|
|
Thank you for suggesting me good book. I'll definitely consult the book. and I am sorry if my answer was rude to you.
|
|
|
|
|
I looked at some of your old posts and you gave this rude answer before ("don't waste my time"). When you are rude to higher-up members chances are you'll be blacklisted and no one will answer your questions. So good luck on that one.
_____________________________________________
Flea Market! It's just like...it's just like...A MINI-MALL!
|
|
|
|
|
Hey thanks for the suggestion dude !! well, actually i wanna hone my coding skills at a fast rate and I put up a question only when i do not find an answer myself after long hard work. but, after putting the question up here i always look get an answer but in return if I get an answer of "look in some book" or "do some tutorials" then u tell who'll not go mad at such a reply.
I don't wanna waste anyone else's time and also my time, thats why I come up with a question when I have done enough to find an answer with my level of knowledge.
Well, thank you for warning me and I'll be careful to not to react if someone gives me answers that are not at all useful.
|
|
|
|
|
Stop shouting at others until you have read Effective C++ and More Effective C++ by Scot Myers.
"I have read enough of my book" does not sound very promising, though.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
Conversion functions provide a way to explicitly convert an object of a type to another type.
Zealous_Me wrote: Why it is created with overloading keyword "operator" ?
Probably because conversions are done using a "casting operator" - parenthesis "()"
Zealous_Me wrote: Why it does not have a return type, while with the "operator" keywork we have to have mention a return type ????
This is a matter of the chosen syntax. Bjarne would know best, but I imagine the syntax is this way to differentiate the
conversion function from a function call operator.
For example, the syntax could have been chosen to be
type operator()
but a function call operator looks like this:
type operator()([optional arguments])
Having the syntax for a conversion function like this:
operator type()
seems more clear to me that it's a "cast operator" to "type".
As led mike suggested, reading is good -Operator Overloading[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: As led mike suggested, reading is good
Apparently my answer was not good
|
|
|
|
|
It wasn't you - apparently "Robert Lafore"'s answers aren't good
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
Hello Everyone,
I want to add a button in a application.Application reads images and I want this button to do labeling for the image being read.
Can anyone please give me some idea like how to start with?Actually,I am a beginner in VC++.I would appreciate any kind of help.Thanking You in advance.
Regards,
Ravan
|
|
|
|
|
open your resource editor, drag n' drop the button control, and there you go...
|
|
|
|
|
raavn wrote: I want to add a button in a application.
So just add the button control like you would any other control.
raavn wrote: ...I want this button to do labeling for the image being read.
Which means what exactly?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi david,
Thanx a lot for replying.
Actually, I have already a software that loads DT files and after that these files are segmented for tumor and ventricles.What I wanna to do is add a button to this existing software.I wanna this button to do labeling on that medical image.For example,I wawant to write vetricles when ventricles appear on slice.Actually, this software was developed by some other person.I jus wanna to add this feature to this existing software.
Can u plz give me guidelines to implement this idea?I have very little knowledge of VC++.
Thanks & Regards,
Ravan
|
|
|
|
|
raavn wrote: What I wanna to do is add a button to this existing software.
Do you have the source code?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yeah,I hv the source code.
|
|
|
|