|
One possible reason is that windows calls PreTranslateMessage() before updating the control.
Kuphryn
|
|
|
|
|
Hi everyone!
I'm searching for source code of the video codec (h.263 compatible).
...actually i found one OpenMash project, but i don't know how to use their codec in VC++ application
If anybody know some sources & examples of video compression/decompression
source etc. please give me know
Pawel Olszewski (pandora_@wp.pl)
|
|
|
|
|
I have a program that needs to open and close and open and close several modal dialgos one after the other.
My first modal dialog goes great, but when I call the second one's doModal, it immediately closes.
I bet this is somehow related to a WM_QUIT remaining in the message-queue or something like that, but I can't really put my finger on it.
Can someone help ?
Thanks
|
|
|
|
|
Some more investigation brough up this solution:
After the first (and any other doModal()), do:
while (PumpMessage()) {};
AfxGetThreadState()->m_nDisablePumpCount--;
this will eat all messages up to and including the WM_QUIT (which increases m_nDisablePumpCount), we then ammend this counter and continue. (This counter is what causes the abrupt closure of any window to attempt and open.
Is there a cleaner solution (except for overriding PumpMessage and handling things different from inside there) ?
|
|
|
|
|
Read MSDN article Q138681.
|
|
|
|
|
Hi All,
I Need Help Regarding The Storing of Data in ASCII format
How To store TEXT Data in ASCII Format and In which Format
Ascii Data to be Stored
and What are The Precautions to Be Taken Storing The Data
In ASCII Format.
Thanks In Advance
|
|
|
|
|
|
One down side to storing data in plain ASCII is that it's readable using a simple text editor like Notepad.
Another limitation is that you're limited to the ASCII set of characters, which means if you want to store binary data, you'll need to convert it to ASCII (which causes a 2x increase in size) before storing it.
If you're looking for a general article on serializing data, you might find this set[^] of articles helpful.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Check out CStdioFile, it will do what you want.
Also you can use regular C++ iostreams (e.g., ifstream and ofstream) to be more "standard" or if you aren't using MFC. MSDN has docs for all of these.
"When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity." - Albert Einstein
|
|
|
|
|
Does anyone know if there is a STL algo to remove duplicate items in a vector?
I have a vector of string values that I would like to make unique. The vector will eventually be sorted. Is there a quick stl way of doing this?
On a similar not, I tried using std::set to filter duplicate strings, but I found this to be extremely slow.
I Dream of Absolute Zero
|
|
|
|
|
There is no faster way of doing this because if you think about it you have to check the string does not exist yet. Set is pretty much the fastest way of doing that unless you want to use a hash table. Yes, there is a hash table in some versions of the stl.
If you say the vector will then be sorted, you were right to use set in the first place.
|
|
|
|
|
cheers for that, dude.
I Dream of Absolute Zero
|
|
|
|
|
Is this the type of thing you want? Especially if sorting may be required
sort(source.begin(),source.end());
unique_copy(source.begin(),source.end(),back_inserter(dest));
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Can't you check for duplicates as the items are added?
|
|
|
|
|
DavidCrow wrote:
Can't you check for duplicates as the items are added?
Thats why I was using the std::set as it only allows unique entries, but it was very slow on the insertions.
Having read the above replies, I may not have a choice on the performance and may have to stick with a set instead of buffering in a vector and then removing dups.
I Dream of Absolute Zero
|
|
|
|
|
That is what set does, except it does it in an efficient way.
|
|
|
|
|
RChin wrote:
On a similar not, I tried using std::set to filter duplicate strings, but I found this to be extremely slow.
You may find that using std::hash_set instead of std::set will be faster for storing strings, provided you have a good hash function.
- Mike
|
|
|
|
|
Thanks for the tip Michael
I Dream of Absolute Zero
|
|
|
|
|
Hi.
Have a simple class for which I want to define a << operator
to put some ints on an ostream. Something like this worked
FINE yesterday, before I just renamed my simple class:
<br />
ostream& operator<<(ostream& os, const TimMinSek& t) {<br />
return os << t.tms[TIM] << ':' << t.tms[MIN] << ':' << t.tms[SEK];<br />
}<br />
The t.tms-stuff are the ints from inside my class obviously.
I did:
<br />
#include <ios><br />
using std::ostream;<br />
in the .h-file for this operator function (and I also include it in its .cpp-file), so I can refer to ostreams just fine. The error I get is:
<br />
no operator "<<" matches these operands<br />
operand types are: std::ostream << const int<br />
return os << t.tms[TIM] << ':' << t.tms[MIN] << ':' << t.tms[SEK];<br />
----------^<br />
but it doesn't matter what else i try to feed the ostream& os,
all I can return seems to be 'os' itself! I can't feed chars
to it either, and definately not my precious ints
Ironically, I more or less copied this function from section
21.2.3 in my edition of Bjarne Stroustrup's 'The C++ language'
and I can't tell the difference between his and mine (and besides
mine worked earlier as I said). Puzzling!
Thanks for any help
regards
/Petter
|
|
|
|
|
Hello Guys,
Can anybody of you can give me some ideas or links or code about how to convert .pdf file into .txt file.
Lot of readymade applications are available on net. I don't interested in all those but I want to make my own application for conversation.
Thanking You
C.R.Naik
|
|
|
|
|
You'll need to use the PDF SDK.
|
|
|
|
|
Friends,
Suppose we pass an object of a certain class as a reference to two other classes. It means that the two classes have a "same" copy of an object. This is a type of "composition"
Now insted of "composition", i want to get the same effect using "inheritance" OR i want my derived classes to inherit from "same" base class. Same base class means that the same base subobject. If one class make any change in the data of its parent, then the change should get reflected in the second class as its parent is same as that of first class.
How is it possible ???
|
|
|
|
|
What do you actually want to do? Are you a student quoting from your exercise or something?
You should rephrase your question so it actually makes sense.
|
|
|
|
|
Consider the following code:
class Parent
{
public:
SetValue(int a)
{
m_value = a;
}
private:
int m_value
};
class Brother:public Parent
{
brother()
{
SetValue(12)
{
};
class Sister:public Parent
{
Sister()
{
SetValue(8)
}
};
As can be seen above, the two classes "Brother" and "Sister" are derived from the same base class "Parent" Both the children classes have their own copy of "Parent". If the class "Brother" makes any change in the data member of "Parent", then the change will not effect the "Parent" of "Sister" as "Sister" has its own "Parent"
What i want is that, both the children classes should share the "same" parent. And if "Brother" changes the data present in its "Parent", then the data of the "Parent" of "Sister" should also gets changed automatically as both "Brother" and "Sister" will have same subobject "Parent".
How can i achieve this goal.
|
|
|
|
|
Jamal Jamshed wrote:
How can i achieve this goal.
static int m_value;
|
|
|
|