|
Even if the OS will reclaim the memory, it's no excuse not to clean up yourself.
M.
Watched code never compiles.
|
|
|
|
|
Always clean up your allocated memory. Even though the OS will reclaim the allocated memory, deleting objects (C++) might have important side effects, such as releasing resources in other processes the instance has allocated on construction. This might lead to 'leaks' in other running processes. Also, if you don't properly delete allocated resources, your code will not be reusable in other applications. Cleaning up your own mess is an important part of C++. Clean up.
|
|
|
|
|
Hi all,
in my application i have generate so many threads but some time AfxBeginThread return NULL please tell me how can i identify why its return NULL.
here i m also try GetLastError() but its return "The Operation Completed Successfully"
please help me for this.
thanks in advance.
|
|
|
|
|
I'd recommend that you set a conditional breakpoint, and try to look at the call stack to see what caused the failure.
I hope you know that MFC comes with source code.
It was ever thus, the Neophiles will always rush out and get 'The Latest Thing' at a high price and with all the inherent faults - Dalek Dave.
|
|
|
|
|
Le@rner wrote: n my application i have generate so many threads but some time AfxBeginThread return NULL please tell me how can i identify why its return NULL.
It appears to me that you are generating threads "as required" in your program. Am I wrong? If not, on what conditions do you attempt to create the threads?
Also, please post the relevant portions of the code. The way you are creating the threads, I mean the way you are calling the AfxBeginthread(...), could hold a clue.
|
|
|
|
|
int in_num=0;
std::map<int, CTest_Thread*> assocs_th;
assocs_th[in_num] = (CTest_Thread*) AfxBeginThread( RUNTIME_CLASS(CTest_Thread), THREAD_PRIORITY_NORMAL, NULL,CREATE_SUSPENDED, NULL);
if (NULL != assocs_th[in_num])
{
assocs_th[in_num]->ResumeThread();
in_num++;
}
else
{
AfxMessageBox("Error");
}
|
|
|
|
|
1, How many such threads are you actually creating?
2, Are you in need of UI threads or worker threads?
3, Are you aware that you are actually creating UI threads?
4, Have you setup a breakpoint and stepped into the code while it fails as I pointed out earlier?
Also, what's the point of having an int in_num and incrementing it, because neither is it declared static, nor is it running within a loop where the incrementing happens.
It was ever thus, the Neophiles will always rush out and get 'The Latest Thing' at a high price and with all the inherent faults - Dalek Dave.
|
|
|
|
|
OK but you didn't answer the first part of my post. My questions are basically same as Rajesh's. Without knowing about those, it would be very hard for anyone to help.
|
|
|
|
|
you ask:"It appears to me that you are generating threads "as required" in your program."
yes i do
|
|
|
|
|
You seem to ignore the questions that are actually important to solve this thread. Instead, you keep on giving useless information.
If you don't provide all the details that you were asked, chances of you getting help here is bleak.
It was ever thus, the Neophiles will always rush out and get 'The Latest Thing' at a high price and with all the inherent faults - Dalek Dave.
|
|
|
|
|
First check, that you use the multithreaded c-runtime. Compiler option: /MT
|
|
|
|
|
|
That doesn't make any sense.
Without linking to the multi-threaded version of the CRT, you cannot make a call to AfxBeginThread() . The compiler will complain, because AfxBeginThread() internally uses _beginthreadex() to spawn a thread, which can be called only if you link to the multi-threaded version of CRT.
It was ever thus, the Neophiles will always rush out and get 'The Latest Thing' at a high price and with all the inherent faults - Dalek Dave.
|
|
|
|
|
Hi All,
I am getting flicker when Disable the CToolBar Buttons when ON_UPDATE_COMMAND_UI message with
CmdUI->Enable(FALSE) twice depending on some condition.
But everytime I move my mouse the grayed-out button flickers.
Un-grayed buttons do not flicker. Any Prolem whith this.
Code
-------
void CMainFrame::OnUpdateFileDeleteplans(CCmdUI* pCmdUI)
{
bool bExecuteSQLWin = false;
if(bExecuteSQLWin)
pCmdUI->Enable(FALSE);
else
pCmdUI->Enable();
pCmdUI->Enable(CheckOpenPlans()); --> Here i added with a Function CheckOpenPlans().......>==========//
}
bool CMainFrame::CheckOpenPlans()
{
CMDIChildWnd* MyWnd = NULL;
MyWnd = MDIGetActive();
CView* pView = NULL;
if(MyWnd != NULL)
{
pView = (CView*) MyWnd->GetActiveView();
if((pView->IsKindOf(RUNTIME_CLASS(CSelectQueryView)) || pView->IsKindOf(RUNTIME_CLASS(OpenPlansTreeView))))
{
MyWnd = NULL;
pView = NULL;
return false;
}
else
{
MyWnd = NULL;
pView = NULL;
return true;
}
}
return true;
}
modified on Monday, December 20, 2010 12:29 AM
|
|
|
|
|
Hi All,
I am using VC++ 6.0. I am using ODBC to connect to DB2 database. I wonder if there is any driver(connector) dedicated for VC6.0.
Thanks
Felix
|
|
|
|
|
Hi ALL,
I am using Visual C++ 6.0 studio. I want to render processing result data graphically by showing a flash to the user with FLEX technology. I wonder if this is possible.
Thanks
Felix
|
|
|
|
|
Yes it is possible. You can use Adobe Flash Player ActiveX control in ypur VC++ project. You can make use of events and methods provided by Adobe Flash Player control to communicate between C++ and the Flash file (Which is the result of compiling your Flex project).
|
|
|
|
|
in addition to what is said above, don't wonder to hear that you can call functions in your swf flash movie from C++, and events dispatched from swf can be handled in c++, using the interfaces provided by flash player activex.
|
|
|
|
|
hi
i need to know what is this class for and how can i use it. i need a simple sample plz.
thx
|
|
|
|
|
See here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
hi
thank u for the link. so it's not a separate functionality. i may not use it and still have its functionality by joining the dockable panes by hand in runtime. right?
if so, this is not what i'm looking for. i need the tab inside the pane. in another words i'm looking for a two-page pane. only one CDockablePane includes two pages of items which are selected with a tab control.
what is the best method to implement it?
|
|
|
|
|
Hi,
Please tell me how can i create a forward rule in Microsoft Outlook programmatically using MAPI.
Thanks.
|
|
|
|
|
How to Creating an action for a rule on MSDN: http://support.microsoft.com/kb/177210[^]
It was ever thus, the Neophiles will always rush out and get 'The Latest Thing' at a high price and with all the inherent faults - Dalek Dave.
|
|
|
|
|
Thanks Rajesh, I used your suggested code but it having some issues. I am using this code in add-ins application for MS-Outlook.
After using this code my add-ins disables. I did some research on code and find out that if i comment
"hr = HrStringToAction(lpSession, lpFolder, lpszAction, lpActs, &lpActs->lpAction[lpActs->cActions-1]);" code line then my add-ins enables but it will not work.
Please tell me why this "HrStringToAction" function disables my add-ins. Is any thing which i am missing. Please tell me.
Thanks.
|
|
|
|
|
Hi Jayprakash, Unfortunately I've no further idea of this. You could start a thread in the MSDN Visual C++ forum, citing the example and your issues with it. That, I think will get you a quicker reply.
It was ever thus, the Neophiles will always rush out and get 'The Latest Thing' at a high price and with all the inherent faults - Dalek Dave.
|
|
|
|