|
Hello all !
I'm using MFC in a SDI application and I want a toolbar with a single Slider control on it (just the slider, nothing else). I found some articles that describes how to add some controls on the toolbar but this doesn't work if I have just the slider...
Any idea ?
Thanks
|
|
|
|
|
What is the funktion to set the Data Source of a MS ADO DATAGRID Controll Object. A DB Grid will be set by Objekt.SetDataSet() but it did´t work for MSDG.
|
|
|
|
|
If you take, say, an Edit control or a Static control, and make it multi-line, and stuff a bunch of text into it, Windows somehow knows how to break that text up into words, and splits it nicely. It even takes the language of the machine into account - Chinese text will wrap differently than English text.
Is there a way to programmatically take advantage of this? For instance, if I have a string, and want to know where the breaks should be, taking into account locale, is there any kind of API or anything to get the proper places to break?
Thanks.
Sometimes I feel like I'm a USB printer in a parallel universe.
|
|
|
|
|
Create a hidden edit control, add your text to it, and then read from the control.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
David,
I don't think that will work, since word breaking is an artifact of painting the control (using the DT_WORDBREAK flag in DrawText() ). Hyphenation and stemming libraries are available (for various languages) but aren't cheap.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Ravi Bhavnani wrote:
I don't think that will work...
Actually it does work. Try it for a full appreciation.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
How to change CFontDialog to allow color picker instead dropdown list of
system colors?
Putic A.
|
|
|
|
|
Who could explain to me how getline is working? I checked already a tutorial about it, but I didn't understand well.
THX
|
|
|
|
|
A "PLEASE" would have been highly appreciated.
istream::getline (member functions)
Declarations:
Form 1 istream& getline(signed char*, int, char = '\n');
Form 2 istream& getline(unsigned char*, int, char = '\n');
istream::getline, Form 1 (member function) Declaration:
istream& getline(signed char*, int, char = '\n');
Remarks:
This form of getline does the following:
_ extracts up to the delimiter,
_ puts the characters in the buffer
_ removes the delimiter from the input stream
_ does not put the delimiter into the buffer
istream::getline, Form 2 (member function)
Declaration:
istream& getline(unsigned char*, int, char = '\n');
Remarks:
Extracts characters into the given char * until one of the following occurs:
_ the delimiter (third parameter) is encountered
_ end-of-file is encountered
_ (len - 1) bytes have been read
>>A terminating null is always placed in the output string.
>>The delimiter is also extracted.
>>The delimiter is not placed into the destination string.
>>Fails only if no characters were extracted.
...Avenger
Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs
|
|
|
|
|
What exactly do you want?? Any specific things..
|
|
|
|
|
Hi !
If I have a list (from the STL) and want to reach the nth element, I'd like to use an iterator, set it to the beginning of the list and do something like It=It+index_to_reach.
It works for the vector, but not for the list. Could anyone tell me how I'm supposed to do ?
Here is how I do it now (with a loop incrementing the iterator) :
#include <iostream>
#include <list>
int main(int argc, char* argv[])
{
int ElementIndexToReach=2;
std::list<int> MyList;
MyList.push_back(1);
MyList.push_back(2);
MyList.push_back(3);
MyList.push_back(4);
std::list<int>::const_iterator It;
It=MyList.begin();
for (int i=0; i<ElementIndexToReach; ++i, ++It);
std::cout << "Expected value : 3. Value : " << (*It) << "\n";
return 1;
}
|
|
|
|
|
You probably want the advance() algorithm. There's a worked example in the VC online help...
// Advance.cpp
// compile with: /EHsc
#pragma warning (disable:4786)
#include <iostream>
#include <string>
#include <list>
using namespace std ;
typedef list<string> STRLIST;
int main() {
STRLIST List;
STRLIST::iterator iList;
STRLIST::difference_type dTheDiff;
List.push_back("A1");
List.push_back("B2");
List.push_back("C3");
List.push_back("D4");
List.push_back("E5");
List.push_back("F6");
List.push_back("G7");
// Print out the list
iList=List.begin();
cout << "The list is: ";
for (int i = 0; i < 7 ; i++, iList++)
cout << *iList << " ";
// Initialize to the first element"
iList=List.begin();
cout << "\n\nAdvance to the 3rd element." << endl;
advance(iList,2);
cout << "The element is " << *iList << endl;
dTheDiff = distance( List.begin(), iList);
}
Output
The list is: A1 B2 C3 D4 E5 F6 G7
Advance to the 3rd element.
The element is C3
Requirements
Header: <iterator>
Kevin
|
|
|
|
|
Like this
#include <iostream>
#include <list>#include <utility>
int main(int argc, char* argv[])
{
int ElementIndexToReach=2;
std::list<int> MyList;
MyList.push_back(1);
// First element
MyList.push_back(2);
MyList.push_back(3);
// Third element
MyList.push_back(4);
std::list<int>::iterator It;
It=MyList.begin(); // First element
std::advance(It, ElementIndexToReach);
std::cout << "Expected value : 3. Value : " << (*It) << "\n"; return 1;
}
This is needed because only random access iterators provide + and - operators. There is also a distance function which is used with non-random access iterators.
Internally, advance does just what you were doing with your for loop.
|
|
|
|
|
How to re-open a existing dialog box in an application ?
Thank's for advance,
|
|
|
|
|
Call DoModal() again.
CMyDialog myDialog (this);
int nStatus = myDialog.DoModal();
if (nStatus == IDOK)
doSomething();
doSomethingElse();
nStatus = myDialog.DoModal();
if (nStatus == IDOK)
doSomething();
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I am using ADO recordsets in my C++ program. I am adding a new record by calling AddNew method of recordset object. Now, I dont' want to override any default values set for a particular column while adding the records. How can find whether default values are set for a column, and if set, how can I get the default values. what are the methods available for that?
Thanks in advance
Shenthil
|
|
|
|
|
cross posting
He who controls others may be powerful, But he who has mastered himself is mightier still.
|
|
|
|
|
Is there a limit to the number of threads that you can create? I get this error saying I don't have enough memory to create a thread. I know I have enough RAM but don't understand why I get the error. Can I set it like Windows CE? I'm just using the standard thread create. Thanks.
|
|
|
|
|
Wots the stack size you specifying
greatest thing is to do wot others think you cant suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
Wots?? I'm not familar with the term.
|
|
|
|
|
IMHO, it is probably a stack problem.
However, I would bet that you have a poor design. Why do you need to create so many threads? What are you doing in each thread that is blocking?
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Stack problem? I thought the OS took care of it unless you specify in thread create func. Thanks.
|
|
|
|
|
Actually I don't have that many threads. Which confuses me.
|
|
|
|
|
Hi,
Can we hide the menu options, if yes please tell me how?
I don't want to disable them, just want to hide under some circumstances and show up later.
Thanks.
|
|
|
|
|
Hi!
I've been trying to figure this bug out for a week, w/out any progress, so I'd like to ask for you help, maybe there's a well-known workaround.
I have an UDP listen socket, which is to accept incoming data from the INET. The problem arises when I try to do this behind ZoneAlarm( so far I've tried this fwall ). I allow every actions (act as a server even for Inet), but when I switch it on, my socket does not receive a single byte of data, although it works properly w/out firewall.
I've also given it a try with the original MFC CAsyncSocket UDP sample, and viola, it worked, even behind firewall. So I started to compare the two codes, but it turned out that they were exactly the same (the networking part of course). I've also checked the ZA settings and they are exactly the same too.
I create the socket w/ almost the default values:
just
<br />
CAsyncSocketDerivedClass sock;<br />
sock.Create( 0, SOCK_DGRAM );<br />
with this code it gets data without ZA but don't get a single byte behind ZA.
Please, heeelp! Thanks in advance!
|
|
|
|