multithreaded dialog application

My application is a dialog app, with one parent dialog with spawns
several (up to 20 or so) child dialogs.  There are basically three
channels of input to the dialogs: user actions and messages that come
in on two seperate threads via socket connections.  At this point, all
the socket messages are posted to the main thread to be processed.
Nearly all the socket messages are simply passed on to a child dialog
(or 3 or 4 in some instances) to be processed.

The number of messages received from the sockets can be quite large
and since they come in on two seperate threads, I think it would be
more efficient to handle these messages in multiple threads (this is a
realtime application so we want to reduce latency in processing
messages as much as possible).  There is some calculation that is done
to process the various messages that could be pushed to a worker
thread, but nearly every message results in a UI update as well.

My understanding is that there is no safe way to update the UI from
any threads other than the main thread.  I'd like to know if this is
correct.  It's not clear from what I read, but I'm hoping it may be
possible to create child dialogs in a seperate UI thread.  If this
could be done for even one dialog, I believe we would derive
significant benefit from this.  My concern is in still being able to
link the child dialog back to the parent dialog if they are in
seperate threads.

Can anyone give some advice on what possible options I have or if I am
really stuck posting everything to the main thread?

Thanks,
Ryan

0
6/29/2007 2:04:03 PM
vc.mfc 33608 articles. 0 followers. Follow

6 Replies
348 Views

Similar Articles

[PageSpeed] 59

Ryan wrote:

> Can anyone give some advice on what possible options I have or if I am
> really stuck posting everything to the main thread?

Keep all the GUI in the main thread. What makes you think that your 
present arrangement is causing problems?

-- 
David Wilkinson
Visual C++ MVP
0
no-reply8010 (1791)
6/29/2007 3:08:40 PM
On Jun 29, 11:08 am, David Wilkinson <no-re...@effisols.com> wrote:
> Ryan wrote:
> > Can anyone give some advice on what possible options I have or if I am
> > really stuck posting everything to the main thread?
>
> Keep all the GUI in the main thread. What makes you think that your
> present arrangement is causing problems?
>
> --
> David Wilkinson
> Visual C++ MVP

I hypothesize that the high volume of messages, especially from one of
the socket connections, will eventually lead to latency in processing
the messages.  Since the different message types are by and large
processed independently by different child dialogs, there is inherent
parallelization posibilities, especially since the app runs on dual-
core/quad-core machines.

For the most part, I'm just trying to stay ahead of the curve as far
as message processing capacity goes, but I'm really worried that at
some point the UI performance will degrade with everything going
through the main thread.

0
6/29/2007 3:34:19 PM
Ryan wrote:
> My application is a dialog app, with one parent dialog with spawns
> several (up to 20 or so) child dialogs.  There are basically three
> channels of input to the dialogs: user actions and messages that come
> in on two seperate threads via socket connections.  At this point, all
> the socket messages are posted to the main thread to be processed.
> Nearly all the socket messages are simply passed on to a child dialog
> (or 3 or 4 in some instances) to be processed.
> 
> The number of messages received from the sockets can be quite large
> and since they come in on two seperate threads, I think it would be
> more efficient to handle these messages in multiple threads (this is a
> realtime application so we want to reduce latency in processing
> messages as much as possible).  There is some calculation that is done
> to process the various messages that could be pushed to a worker
> thread, but nearly every message results in a UI update as well.
> 
> My understanding is that there is no safe way to update the UI from
> any threads other than the main thread.  I'd like to know if this is
> correct.  It's not clear from what I read, but I'm hoping it may be
> possible to create child dialogs in a seperate UI thread.  If this
> could be done for even one dialog, I believe we would derive
> significant benefit from this.  My concern is in still being able to
> link the child dialog back to the parent dialog if they are in
> seperate threads.
> 
> Can anyone give some advice on what possible options I have or if I am
> really stuck posting everything to the main thread?

It's not clear what you are trying to fix.  You can't have a parent 
window in one thread and child windows in a different thread.

If you have significant latency then perhaps you have too many messages 
stacking up between the threads.  If that is the case look for ways to 
combine messages.  You may also be able to do the update painting more 
efficiently: Are you painting more than you need to paint when you do an 
update?

