Terminate Biotouch apps in vb.net - anyone know the window names? - Windows Mobile Development and Hacking General

Hi there
I've been upgrading 'Touch Settings' recently to be compatible with the new HTC devices (Vogue, Touch Dual, etc.) and it's now reached the point where I really need to automatically terminate some running processes at the beginning of the app. Specifically, I need to close:
mediahubmini.exe
APlauncher.exe
QuickDial.exe
In VB.NET, I'm using a DLLImport to find the window handle and then SendMessage WM_CLOSE to close the app, but it doesn't seem to work!
Does anybody know the specific window names, or have any code examples of how to shut down these processes from within vb.net ? (a c# example is also fine)
Yours hopefully
Carlos
PS: Touch Settings is very nearly at the point now where it will automatically re-generate all the necessary cube animation (BRN) files with user-selected icons. watch this space!

Sure those are processes? I mean, if they are registered as services, sending WM_CLOSE won't help. You'll have to stop it.
I have never dealed with WinMobile services, but you could try with the following.
System.ServiceProcess.ServiceController sc2 = new System.ServiceProcess.ServiceController("ServiceName", "MACHINE_NAME");
if (sc2.Status.Equals(System.ServiceProcess.ServiceControllerStatus.Running))
{
sc2.Stop();
}
(Shouldn't be "that" much different...)

CmdKewin said:
Sure those are processes? I mean, if they are registered as services, sending WM_CLOSE won't help. You'll have to stop it.
Click to expand...
Click to collapse
Yeah, you're right, sorry, of course, they are processes. They appear as running processes in MemMaid, at any rate. Thanks for that tip, appreciated.
I'll look to see if your code translates into the compact framework. Anyone else got any example .net code?

Carlos,
If you are using the .net compact framework 2.0 or later, it provides built in support for closing and killing processes.
Take a look at http://msdn2.microsoft.com/en-us/library/system.diagnostics.process.closemainwindow.aspx and http://msdn2.microsoft.com/en-us/library/system.diagnostics.process.kill.aspx

Related

Replacement OpenFileDialog .NET v2.0

I was recently asked how to get the System.Windows.Forms.OpenFileDialog to browse through folders outside of the 'My Documents' folder on a PPC. I said that it was not possible with that dialog. So in the end I wrote this replacement Dialog, which is the start of my a library of functions/dialogs for the .NET Compact Framework v2.0.
I use the eVC4 but the person who asked for the dialog was using .NET. Having said that the code inside the new dialog uses the CF API and not the Managed objects for enumerating through files and folders. So it is quite quick.
I have also exposed a couple of classes for getting the associated icon to a file type, and returns the icon index for an imagelist etc.
This is my first attempt at writing for the PPC. Although I am a professional C++/C# programmer.
If anyone else finds this useful, and if anyone requires any additions to this library by all means let me know. I would appreciate feedback.
Good stuff bro...works like a charm
Thanks
Wow. Great thing. Many thanks.
Works great.
Works fine except that you can't list multiple filters, for example:
Code:
fd.Filter = "Text files|*.txt;*.rtf";
Doesn't work, it won't list any file. Please post if you got a fix for this. Thanks!

any help for a newbie?

Hi all, I have an o2 xda mini s and have just been able to sync it (i have a mac). 2 main questions:
1 - on the review from this site, it shows the today screen with a load of large images down the left hand side, HOW?
2 - this is the biggie, I cannot get any java games to work (2 exceptions but they stuff up the system) and whenever I try to install any programs, it says it isn't a valid ppc application (don't anyone take offence but I chuffin hate windows aaarrrggghhhhhh)
Many thanks,
Phil
Which review? Post a link or a screenshot please!
For java, you need a java runtime app. Your phone might have come with one installed, the Orange Hermes does, and you load the java apps within that app itself (the java launcher launches the java apps. Native java apps won't work on the phone without it).
If you don't have a java launcher, you can probably grab one on the ftp site. If you need more help, shout out (nicely!)
V
Hi Vijay,
The phone i have tries to use MIDlet manager but has real problems, the 2 games it will load, when closed make the system freeze, othere either won't be accepted of give an icon and won't open (screen goes white and system locks). As for the icons n the left, I have realised they are an alternative start menu.
Cheers,
Phil
Are the games you are running actually built for the phone?
For example... running a game designed to run on a Motorola V300 is probably not going to run right on your phone.

[New release] Registry display plugin

Ok, most of you may find this totally useless as a plugin, but it was a combination of a request by user Treo_newb and a desire to create a sample plugin project that could be used as a base / example for plugin writers (I plan on doing an article on codeproject.com and this will be the source for it).
What does it do?
This plugin displays a string stored in registry.
The path is:
HKEY_CURRENT_USER\Software\RegDispPlugin
Value name: DisplayString
It checks if this string has changed several times per second when today screen is shown (as the system sends refresh message to all plugins) and displays the updated message if a change occurred.
What is it good for?
First, if you write apps using mortscript or similar like the user who requested this it will let your script display stuff on today screen.
Alternatively it could be used to mark your device today with a string that isn't as easily changed as user info.
The source is basically a skeleton plugin you can use to build your own plugin on (no license / copyright to limit you) and it already has several tricks needed for the plugin to display correctly:
VGA compatibility
Text size matching system settings
Proper header in settings dialog (like on system plugins)
Proper text color when selected (according to theme)
No blinking all today screen on change
Proper resize when switching between landscape and portrait
When I was writing my first plugin I could not find all these little fixes concentrated in a single article so I had to fish for each one as the bug reports came in.
Hope you will find this little project useful.
The plugin:View attachment RegDisplay.CAB
The source (eVC 4 project): View attachment RegDisplay.zip
Thanks for this!
Thank You Lev.
Thanks, Thanks, Thanks,
You are a legend.
I was almost through with my today plugin and was trying to figure out reading registry values and all of a sudden I get a PM from u about the plugin !!!
Very Cool !!!
OK a few questions,
1. I know that WM_TODAYCUSTOM_QUERYREFRESHCACHE is called for refreshing the today plugin, any ideas about when is it called.
I read somewhere that it was 2 seconds. Is it true?
2. I saw ur code and u have exposed CustomItemOptionsDlgProc in RegDisplay.def, but when I installed the cab file the 'options' is not enabled.
I manually changed the resistry and changed options to dword = 1 and saw ur name and email address.
u might want to enable that by default so that people can notice ur work.
I am planing a commercial release of a new project on basis of this.
Thanks again,
Shailesh
First, you're welcome.
shaileshashar:
1) I ran a debug print on this message once on an iPaq 1710 and it seems to be sent several times per second. This could differ from OS to OS or even from device to device, I am not sure.
If you need specifically timed refresh, or you have an event triggered on new data, I suggest using a timer or maybe a thread that will wait on an event. You can refresh your plugin from anywhere in code by calling InvalidateRect with your window handle.
2) I messed up the cab at first, forgetting to add the Options reg value. Then when I went to upload the fix, I couldn't access the site for about an hour (no idea why, I even rebooted the PC to Ubuntu). Should be fixed now, but I will check it later again (I have to go back to XP for that).
Good luck with your program.
Suggestion
levenum said:
First, you're welcome.
shaileshashar:
1) I ran a debug print on this message once on an iPaq 1710 and it seems to be sent several times per second. This could differ from OS to OS or even from device to device, I am not sure.
If you need specifically timed refresh, or you have an event triggered on new data, I suggest using a timer or maybe a thread that will wait on an event. You can refresh your plugin from anywhere in code by calling InvalidateRect with your window handle.
2) I messed up the cab at first, forgetting to add the Options reg value. Then when I went to upload the fix, I couldn't access the site for about an hour (no idea why, I even rebooted the PC to Ubuntu). Should be fixed now, but I will check it later again (I have to go back to XP for that).
Good luck with your program.
Click to expand...
Click to collapse
Thanks for the help, will check the fixed cab.
Also a suggestion:
A custom icon could also be incorporated. You can give a option to load a custom icon next to the text in the today plugin.
I know anybody can modify ur code and do it but still.
Actually, I probably should have mentioned this in the original post but I have no intention of adding options to this thing.
This would only complicate the code and turn it in to an actual app instead of a sample project.
But by all means feel free to make suggestions. If this thing does become popular, when I am done with my other projects (like LVMTopBat) which won't be any time soon (unfortunately) I will release a separate version of this plugin with all kinds of options that can be controlled both by user (form the options dialog) and by other apps through registry.
Maybe things like text alignment, size, bold / Italic / underlined.
P.S.
The reason I put the string this plugin loads under HKEY_CURRENT_USER instead of the HKLM where the rest of the plugin registry resides is because by default the HKEY_LOCAL_MACHINE on WM 5 and higher has a security restriction. For example you can not write to it using RAPI, only by authorized (or signed) app on the device. The HKEY_CURRENT_USER on the other hand is open for all.
levenum said:
P.S.
The reason I put the string this plugin loads under HKEY_CURRENT_USER instead of the HKLM where the rest of the plugin registry resides is because by default the HKEY_LOCAL_MACHINE on WM 5 and higher has a security restriction. For example you can not write to it using RAPI, only by authorized (or signed) app on the device. The HKEY_CURRENT_USER on the other hand is open for all.
Click to expand...
Click to collapse
Thanks for the info, I never knew that.
Thank you so much! This was exactly what I was looking for!
levenum said:
...But by all means feel free to make suggestions.
Click to expand...
Click to collapse
As a frequent mortscript user I think, this great app might be even more usefull, if the string was shown in an "allways on top" message box instead of the today screen. The Today screen might be obscured by other active windows during the scripts runtime and the plugin eats precious today screen estate also while being unused, doesn't it?
In that case (of a standalone application) I would furthermore introduce some kind of termination string (or reg. value) to end the display application.
Code:
- start mortscript
- writes first string to registry
- starts display application (run)
- updates string in registry whenever appropriate
- ...
- writes termination string to registry
-> display applications self-terminates
- ...
- end of mortscript
Honestly, I already do use something comparable with mortscript (employing a conditioned sleepmessage loop and reading from the registry too), but this could be much nicer and more elegant.
Just my 2 cents... What do you think?
I think something like that would be better implemented by the mortsrit program it self.
It could be a function like MessageBox API in windows which you could then command on and off. Having it built in would save precious resources on the device that would be wasted by having an extra app run constantly in background.
This is just my thought though.
I'd suggest contacting the developer of mortscript and discussing it with him.
levenum said:
I think something like that would be better implemented by the mortsrit program it self.
...
I'd suggest contacting the developer of mortscript and discussing it with him.
Click to expand...
Click to collapse
Mort knew about that request and by chance just announced to so.
Thanks anyway.
Hello levenum,
I just joined the community. Reason being, I found your RegDisplay plug-in
You call it a sample project, but the impact is that of an awesome solution.
Great for MortScript, but equally useful in BASIC applications that write
messages to the registry which is show upon screen minimization.
I regret not being a C programmer (mainly BASIC), else I'd love to further
develop this jewel.
Your plug-in runs flawlessly in an iPAQ 210 under WM6 Classic.
Cheers and Respectful Greetings
Robert
CLSID for registry display plugin
What is the CLSID for the Registry Display Plugin? I am going to have to edit the XML file that defines my home screen in order to get the plugin to show up. I am using Facade to control my home screen, and the only plugins that it will show in its list are those currently in use in one of the XML files in the Application Data\Home folder. All other new plugins require editing the XML. Thanks for your help.
levenum said:
Ok, most of you may find this totally useless as a plugin, but it was a combination of a request by user Treo_newb and a desire to create a sample plugin project that could be used as a base / example for plugin writers (I plan on doing an article on codeproject.com and this will be the source for it).
What does it do?
This plugin displays a string stored in registry.
The path is:
HKEY_CURRENT_USER\Software\RegDispPlugin
Value name: DisplayString
It checks if this string has changed several times per second when today screen is shown (as the system sends refresh message to all plugins) and displays the updated message if a change occurred.
What is it good for?
First, if you write apps using mortscript or similar like the user who requested this it will let your script display stuff on today screen.
Alternatively it could be used to mark your device today with a string that isn't as easily changed as user info.
The source is basically a skeleton plugin you can use to build your own plugin on (no license / copyright to limit you) and it already has several tricks needed for the plugin to display correctly:
VGA compatibility
Text size matching system settings
Proper header in settings dialog (like on system plugins)
Proper text color when selected (according to theme)
No blinking all today screen on change
Proper resize when switching between landscape and portrait
When I was writing my first plugin I could not find all these little fixes concentrated in a single article so I had to fish for each one as the bug reports came in.
Hope you will find this little project useful.
The plugin:View attachment 41592
The source (eVC 4 project): View attachment 41583
Click to expand...
Click to collapse
This is great! I was asked if I could write a today screen plug-in for my weather application (http://forum.xda-developers.com/showthread.php?t=445576) - I couldn't since I don't have the skills and I'm writing .NET code - but this is exactly what I needed.
I'm adding support for this plug-in and will of course give credits to you.

Need help in killing existing processes in C#

I've been searching for hours and can't find the answer. I'm hoping someone here could help me out. I just started programming in C# and I'm trying to kill a process that already exists. I'm guessing I have to somehow do it via process name, but that's where the problems start. I've found a solution using System.Diagnositics.Process and a couple using WMI, however that function seems to only be in .NET 2.0.50727, and I don't think that applies to mobiles (please let me be wrong). I can easily start/stop another exe from with the program, just not one that the program hasn't started itself. Does anyone have a preferrably easy solution to this problem. If not, I'll gladly accept a complicated one.
Thanks.
http://msdn2.microsoft.com/en-us/library/system.diagnostics.process.aspx
says
"Version Information
.NET Framework
Supported in: 3.0, 2.0, 1.1, 1.0
.NET Compact Framework
Supported in: 2.0"
Thanks Rudegar. That's some good info, however that class only works for processes created by the program. What I'm trying to do is kill a background process (or multiple instances ) that's already running. If I use this technique to create then close/kill the process, it creates a duplicate and closes that one, leaving the original process(es) running.
The functionality I'm looking for seems to be missing from the compact framework, so I'll probably need to use the WMI through a DLL in the OS (which I did to call for a soft reset), so I'll have to figure that one out.
EDIT: Looks like this class has a few other features I need to check out. I'll do that this afternoon as the golf gods are calling me right now
direct link is here
http://www.codeplex.com/MobilePE/SourceControl/DownloadSourceCode.aspx?changeSetId=11259
indirect link here, you need to download 11259
http://www.codeplex.com/MobilePE/SourceControl/ListDownloadableCommits.aspx
Sorry, can I request that you rename this thread to include the keywords "Kill Process"? Thanks!

Checking the total number of processes

I am planning to write a today plugin or service that will prompt me if the number of processes are larger than a specific number, so that I can close any active program before it is killed by the OS deliberately.
Anyone can give me an idea? is it possible by today plugin and can I trap the event like creating process so I can check the number of processes? Thanks
Probably you should start telling others what software are you intended to use for the program.. and possilby your current ppc programming level (i.e. have you written any ppc software etc).
Actually trapping (hooking) CreateProcess would be tricky mamiac (hope I spelled it correctly) has some code on this here somewhere.
Simply getting a number of processes is relatively easy. Just do a search on "ToolHelp" APIs and you will find what you need.
If you are looking for a C++ example of a today plugin check out the RegDisplay link in my signature.
Thanks. I'll have a look at it.

Categories

Resources