View Full Version : problem with minimize\restore trick

11-21-2006, 05:35 AM
hi all i am developping, with visula studio 2005 and c#, an application which use mappoint...and in the main form i have an activex control which gives the possybility to a user to navigate, zoom the map in the control....

so there is the memory leak of mappoint : the memory grows without stopping after a lot o f zoom...

i have read about the trick of minimize and maximize so i have imported the user32.dll and i send the windows message minimize(code 0xF020) and restore (0xF120) ...the question is: to what handle have I to send the message?

i have tried to send to the mainForm and to the activex1 but i have not seen any grown down of memory in task manager...

please can you help me?

11-21-2006, 08:16 AM

Possible it does not work always. What happens if you do this:

WindowState = FormWindowState.Minimized;

11-21-2006, 08:31 AM

WindowState = FormWindowState.Minimized;
no with this code i don't have any decrement of the memory usage...

you say that not always the trick works but if i open the microsoft mappoint program (not my application but the Microsoft one) the trick of minimize restore works...only with my application this isn't useful...

I have also tried this...usinge the findwindow function i have search for the window named Map - Microsoft MapPoint Europe...which is the one my application use in background as resulte of the inizialization of the activex control..the trick decrese the memory but then there are problem, after the calling to minimize i have the mappoint application in the system tray..and then if i recall the sendmessage to minimize no useful behaviour for the memory...

How can i solve this memory leaj of MapPoint is impossible to use it in a good professional application if it contiues to eat memory...

do you have any solution ?

11-21-2006, 01:16 PM

I never have run out of memory with my applictions using mappoint, however I must say that the applications that run 24/7 are creating an instance if nececary and destroy it after a while if no one needs it anymore. As for the desktop applications I think most people shut it down once a while because lots of programs leak memory. So I did a test.

Did a zoom in / zoom out in a timer every half second. At start MP needed 25 MB, climing up after a few minute to 55 MB. After 10 minute it was 56.7 MB, after 20 minute it was 58 MB. All with a zoom every half second.

So I agree there is a leak, but I dont think many (if one) customar will see it or having trouble with it.

11-22-2006, 02:41 AM
thanks a lot for your care...

i think that i don't use any control, and if i would find that some customers have a problem i'll build up a memory control...

best regards