Your assumption that more threads would help is quite questionable. More 
threads add more overhead and reduce the time available to the main 
thread for painting.  If you have only one network interface then there 
is little or nothing to be gained by having multiple socket threads: 
Only one network message can arrive at a time.

-- 
Scott McPhillips [MVP VC++]

0
Scott
6/29/2007 3:37:22 PM
See below....
On Fri, 29 Jun 2007 14:04:03 -0000, Ryan <ryan.martino@gmail.com> wrote:

>My application is a dialog app, with one parent dialog with spawns
>several (up to 20 or so) child dialogs.  There are basically three
>channels of input to the dialogs: user actions and messages that come
>in on two seperate threads via socket connections.  At this point, all
>the socket messages are posted to the main thread to be processed.
>Nearly all the socket messages are simply passed on to a child dialog
>(or 3 or 4 in some instances) to be processed.
>
>The number of messages received from the sockets can be quite large
>and since they come in on two seperate threads, I think it would be
>more efficient to handle these messages in multiple threads (this is a
>realtime application so we want to reduce latency in processing
>messages as much as possible).  There is some calculation that is done
>to process the various messages that could be pushed to a worker
>thread, but nearly every message results in a UI update as well.
*****
Why not do the calculation in the receiving thread?  The post to the window which is
supposed to receive the data, instead of the main window.

Note that "putting the dialogs in separate threads" will be an erroneous design; MFC (and
WIndows itself, for that matter) won't work well under that kind of scenario.

UI updates MUST be in the main GUI thread.

