|
I prefer the version without the pointers for three reasons:- I don't have to clean up the list myself (CList doesn't delete objects pointed to in the destructor).
- I don't have to handle indirections.
- The list has less memory-management overhead.
I'll deviate from this if I have to store references to the same object in multiple places in a list, but this is less common.
|
|
|
|
|
Hi Mike,
Thanks again.
About reason 1.: Most times, the objects that are in a list are made using a call to 'new' at some point in the code. If this is the case, then the contents of the list (the newed objects) need to get deleted at some point anyway. And this must be done by walking through the list in a loop to call delete for each item before doing a RemoveAll() on the list.
Or, do you have a methodology in coding that 'recycles' objects. That is, a variable of type CMyObject is declared and reused (has its data changed) whenever an item needs to be added to the list. Then, due to storing actual T's (not T*'s or T&'s), they are passed by reference into the CList by value (so that the declared variable can be changed for reuse to create the next item in the list). Is this what you mean? Does this mean that the destructor for each item in the list is called when the CList is destroyed?
Thanks very much,
Eric
|
|
|
|
|
Hello,
I have a question. I have a dialog style window. Is it possible to add text display box to it? I plan to display some text at run time. Thanks.
|
|
|
|
|
|
I need to write a program to run a few hundred executables, and read in their results into an array.
i've posted here, before and got help. using SHELLEXECUTEINFO i can specify the .exe and a paramater. which is really cool
but the upon executing, i get a HANDLE back
i was told to monitor the handle, but how?
i need to see the values that the .exe printf() 'ed onto the command line...
this is only a small part of the project and i dont have time to go learning all the details of handle programming...
so if anyone can help me out here it'd be soo cool
thanks
PS: i need to get this done soon, so any awnser would be great
|
|
|
|
|
|
One solution is pipe as the other member has mentioned. Check out MSDN.
http://support.microsoft.com/default.aspx?scid=kb;en-us;190351
Kuphryn
|
|
|
|
|
Dear all,
How could I calculate the execution time of a function?
I used CTime, CTimeSpan, GetTickCount but the result is always zero.
Islam Hegazy
islam
|
|
|
|
|
you could SetTimer() berfore calling the proc and KillTimer() after the proc returns. in the timer proc you can then increment a variable counting the amount of ms or secs depending on what interval you've specified.
hope this helps...
|
|
|
|
|
Hi,
This is the way to do it through the Windows API function:
SYSTEMTIME sStart, sEnd;
float fEllapsedSec, ffEllapsedSecModulu;
long lEllapsedDays, lEllapsedHours, lEllapsedMin, lEllapsedSec, lEllapsedMilliSec;
CString strFuncTime;
::GetSystemTime(&sStart);
// call your function:
func();
::GetSystemTime(&_sEnd);
lEllapsedDays = sEnd.wDay - sStart.wDay;
lEllapsedHours = sEnd.wHour- sStart.wHour;
lEllapsedMin = sEnd.wMinute - sStart.wMinute;
lEllapsedSec = sEnd.wSecond - sStart.wSecond;
lEllapsedMilliSec = sEnd.wMilliseconds - sStart.wMilliseconds;
lEllapsedHours += lEllapsedDays*24;
lEllapsedMin += lEllapsedHours*60;
lEllapsedSec += lEllapsedMin*60 ;
// the total number of seconds:
fEllapsedSec = (float)lEllapsedSec + (float)lEllapsedMilliSec / 1000;
// for gui presentation:
lEllapsedHours = ((long)(fEllapsedSec / 3600));
lEllapsedMin = ((long)(fEllapsedSec / 60)) % 60;
ffEllapsedSecModulu = fEllapsedSec - ((int)(fEllapsedSec / 60) * 60); // cant use modulu on float
strFuncTime.Format("%d:%d:%.3f",lEllapsedHours,(lEllapsedMin % 60),ffEllapsedSecModulu);
|
|
|
|
|
all of your answers are very very bad!
u have to use QueryPerformanceCounter and QueryPerformanceFrequency... there is an article on CP about calculating the CRC-32. it shows how such a timer works.
Don't try it, just do it!
|
|
|
|
|
QueryPerformanceCounter and QueryPerformanceFrequency are used for extremely high frequency timing calculations. For his needs, it is a total over kill.
Pankaj
Without struggle, there is no progress
|
|
|
|
|
You guys are all great, but also which one should I use?
islam
|
|
|
|
|
Hi.
I load an icon with the function:
HICON hIcon=(HICON)LoadImage(NULL, "C:\\Icons\\Icon.ico", IMAGE_ICON, 0,0,LR_LOADFROMFILE | LR_DEFAULTSIZE);
How can I unload the icon?.
Thanks.
REMOVE AN ICON
|
|
|
|
|
when you're dealing with
bitmaps: DeleteObject();
cursors: DestroyCursor();
icons: DestroyIcon();
BOOL DestroyIcon(HICON hIcon);
returns TRUE if sucessfull.
i hope this helps...
|
|
|
|
|
HICON hIcon=(HICON)LoadImage(NULL, "C:\\Icons\\Icon.ico", IMAGE_ICON, 0,0,LR_LOADFROMFILE | LR_DEFAULTSIZE);
...
DestroyIcon(hIcon);
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Hi;
I was just wondering if anyone here knew how to caputre joystick/gamepade input when the program window isn't active (eg, sys tray)
I tried the joySetCapture function but that can only do 4 buttons.
I'd like to be able to get all input if possible.
thanks
Zhen
|
|
|
|
|
okay, i figured out that i can get all input by using the getJoyPosEx function.
But is there a way to know when a joystick event occurs?
Or do i just have to call this function on a timer?
Thanks
|
|
|
|
|
hi, have you tried WaitForSingleObject() & co.?
|
|
|
|
|
good idea but i don't have a handler to pass to it.
There is no joystick handle, atleast i don't think so, only a joystick id.
|
|
|
|
|
Once i used gflags.exe to enable heap monitoring, then when tried to restart the system its hanging before logging in to windows.
Is there any way to reset or disable the configuration set by gflag.exe
even in safe mode its not restarting.
|
|
|
|
|
Hello,
I wrote an application that creates several frames of images that I am saving them as PPM images now. I like to create an MPEG move based on them. What are my options? Is there any MPEG encoder for MSVC 6 that I can add to my application and directly creating MPEG movies? Note that I need a free library as this is not a commercialize application.
Best regards
|
|
|
|
|
Hello, I have an urgent need to be able to display a dialog from a console application and have all console application processing halted until the user selects a button from within the dialog. Also being able to tell which button was selected. Is this even possible?? I have had partial success with the display of the dialog. However, after the ShowWindow() call, the code continues. That will not work. I have also tried creating a thread and wait but that created a wait cursor and I could not select a buton in the dialog. I am back to square one. I had even thought about just creating a dialog app, but I need "the" app to accept command line args.
Any help or suggestions would be GREATLY appreciated. Thanks.
|
|
|
|
|
Do not use ShowWindow().
Create the dialog box (CDialog) on the heap (statically), then call it's DoModal member function to initialize a modal dialog box, assuming that you are using MFC to implement this. Program execution will halt until DoModal returns.
If you are not using MFC, then you need to manually lock the dialog resource and paint your window based on it's layout. This is MUCH more difficult and time-consuming, but if you do it once, remember to save a Win32 class hiearchy and post it here to CodeProject
Tip: Create a console application that supports MFC.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Thank you very much. T:-Dhis works great!!
|
|
|
|