|
I would like to know if there is a way to set the start cursor position in a RichEdit control when the RichEdit control is first loaded.
For example, if the text string inside the RichEdit control is "Hello World", is there any way to set the starting cursor position in the RichEdit control to be just before the 'W' character?
|
|
|
|
|
what about using CRichEditCtrl::SetSel() ?
|
|
|
|
|
hi all, can you please give some info about implementing the CapCreateWindow() function for capturing image from the webcam..
|
|
|
|
|
I'm pretty sure I answered yesterday, but do you mean capCreateCaptureWindow?
If so, THE info can be found here: Video for Windows[^]
Particularly, the "Video Capture" section.
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
Which Win32 API cmd.exe usage for Clipboard operations.
Regards
Rakesh
|
|
|
|
|
Clipboard functions.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
i made this small prog:
<br />
#include <iostream><br />
using namespace std;<br />
int c;<br />
<br />
int main() {<br />
<br />
cout << "Enter number from 1-3:" << endl;<br />
<br />
if (c = 1) {<br />
cout << "Hey!" << endl;<br />
} <br />
if (c = 2) {<br />
cout << "Hmm!" << endl;<br />
}<br />
if (c = 3) {<br />
cout << "What!" << endl;<br />
} <br />
}<br />
<br />
But whenever i open it, it closes at same time, any ideas why it is like that?
|
|
|
|
|
In addition, all of your tests need to be comparisons instead of assignments:
if (c == 1)
It's also a good idea to always initialize your variables:
int c = 0;
Hope that helps
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
reyyy wrote:
if (c <code>=</code> 1) {
cout << "Hey!" << endl;
}
if (c <code>=</code> 2) {
cout << "Hmm!" << endl;
}
if (c <code>=</code> 3) {
cout << "What!" << endl;
}
Three words, dude... Warning Level 4 !
Those are assignments, not equality tests.
BTW - the app is closing quickly because it is running to completion. Make it wait for input or something in order to keep it running.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
How do i assign cin to this code for user input?
|
|
|
|
|
reyyy wrote: if (c = 1) {
Had you put the constants on the left of the operator, you would have quickly spotted the error.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
reyyy wrote: How do i assign cin to this code for user input?
in short, you should go back to your homeworks/lessons.
in long :
#include <iostream>
#include <conio.h>
void main() {
int c = 0;
std::cout << "Enter number from 1-3:" << endl;
std::cin >> c;
if (c == 1) {
std::cout << "Hey!" << endl;
}
else if (c == 2) {
std::cout << "Hmm!" << endl;
}
else if (c == 3) {
std::cout << "What!" << endl;
}
else {
std::count << "unknown value typed !" << endl;
}
getch();
}
ps: don't worry about my std:: , i just don't like the using namespace std
ps2: avoid global variables (see that i declare c inside the main function.
ps3: if you declare a function of type int , it should return a value (otherwise, declare it void - what i did here)
ps4: don't write successive if like you do, because the compiler will have to do every tests even if one is already succeeding. prefer using the else if statement for this.
-- modified at 12:27 Tuesday 27th February, 2007
can someone explain me what's wrong with this post to get rated like it is ?
|
|
|
|
|
std:: is the same as using namespace std; , right? and why did you use void main() instead of int main() ?
|
|
|
|
|
reyyy wrote: std:: is the same as using namespace std; , right
not quite. when you write an identifier, the compiler searches is it the namespaces imported, and in the global namespace. but using too many namespaces at the same time can issue into name ambiguities. so as writing the whole identifier name is not so hard to do, i prefer letting the things clear for the compiler AND for the readers of my code...
reyyy wrote: and why did you use void main() instead of int main() ?
this answer is in my previous reply. as you have no return statement in your main, you ave then no need to return a value, thus the void .
|
|
|
|
|
how can i assign cin to this part
if (c == 1) {
cout << "Hey!" << endl;
}
if (c == 2) {
cout << "Hmm!" << endl;
}
if (c == 3) {
cout << "What!" << endl;
} else {
cout << "Wrong!";
}
?
-- modified at 10:26 Tuesday 27th February, 2007
|
|
|
|
|
reyyy wrote: how can i assign cin to this part
i don't really get you.
don't you see the following line in the sample i gave you previously ?
std::cin >> c;
this line waits for a user input, and puts the value typed into c.
then, the process is that once the value is set, you can test it (thus the if s)
|
|
|
|
|
Well, sorry, but i have used only global namespaces, and i don't know much about this form std:: ,
that's why i was aking how can i assign cin without std::
And btw, when i put user input, program closes, without giving back statements from cases.
|
|
|
|
|
that's exactly why i don't like the infamous using namespace . you do things, but don't know at all what you're doing actually.
cin is never defined in the global namespace (otherwise, you would have been able to write ::cin without any compiler errors - that's not the case).
don't worry about the std:: . simply see it as saying "cin is in the standard namespace".
when you say using namespace std; , then every identifier (which namespace is not precised explicitely like i do) will be searched in the namespace imported.
that's good practice to never use (or at least reduce significantly the use of) using namespace . if you really feel the need of it, then prefer if inside a method rather than at the beginning of a whole cpp or .h file. that's how problems come !
|
|
|
|
|
IMHO I suggest you ask her to change it to "int" main and return something rather than opting for "void" and return nothing. It's said as the best practice particularly for the "main()". Can I be right toxcct?
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
VuNic wrote: IMHO I suggest you ask her to change it to "int" main and return something rather than opting for "void" and return nothing. It's said as the best practice particularly for the "main()". Can I be right toxcct?
If you want your main() function to return an exit code, then you could return an int , or char , or whatever. It is perfectly safe to have a void main, too.
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
Hi,
Can explain me about the mail merge concept in Vb.Net, Crystal Report, Word Doc, Excel Document
Thanks
|
|
|
|
|
Hello,
I know what mail merge means for Word. I don't know what it means for others.
In Mail merge one letter or document is attached to name or addresses of people stored in a data file.
So suppose you have typed a letter and you want to post it to 100 persons and each of these letters should have the name printed on the document then mail merge enables you to do that.You have to type one letter ,store name address etc that is the individual details in a data file and attach both of them in the mail merge procedure.When printed you will get 100 letters with particular info in place of the letter.
Prithaa
|
|
|
|
|
Here Visual C++ / MFC forum
|
|
|
|
|
I have a multi lined richtext control (the native Win32 version).
As I add a new line of text I want to vertically scroll to the last line of added text. How do I do this? I recall trying in the past and running into problems, and I'd like to fix this once and for all. Are there certain specific style bits that need to be set? Something else? EM_LINESCROLL didn't seem to act like I thought it would.
|
|
|
|
|
I think the style ECO_AUTOVSCROLL set it with CRichEditCtrl::SetOptions may be the answer, combined by CRichEditCtrl::SetSel(-1,-1).
Society is composed of two great classes, those that have more dinners than appetite, and those who have more appetite than dinners
Fold with us! ¤ flickr
|
|
|
|