|
hi all,
i am creating multiple objects for the same class
like calling this function as many times.
Void CMainWindow::OpenDefaultChatwindow()
{
m_dlgChatWindow = new CChatWindow();
m_dlgChatWindow->Create(IDD_DIALOG_CHAT_WINDOW,GetDesktopWindow());
m_dlgChatWindow->SetNewParent(this);
m_dlgChatWindow->ShowWindow(SW_SHOW);
}
but when i delete the object i am able to delete only one object then it is showing memory leaks
because i created multiple same objects and deleting only one object.
How to solve this problem ?
plz help in this issue
venu
|
|
|
|
|
Simply by deleting the previous object before creating a new one (that seems obvious):
Void CMainWindow::OpenDefaultChatwindow()
{
if (m_dlgChatWindow )
delete m_dlgChatWindow ;
m_dlgChatWindow = new CChatWindow();
m_dlgChatWindow->Create(IDD_DIALOG_CHAT_WINDOW,GetDesktopWindow());
m_dlgChatWindow->SetNewParent(this);
m_dlgChatWindow->ShowWindow(SW_SHOW);
}
-- modified at 10:12 Friday 25th August, 2006
|
|
|
|
|
Mmhhh, maybe I answered too fast to your question. You would like several windows opened together or just one ? If just one, see my previous post.
In the other case, you have to store all those pointers in an array and delete them afterward (or when it is needed). I suggest that you take a look at the std::vector class to store all these pointers.
|
|
|
|
|
Hi,
I want to end the EXCEL.exe process in task manager through application. Is their is any API which get the handle of process and end it .
Can anybody help me out of this problem?
Thanks:
Mike
|
|
|
|
|
See TerminateProcess(...)
|
|
|
|
|
Hi,
Thanks. But can you please elaborate it in more detail?
Thanks:-
Rajiv
|
|
|
|
|
well you have four ways.
1-see msdn
2-a lot of articles about process
3-an article from Mr David Crow about processes
4-see here
<br />
(1)EnumProcesses(this method retrieve identifier for each process);<br />
<br />
(2)hProcess = OpenProcess(PROCESS_VM_READ | PROCESS_QUERY_INFORMATION, FALSE,process identifier);<br />
<br />
(3)TerminateProcess(hProcess ,0);<br />
I hope its good for you
|
|
|
|
|
WhiteSky wrote: 3-an article from Mr David Crow about processes
Of the three that I've created, none of them are about terminating processes.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I think I see an article about processes from you,right? my purpose was it.
|
|
|
|
|
WhiteSky wrote: I think I see an article about processes from you,right?
Of the three that I've created, none of them are about terminating processes.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
no no ,I know not terminate only about processes,ok!?
|
|
|
|
|
See here.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi,
I am working with property sheets.My requirement is when I press the first tab(property page) all the controls in that page should disable.When I press the second tab,all the controls in that page should disable.
Is there any mechanism to disable all the controls in a page at a time instead of diabling each and every control of a particular page.
Thanks in advance.
Sandhya
|
|
|
|
|
SandhyaSri wrote: Is there any mechanism to disable all the controls in a page at a time instead of diabling each and every control of a particular page.
If the IDs of the controls were consecutive, you could just use a for loop. This is not without risks, however.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
If you will be enabling/disabling all the controls on a page fairly regularly, I would recommend writing a method to do it:
void MyClassPage::EnableAllWindows(BOOL bEnable)
{
GetDlgItem(IDC_MYCTRL1)->EnableWindow(bEnable);
GetDlgItem(IDC_MYCTRL2)->EnableWindow(bEnable);
GetDlgItem(IDC_MYCTRL3)->EnableWindow(bEnable);
...
GetDlgItem(IDC_MYCTRLN)->EnableWindow(bEnable);
}
And just call that method as needed.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hi,
I am trying to load images onto an MCI control. I studied the MCIWnd but wasnt able to find anything relevant.
Please help!!
|
|
|
|
|
Can you be more specific
|
|
|
|
|
Aahh WhiteSky you are to be my saviour again!
Ok, its like this--I am designing an application to play audio files and that has a Slider. Now, using MCI,i can see a slider but i would like to customise the slider to be able to show some pic or something.
Is this even possible?
On something slightly related how does one use the slider to forward/rewind the music/video currently being played?
|
|
|
|
|
(First you can see a example in MSDN im sorry i dont know its name but i think this example is in VC6.0 for show avi files and it can show length from wave files and...)
you open your file with MCI_OPEN then you can get a hwnd to mci MCI_DGV_STATUS_HWND
and you can set position form your window /you can calculate length file and convert to time
and create your slider that its better.i wrote this program but i forgot it if i can find it in my computer
i send for you
See MCI_PAUSE and MCI_PLAY
|
|
|
|
|
Hi all..
I am trying to handle TAB key on keyboard while writing in Edit box.
User has to eneter data in EditBox and when he press TAB Key then cursor has to focus on next EditBox.
So You guys helpme in how to handle tab key while cursor is focued in edit box.
Thanking You.
Sheshidar Patnam
|
|
|
|
|
sheshidar wrote: ...when he press TAB Key then cursor has to focus on next EditBox.
This is the default behavior. You have apparently added code to change that.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
sheshidar wrote: when he press TAB Key then cursor has to focus on next EditBox
As David said this is a default behaviour..
Check all the Edit Controls have the sequence tab position..
Press Ctrl+D, in the dialog during design time to change the tab settings..
Do your Duty and Don't expect the Result
|
|
|
|
|
Look up the WM_GETDLGCODE and the DLGC_WANTTAB message for details on how to alter the default special handling of the tab key. You may also be interested in the IsDialogMessage API.
Steve
|
|
|
|
|
How can I get a HBITMAP handle from a CImageList Object?
I have a CImageList Object already. And I want to change it into a HBITMAP.
How could I do so?
Thank you!
|
|
|
|
|
Have you seen CImageList::GetImageInfo ?
|
|
|
|