See my essay on the use of I/O Completion Ports to avoid message pump saturation by
PostMessage (it's on my MVP Tips site).  I had to deal with exactly this problem, and that
is my solution.
******
>
>My understanding is that there is no safe way to update the UI from
>any threads other than the main thread.  I'd like to know if this is
>correct. 
****
Yes
****
> It's not clear from what I read, but I'm hoping it may be
>possible to create child dialogs in a seperate UI thread.  
****
No
****
>If this
>could be done for even one dialog, I believe we would derive
>significant benefit from this.  My concern is in still being able to
>link the child dialog back to the parent dialog if they are in
>seperate threads.
*****
And that's the problem, so it won't work.  Don't even try.  You would be doomed.
*****
>
>Can anyone give some advice on what possible options I have or if I am
>really stuck posting everything to the main thread?
>
>Thanks,
>Ryan
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
7/1/2007 3:56:45 AM
See below....
On Fri, 29 Jun 2007 15:34:19 -0000, Ryan <ryan.martino@gmail.com> wrote:

>On Jun 29, 11:08 am, David Wilkinson <no-re...@effisols.com> wrote:
>> Ryan wrote:
>> > Can anyone give some advice on what possible options I have or if I am
>> > really stuck posting everything to the main thread?
>>
>> Keep all the GUI in the main thread. What makes you think that your
>> present arrangement is causing problems?
>>
>> --
>> David Wilkinson
>> Visual C++ MVP
>
>I hypothesize that the high volume of messages, especially from one of
>the socket connections, will eventually lead to latency in processing
>the messages.  
*****
(a) do not preoptimize code until you know there is a problem
(b) the cost of doing the updates is fixed, and will cost the same if done in one thread
or many threads, so there is no saving
******
>Since the different message types are by and large
>processed independently by different child dialogs, there is inherent
>parallelization posibilities, especially since the app runs on dual-
>core/quad-core machines.
*****
Nothing wrong with computing in parallel.  I tend to use I/O Completion Ports as
interthread queues these days, so one solution if you can't do the processing in the
receiving thread is to queue up a computation request to an I/O Completion Port.  Then you
can have many service threads that simply retrieve a computation from the queue and figure
out the answer (all threads can compute all results for all computations, for example, and
the struct you are pointing to contains the information that tells the thread what
computation to do), so in a multiprocessor these computations WILL proceed in parallel.
Then all you have to do is update the UI, and that is easy enough now that the
computations are done.  Note that one possible solution in the case of multiple updates is
the "write pipe" model, where a thread handles all the updates, let's say to a single
window.  Now you get the situation where the update sequece is shown below.  Ai is the ith
value of the A control and [Tn] is a time mark for purposes of later discussion.

[T0] A1 B1 C1 D1 A2 B2 A3 A4 A5 B3 B4 A6 A7 [T13]  A8 B5 B6 B7  C2 C3 D2 A9 A10 A11
                                                          
where these are coming in at a rate faster than they can be displayed.  the "write pipe"
model works like this:

you write the sequence to the queue in real time.

The queue elements are processed by a thread (e.g., the "Temperature and Humidity Write
Pipe Handler" for the "Temperature and Humidity diaog")  It keeps the values in variables,
so that at [T13] the values are

A7 B4 C1 D1

Now you just add an OnTimer handler than every n ms (e.g., n = 250) puts in an "Update
Request" into the queue.  Suppose this appears in the queue at time [T13].  At that point,
you PostMessage to the main GUI thread.   Note that if data is just being displayed in
controls such as static or edit controls (and, for example, not being plotted) updating
the windows too often makes them flicker and they cannot be read, so this gives a certain
stability to the display.  Human perception rates being what they are, "real time"
displays simply cannot be read.  Note also that if the write pipe tracks the values it
sent, it would not need to send an update if the current value of A is the same as the
last value of A, thus reducing interthread bandwidth.
					joe
*****
*****
>
>For the most part, I'm just trying to stay ahead of the curve as far
>as message processing capacity goes, but I'm really worried that at
>some point the UI performance will degrade with everything going
>through the main thread.
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
7/1/2007 4:08:55 AM
But see my essay http://www.flounder.com/kb192570.htm on receiving network data in
multiple threads, a rewrite of the piece of crap in the MSDN.

(I also cited my essay on the use of I/O Completion ports, so here's the link to it...
http://www.flounder.com/iocompletion.htm )
				joe

On Fri, 29 Jun 2007 11:37:22 -0400, "Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp>
wrote:

>Ryan wrote:
>> My application is a dialog app, with one parent dialog with spawns
>> several (up to 20 or so) child dialogs.  There are basically three
>> channels of input to the dialogs: user actions and messages that come
>> in on two seperate threads via socket connections.  At this point, all
>> the socket messages are posted to the main thread to be processed.
>> Nearly all the socket messages are simply passed on to a child dialog
>> (or 3 or 4 in some instances) to be processed.
>> 
>> The number of messages received from the sockets can be quite large
>> and since they come in on two seperate threads, I think it would be
>> more efficient to handle these messages in multiple threads (this is a
>> realtime application so we want to reduce latency in processing
>> messages as much as possible).  There is some calculation that is done
>> to process the various messages that could be pushed to a worker
>> thread, but nearly every message results in a UI update as well.
>> 
>> My understanding is that there is no safe way to update the UI from
>> any threads other than the main thread.  I'd like to know if this is
>> correct.  It's not clear from what I read, but I'm hoping it may be
>> possible to create child dialogs in a seperate UI thread.  If this
>> could be done for even one dialog, I believe we would derive
>> significant benefit from this.  My concern is in still being able to
>> link the child dialog back to the parent dialog if they are in
>> seperate threads.
>> 
>> Can anyone give some advice on what possible options I have or if I am
>> really stuck posting everything to the main thread?
>
>It's not clear what you are trying to fix.  You can't have a parent 
>window in one thread and child windows in a different thread.
>
>If you have significant latency then perhaps you have too many messages 
>stacking up between the threads.  If that is the case look for ways to 
>combine messages.  You may also be able to do the update painting more 
>efficiently: Are you painting more than you need to paint when you do an 
>update?
>
>Your assumption that more threads would help is quite questionable. More 
>threads add more overhead and reduce the time available to the main 
>thread for painting.  If you have only one network interface then there 
>is little or nothing to be gained by having multiple socket threads: 
>Only one network message can arrive at a time.
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
7/1/2007 4:13:11 AM
Reply:

Similar Artilces:

A MultiThreading problem with mfc SendMessage
Hi, i have done my own video player which support lot's of video format.....throught direct show or own source code.... but i have a small problem with a SendMessage... User can perform 3 actions Play, Pause and Stop..... * Play launch a thread and an SetEvent(E_PAUSE) to release it because thread loop begin with a WaitForMultipleObject of E_PAUSE or E_KILL * Pause ResetEvent(E_PAUSE) * Stop ResetEvent(E_PAUSE) and SetEvent(E_KILL) and wait for Thread Terminaison throught a WaitForSingleObject of E_END The thread could be describe as : do { WaitForMultipleObject of E_PAUSE or E_KILL ...

DateTimePicker control crashes application
Hi, I have a dialog box that contains a DateTimePicker control (control is named dateTimeCtrl) to allow the user to select a date. I have added an event handler DTN_DATETIMECHANGE for the control. In the body of this event handler, I have the following code: <begin code snippet> .... SYSTEMTIME sysTime; CMonthCalCtrl monthCalCtrl; monthCalCtrl = dateTimeCtrl.GetMonthCalCtrl(); int day; int month; int year; monthCalCtrl->GetCurSel(&sysTime); sysTime.wHour = sysTime.wMinute = sysTime.wSecond = sysTime.wMilliseconds = 0; CTime cDate(sysTime); selectDay = sysTime.wDay; selectMon...

Move a dialog based application without the title bar
Hi, I have created a dialog based application without a title bar, and want to move the dialog using the left mouse button. I tried MoveWindow nut the window was streching instead of moving !!! Can anyone help me please? >I have created a dialog based application without a title bar, and >want to move the dialog using the left mouse button. >I tried MoveWindow nut the window was streching instead of moving !!! MoveWindow can resize and move the window, so you've got a coding problem. If you use SetWindowPos you can specify the SWP_NOSIZE option to have it ignore the cx & c...

Cannot insert Chart in Excel 2007 and all other Office 2007 applications
In Excel 2007, click on Insert, just click on any type of chart buttons, nothing appears. Then click on the drop-down error on any of the chart buttons, click All Chart Types, then click any of the chart type button on the right, click OK, the error "Some chart types cannot be combined with other chart types. Select a different chart type." Then go to any Office application, such as Word or Powerpoint, Insert Chart, it gives the same error. I Googled, quite a lot of people are experiencing the problem, some went to the extend of deleting the userprofile and let Windows re-cre...

font dialog box
I'm trying to reset my shortcuts, one of which is to reach the font dialog box itself rather than the subentries. In Tools, Customize, Keyboard, what do I set a shortcut for that will take me to the dialog box which let's me do character spacing, font, and other things associated? I keep getting just one facet of it. What would I do if you weren't there?! Look for the FormatFont command (in the All Commands category). Note that if you are trying to reset all of the *default* shortcuts, the Reset All button will take care of that... -- Stefan Blom Microsoft...

Multithread (3)
I've been told that if DLL exported function is thread safe (i.e. doesn't use global scope variables), than I can call that DLL function from my EXE using multiple threads. I want now to ask what about internal DLL functions (that exported DLL function calls)? Example: __declspec( dllexport ) int MyDLLFunc(int val) { addOne(val); } int addOne(int val) { return ++val; } What if multiple MyDLLFunc() (multiple threads) calls addOne()? Is this thread safe? yes, it's thread safe.....the only one problem which could occured is that your function change a data stati...

How to turn off "Application has requested runtime to terminate it in an unusual way"
This message dialog pops up in my application sometimes. How can I turn it off and just let my app crash in such case ? Thanks in advance. Tom "tom" <kamildobk@poczta.onet.pl> wrote in message news:d269bb7b-17bd-4cbf-9889-e883e72d6c36@p59g2000hsd.googlegroups.com... > This message dialog pops up in my application sometimes. How can I > turn it off and just let my app crash in such case ? You could do this: _set_abort_behavior(0, _WRITE_ABORT_MSG); http://msdn.microsoft.com/en-us/library/e631wekh.aspx ...

WritePrivateProfile multithreaded?
I'm curious if the WritePrivateProfileString function works from various threads and processes? If I have multiple threads accessing (reading/writing) a single .ini file, are there any issues? Or, does the OS handle this properly? Thanks DanB As in any multi-threaded solution, it's probably best that you use a critical section or mutex object to synchronize access to the file between the threads. "Dan Baker" <dbmail> wrote in message news:%23Vo4o%23DLGHA.2780@tk2msftngp13.phx.gbl... > I'm curious if the WritePrivateProfileString function works from vari...

application error #2
Getting the following error in Outlook 98: the instruction at "0x05eec473" referenced memory at "0x05eec473".The memory couldn't be "read. Can anybody help with this? Not without more info; Like Outlook version, mail service being used (Exchange, POP3, IMAP, HTTP, other...) and the steps you took already to try to resolve the problem. -- Roady [MVP] www.howto-outlook.com Tips of the month: -Creating Signatures -Create an Office XP CD slipstreamed with Service Pack 3 ----- "IgorR" <anonymous@discussions.microsoft.com> wrote in message news:...

Destorying modeless dialog
Hello I am very new in MFC. I have created a modeless dialog box. it well show when you click on the buttom "Show" on the main dialog form, I want to write a code for the a "hide" buttom on the main dialog form so that when you click on it the modeless box will disappear I saw this on the net but I don't know where to put it in the code. void CModeLess::PostNcDestroy() { CDialog::PostNcDestroy(); delete this; } thanks That's not hiding you are doing with that code. You are destroying it totally. To just hide it, use ShowWindow with SW_HIDE. -- ...

Help needed on CopyFile like dialog
Hello I want to make a dialog just looked like the common file copy dialog in the Windows. Does anybody know how to make it? Or, is there any Class I can use to make one? I tried to create a dialog with a progress bar on it , and it works fine. But, how to show a file transfering animate on my dialog? I mean , I'm not sure what is the right way to do that. Thanks a lot for helping. - Gideon Use SHFileOperation/FO_COPY -- Regards, Nish [VC++ MVP] "Gideon" <gideonchiang@biocare.com.tw> wrote in message news:#l9pg9kYDHA.388@TK2MSFTNGP10.phx.gbl... > He...

Multithreading
Hi, I have some experience with WORKERTHREAD multithreading. Not GUI threads. With worker threads, you have a thread function which has to be a static function (right?). To be able to access classes and variables defined outside this thread function, you pass a LPVOID and inside the function you cast it back to your class you wish to access, correct? Now, these worker thread loops can become very large. You can't use divide and conquor, by spreading it over multiple sub functions, or can you? I guess you can, but then all other functions have to be static too? Of course.. stupid q...

How to implement transparent static on dialog box?
I would implement a transparent static text to show the status text of the progress on dialog box. The background of dialog box is not default system color. Originally, I set the bk mode of the static to transparent mode and return a NULL_BRUSH in OnCtlColor() of dialog class. It can fit my requirement if the static text is not changed. However, the old text is not erased if the static text is changed. I think I need to override some function to erase background first. Which function do I need to override to erase the background? or I need to implement my own static class to do so? and how? ...

problem in making perticuler color transparent on an imaged dialog
HI frnds, I used below 3 line code to make perticuler color transparent on an imaged dialog in OnInitDiaolog(). its working fine but it makes not to work "C" file, which is been added to the project. if i remove these 3line code C file works if i keep these 3line code it makes my C file nowork. /////////////////////////////////////// HWND hWnd=GetSafeHwnd(); SetWindowLong(hWnd, GWL_EXSTYLE, GetWindowLong(hWnd, GWL_EXSTYLE) | WS_EX_LAYERED); SetLayeredWindowAttributes(hWnd,RGB(255,0,255),0,LWA_COLORKEY);//I have make pink color as transparent /////////////////////////// any ideas...

Linking Dialog box content with cells in "regular" sheet
How to link data in Edit box (from Dialog caption) with exact cells in "regulal" Sheets? Or is there another way to link exact content from Dialog sheet to normal sheet? For example, if I have number 200 in Dialog, I need that exact number 200 on another ("regular") sheet to preform calculations with it. thnx ...

Two Dialog Resources, one dialog object?
Can someone please tell me if it is possible to have two dialogs in my resource view that link to the same dialog object? or will I have to implement a 'dialog functionality' object that is called from my event methods? I want to allow my users to choose from two different sized dialogs (one large, one small) depending on their registry settings. The dialogs would essentially be the same, with identical controls, just different layouts. Alternatively, is there any way to dynamically 'scale up' my dialog whilst still allowing it to be edited in resource view? I am using Visua...

dialog box #2
how do i make a custom dialog box? any help would be greatfully appriciated thanks! Tom Ogilvy recently posted a list of resources for getting started with UserForms: http://groups.google.com/groups?&threadm=O%24VViE9UEHA.2520%40TK2MSFTNGP12.phx.gbl ash wrote: > how do i make a custom dialog box? > any help would be greatfully appriciated thanks! > -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html ...

Move controls in dialog area
Hi, Bit of a newbie to VB.NET. I'm using 2003.NET. I have a project with a number of controls, but I cannot move the controls around at design time using the Up/Down/Left/Right cursor keys. I can drag the controls around with the mouse only. What's going on here? I was sure I could do this in VS2003.NET with my VC++ projects, but now I've even opened up one of those projects and still cannot. Seems like I've changed some setting that I cannot find. I've tried (with control I want to move selected): * Pressing arrow key * Pressing arrow key + LEFT_SHIFT ...

Multithreading #2
Dear friends, I have a SDI MFC application and I would like to use a different thread to do some work when a menu option is clicked and stop it when another menu option is clicked. Please tell me, How can I do this multi-threading? Thank you. Varuna. "varuna82lk@gmail.com" wrote: > Dear friends, > > I have a SDI MFC application and I would like to use a different thread > to do some work when a menu option is clicked and stop it when another > menu option is clicked. > > Please tell me, How can I do this multi-threading? > > Thank you. > Varuna....

Debug Multithreaded DLL and Multithreaded DLL
Hi, I got an runtime error at the fstream read function each time I use Multithreaded DLL, when I change it to Debug Multithreaded DLL, my application works fine. I just want to know how can the runtime DLLs affect the work of a standard function like fstream->read!!!, any proposed solutions are welcomed. Cheers, Stargazer It could be a timing issue. The "Multithreaded DLL" issue refers only to the C library functions, and fstream is definitely not a C library function. I have seen quite different behavior between FILE * and fstream in multithreaded environments, which has le...

multithreading in openGL
Hi all, Iam doing a program in OpenGL using C. It is related to multithreading in parallel. Iam calling the create thread functions in display callback function. The code is like this.... thread1() { glClearColor(); display image1. ... glutSwapBuffers(); } thread2() { glClearColor(); display image2. .... glutSwapBuffers(); } DWORD WINAPI fun1() { thread1(); } DWORD WINAPI fun2() { thread2(); } void display(void) { ..... hthread1=CreateThread(NULL,0,fun1,&dwThreadParam,o,&dwThreadId1); hthread1=CreateThread(NULL,0,fun2,&dwThreadParam,o,&dwThreadId2); ....

modeless dialog boxes #2
I have a VS 6.0 MFC dialog-based application. The main dialog has an edit box for displaying messages as things happen. A button on the main dialog starts a modeless dialog. The modeless dialog has a 'DoIt' button which executes a long process, updating the main dialog edit box. I'm finding that the main dialog and modeless dialog are unresponsive as long as I'm in the 'OnDoIt' routine. I had thought that a modeless dialog box would essentially run 'independent' of the main dialog but that doesn't seem to be the case. What have I misunderstood? ...

How to hide the dialog in a dialog based application..
Hi, I have a dialog based application which has MFC support.. (developed from class wizard...) Now, according to the my database situation, i want to show / hide the dialog.. so, what should i do ? What i do currently is, inside, oninit i start a thread and pass a dialog pointer.. now, after 500 ms of initialization, i will call ShowWindow(SW_HIDE) to hide the dialog.. and to work in invisible mode.. but this is not a good way.. so, any other way to hide the dialog before it gets shown.. ?? My exe should run in processes but it should not show the dialog only.. Hope you understand my...

Deadlocked on lock problem in sql with multithreading
Hi, i have created a window service with multithreading, but getting many deadlocks on sql in one Stored procedure when i start this service,and after that service does not do anything but in idle mode. the details of exception is below. Error :Wednesday, September 23, 2009 2:22:58 AM Method:UPD_CrawlerLastUrl 1. Transaction (Process ID 68) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction. 2. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnect...

replacing new and delete in MFC application
Hi, I am trying to replace the new and delete functions in my MFC derived C++ application - the reason is to find memory leaks - but I keep getting a linker error saying that 'new' is already declared in mfc80.dll. I obviously have to link with mfc80.dll, but how do I replace the new function?!? I'm using MS Visual Studio Team Edition 2005. And it's a MFC C++ application. Thanks in advance. !!! I'm placing the following code in the stdafx.h file: #ifdef _DEBUG inline void * __cdecl operator new(unsigned int size, const char *file, int line) { void...