Failure to get handle by using GetFocus - Windows Mobile Development and Hacking General

Does anyone know how to get handle which has focus regardless of what processes it is? Many thanks
I tried to do it using GetFocus(), but it can only get the handle which is owned by its process, but not other processes.

Related

How to prevent OS exiting my applications?

Hi,
I noticed that OS constantly unloads my applications.
Say, I visit some page using IE, then switch to another application, then switch back - it is usually at the same page, but, probably depending on idle time, it sporadically gets closed.
That said, when I go to IE again, it starts afresh on its initial page and I must reload my page again. Needless to say, in most cases this is unacceptable. (extra traffic, so it costs $$, also GPRS could become unavailable etc :x )
How do I PREVENT this behaviour?
Not only IE suffers, any application! Sporadically exits despite of fact there are tons of free memory and I would better free resources with another way than just closing what is required for me.
I have elder device with PocketPC 3.0 (Cassiopeia E-125) and it does NOT behave in such a way. Does not close even it has 4times less memory! Now I understand how nice it is.
While this problem persists, I forced to have both devices with me.
Please help me solving this!
Vadim.
I've noticed the same behavior randomly also. I don't have a fix, but you're not alone.
What ROM version are you using? There was an issue with the earlier ROMS in that there were too many programs running and when you launched another program the OS would terminate a background program to provide the necesssary process space.
The newer ROMs have solved this problem, but CheckNotify and ClearNotify (search the forum) will help with the earlier ROMs.
This is an old problem, related to the number of running processes.
Consult this thread
http://www.ppcw.net/?itemid=1645
which will show you how to solve it. Also the newer roms cut down on the number of processes at startup, which helps.
Surur
Mine is much more random than that described. Sometimes I can have a half dozen apps open with no problem, and sometimes a single app will close itself while I work in the phone or the Today screen.
Carlos said:
Mine is much more random than that described. Sometimes I can have a half dozen apps open with no problem, and sometimes a single app will close itself while I work in the phone or the Today screen.
Click to expand...
Click to collapse
Don't forget that we are talking processes, not appications, here. One app. may have many processes and multiple app's may use the same common processes. Therefore, launching one application can generate a number of new processes and that can push you over the limit (e.g. ActiveSync, which launches three or four I recall), so something gets nuked.
I understand, and was looking for a pattern, but there is none. In fact, it seems reversed, as it happens more often while I'm just out and about and less frequenty while the device is in the cradle. Very often it happens after a fresh boot with a single app running.
I may look at it more closely with a process viewer. It's not bugging me enough to make it a priority.
Thank you all for providing many help!
surur said:
This is an old problem, related to the number of running processes.
Consult this thread
http://www.ppcw.net/?itemid=1645
which will show you how to solve it. Also the newer roms cut down on the number of processes at startup, which helps.
Click to expand...
Click to collapse
That explains it all, many fruitful comments, and a prove that there could be no fix but just temporary solutions to reduce a problem a bit.
It is a bit larger problem in my case, because I use special sotware to support Russian.
Too bad MS can't recognize and fix such a big design mistakes.

Killing Background Processes

After playing around with a process manager, I have found out which processes I can happily kill without effecting any of my applications.
Killing these processes speeds up responsiveness of my device, and the difference is most noticable when rotating the screen.
My question is...does anyone know of a program which can take a 'snapshot' of running processes, and automatically flush any that aren't in that snapshot, rather than me having to go and close them one-by-one? "Sman" used to do this on my old P-Series SonyEricssons so I'm sure it's possible, but after trawling through PocketGear, Handango, Freewarepocketpc, etc I've drawn a blank.
Any ideas greatly appreciated. In the meantime, I seem to be using my process manager a LOT!
hmm
I installed checknotifications, this is actually for 2003 devices but i thought lets give it a go..
It found 39 events???????????????????????????
on my mda 2 i had 9-12
and it found loads of red events. sddeamon based.. hmmmmm
tried to clear it but that doesn't do anything.
hehe
UPDATE ok got it down to 21 events after ticking both options in settings, made the mda pro a bit quicker.. but still to many events i think?

synchronization objects

I want to know if there is any disadvantage to using a lot of event/mutex objects. What is the limit to the number of them a program can have?
I find myself using a lot lately and my code is getting very dependent on them. I want to know any downside before its too late.

Help with memory leak

Hey guys. I've been looking around all over for info on the problem with my app. Nothing I found was a concrete answer. here's the problem. I made an app that works really well except it force closes when I hit the back button to finish activity and then start another of the same activity as before. It force closes once in a while when I do this, throwing a log cat error that says out of memory, pointing to where I fill my bitmap cache. There's two reasons im thinking it would be doing this. 1) My bitmap factory is having a problem or 2) I have the context of my activity stored as a variable so I can close activity and that is too much memory. I'm using a panel, which also may add to the problem. Also, another phone can't even start the activity the first time. Any help would be greatly appreciated. This is only problem on app and this fix will make it market ready.
Sent from my SCH-I500 using XDA App
Did you try to explicitly clean up the bitmap references? you should call Recycle() on every bitmap in your activity's onDestroy or wherever you do your cleaning. Another issue I had was with the Bitmap.CreateScaledBitmap method - it leaks, apparently. I made a small static method that uses a transform matrix and then calls Bitmap.CreateBitmap (the overload that takes a matrix, obviously). That change alone solved half my memory issues.
The thing about not loading at all on another phone might be a heap issue. My game loaded just great on my customized SGS, but on the emulator with 24mb of heap it crashed. The reason was that I pre-load all the sprites at the beginning, and apparently 24mb isn't that much
Solution was downscaling and lowering resolution and color depth for the sprites, not much possibilities here - too many bitmaps take too much memory...
I'm guessing the phone you tested likely has a smaller heap than the phone that doesn't make your app crash.
Of course all of the above is mostly guess work, but that's what I can supply right now
i have the problem fc too, but after i upgraded to 2.2. the seem the problem fixed automatically.
Thanks so much! I made it recycle my bitmaps, along with a few minor changes, and it worked great! Thanks for your help!
Sent from my SCH-I500 using XDA App

Minimum Memory App/Settings

Hey guys,
When I had my droid charge, there was an app that could be used to setup the minimum memory of the OS so it's not using all available RAM to keep apps open in the background, which causes the phone to slow down. I can't seem to find that program so I figured I'd ask if anyone has a program like this and, if so, what settings are you using with it and how is it performing?
Any info you can provide would be appreciated. Thanks, guys!
EDIT: The program I used for the droid charge is apparently called MinFreeManager. Not sure if anyone else uses this or a similar program but I'd be interested in the settings someone is using if they do use it. Thanks!
Best to let android do its own memory management. You'll only hinder the performance by limiting the amount of available memory to the apps/system.
The Linux system is great when it comes to memory management and multitasking. Best to avoid all task killers, and the likes. Read more on how android/Linux manages memory and you'll see what I mean. I believe there were a few articles here on xda as well.

Categories

Resources