|
|
|
How do i set the parent window as parent to the dialog? In the CreateDialog, i give it a parent window, but i can still use the parent window even when the dialog isn't closed.
|
|
|
|
|
Now this is turning into a game
|
|
|
|
|
Rama Krishna wrote:
Now this is turning into a game
Yup.. and that message wasn't easy to reply to.
Cheers, Marc Click to see my *real* signature
|
|
|
|
|
thanks
Thanks for what?
Or are you trying to ask a question?
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Thanks for reading my thread.
|
|
|
|
|
Hi,
I have a Visual C++ ActiveX control and a VB project who is using it and I would like to know how I can pass an object from the control to VB.
The VC++ control "knows" that object from #import but I cannot write it as a parameter type because it's not a COM standard.
I have used a VARIANT type to pass the object to the Control from VB and it seems to work, but I just can't figure out how to make it work the other way around.
Any help would be appreciated.
Thanks,
|
|
|
|
|
O.k. Thanks for nothing. I just figured it out.
I just use LPUNKNOWN and then after casting it i copy all the data.
|
|
|
|
|
Hi all,
So I have a list< double* >, which contains arrays which were created with something like new double[4]. When I'm done with the list I need to free all of the elements. At first I tried this:
list< double* > ::iterator it = my_list.begin();
while( it != my_list.end() )
delete [](*it);
but that didn't work, with MFC saying the pointer was still valid, I think because the list still contained references to the element.
So I figured the best way would be to walk thru the list, removing, then deleting, elements as I go. But I'm a little unsure about the behaviour of iterators in this situation. For example after the following code:
list< double* > ::iterator my_it = my_list.begin();
my_list.pop_front();
Would my_it stil be valid? Where would it be pointing to?
I need to figure out the quickest way to safely []delete all elements in the list.
Any pointers?
TIA,
Pete
|
|
|
|
|
Doh!
this code:
while( it != my_list.end() )
delete [](*it);
should have been:
while( it != my_list.end() )
delete [](*it++);
I guess I'm too used to good old for loops
well, I can now just run thru the list, deleting all the elements, then just delete the list.
This is probably the quickest way.... right?
Pete
|
|
|
|
|
Try the following:
list< double* >::iterator i;
while ((i = my_list.begin()) != my_list.end())
{
double *p = *i;
my_list.pop_front();
delete [] p;
}
|
|
|
|
|
That looks like it would work, but I'm not sure if it's the quickest way to do it, calling begin() every time...
|
|
|
|
|
I like to use something like:
while ( ! my_list.empty() )
{
delete [] my_list.front();
my_list.pop_front();
}
Best regards,
John
|
|
|
|
|
Yeah, that looks nice
Do you think it'd be quicker this way...
for( i = my_list.size(); i >= 0; i-- )
{
delete [] my_list.front();
my_list.pop_front();
}
Im guessing the lack of a function call would speed it up, what do you think?
Pete
|
|
|
|
|
The speed difference would be insignificant. The members of list are generally inlined, so don't add any function call overhead.
John
|
|
|
|
|
>>The speed difference would be insignificant.
Whereas the time wasted while I try to understand my 'efficient' function in two weeks would be significant... I think I'll go with your version
Thanks John
|
|
|
|
|
My original reply was written assuming that you can't change the type of the list.
If you can change the type of the list, I would do that instead.
I would use:
list< vector< double > > my_list.
Then, when you erase any elements inside the list, the vector will automatically clean up after itself.
John
|
|
|
|
|
I _could_ change the type, but it would be more [bureaucratic] effort than it's worth.
Thanks anyway,
Pete
|
|
|
|
|
For future reference though, a vector of doubles in a list would have been a much nicer solution. I usually delete pointers if I need to carry them ( because of polymorphism ) using a for_each and a function object that calls delete on everything in my container.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
|
|
|
|
|
Even I don't see much sense in storing double* instead of double in a vector. It will also cause Heap fragmentation and your code may cause more page faults as each double may be scattered all over the memory. Unless you have very important reason against it, change it to double.
|
|
|
|
|
Well, it seems that it would be worth the effort, based on all of your posts. I shall get to it...
Thanks for the advice everyone
|
|
|
|
|
Hello. This problem has been plaguing me and I can't seem to find an answer. I am programming a Win32 App using the Win32 API. I am using MCI to play a midi and I need to figure out how long the song is. Does anyone know how to do this or can anyone direct me to a resource that would show me? I've tried many things but I just can't seem to figure it out. Thanks in advance.
|
|
|
|
|
Have you tried searching on google for information on the MIDI format?
|
|
|
|
|
Yes, and I've read it too.
|
|
|
|