|
-
Jul 21st, 2008, 06:21 AM
#1
Thread Starter
Member
[RESOLVED] Prevent Program Process Termination and Uninstallation
Hi, I'm currently facing another problem. Using VB.NET, Windows Mobile 6 SDK, Visual Studio 2005.
My team has been facing a pretty advanced level task. I need to prevent the mobile phone user from terminating my program's process from the windows mobile's "task manager"-like interface as well as preventing them from uninstalling it.
Is there a way to do so? Please kindly give us your advices. Thanks
-
Jul 21st, 2008, 07:59 AM
#2
Frenzied Member
Re: Prevent Program Process Termination and Uninstallation
You can probably prevent uninstallation by deleting the apps unistall entry in the registry.
ShowWindow(hWnd, SW_HIDE) SHOULD hide in tasks list
-
Jul 21st, 2008, 09:47 AM
#3
Thread Starter
Member
Re: Prevent Program Process Termination and Uninstallation
Thanks, I understand the registry part, but I'm not quite sure what you meant by "ShowWindow(hWnd, SW_HIDE)". Do I need to import any libraries for it?
-
Jul 21st, 2008, 10:15 AM
#4
Frenzied Member
Re: Prevent Program Process Termination and Uninstallation
P/Invoke ShowWindow
<DllImport("CoreDll")> _
Public Shared Function ShowWindow(ByVal hwnd As IntPtr, ByVal nCmdShow As Integer) As Boolean
End Function
Const SW_HIDE As Integer = 0
ShowWindow(me.handle,SW_Hide)
-
Jul 21st, 2008, 07:38 PM
#5
Thread Starter
Member
Re: Prevent Program Process Termination and Uninstallation
Do you mean
Code:
Public Declare Function ShowWindow Lib "coredll" Alias "ShowWindow" (ByVal hwnd As Integer, ByVal nCmdShow As Integer) As Integer
and on Page Load
Code:
ShowWindow(Me.Handle, SW_HIDE)
Where as SW_HIDE is a constant?
Code:
Const SW_HIDE = 0
Const SW_NORMAL = 1
Const SW_SHOWMINIMIZED = 2
I tried this in my program but turn out our program is still showing in the memory settings and can be terminated.
-
Jul 22nd, 2008, 02:25 AM
#6
Frenzied Member
Re: Prevent Program Process Termination and Uninstallation
Has your program got a form - if so set
Me.Text = ""
That should prevent it from showing
-
Jul 22nd, 2008, 09:35 PM
#7
Thread Starter
Member
Re: Prevent Program Process Termination and Uninstallation
Thanks, that was a nice way to get pass that problem.
Is there a way I can detect changes in the registry?
Like files, thereis a FileSystemWatcher. Is there one for the registry?
Last edited by heatgutsexe; Jul 23rd, 2008 at 12:08 AM.
-
Jul 23rd, 2008, 01:29 AM
#8
Frenzied Member
Re: Prevent Program Process Termination and Uninstallation
In on of my other answers I pointed you at a video solution for that at http://msdn.microsoft.com/en-us/netf.../cc709417.aspx
That, with a bit of adaptation should do what you need
-
Jul 24th, 2008, 08:23 PM
#9
Thread Starter
Member
Re: Prevent Program Process Termination and Uninstallation
Thanks. I tried that method and it requres me to target a value in a certain key.
I already have a function that would let me find keys base on a target and delete values.
Now I need is a very general detection of registry change, as in regardless of which key or which values are changed.
Is there a way to do so?
-
Jul 25th, 2008, 02:05 AM
#10
Frenzied Member
Re: Prevent Program Process Termination and Uninstallation
Not that I am aware of - anyone else?
-
Jul 27th, 2008, 07:32 PM
#11
Thread Starter
Member
Re: Prevent Program Process Termination and Uninstallation
Ok, if that's the case, nevermind about it. Then I'll need to go for another approach using that user-defined state.
However, I need to ask, last time you gave me this code
Code:
AppPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)
to get currently running program's path as string.
Is there a similar way to get the company's name and program's name that is stated in the project and grab them as string?
As in eventually, those two strings will form the registry key when the program is installed. HKEY_Local_Machine\Security\AppInstall\<company's name><space><program name>.
-
Jul 28th, 2008, 03:18 AM
#12
Frenzied Member
Re: Prevent Program Process Termination and Uninstallation
You can certainly get it using OpenNetCF which hints that you can't get it as standard
Code:
Private Sub GetCompanyName()
' Get the file version for the notepad.
Dim myFileVersionInfo As FileVersionInfo = _
FileVersionInfo.GetVersionInfo("%systemroot%\Notepad.exe")
' Print the company name.
textBox1.Text = "The company name: " & myFileVersionInfo.CompanyName
End Sub 'GetCompanyName
Although this may help.
Last edited by petevick; Jul 28th, 2008 at 03:21 AM.
-
Jul 28th, 2008, 04:08 AM
#13
Thread Starter
Member
Re: Prevent Program Process Termination and Uninstallation
Wow, thanks alot Petevick, we really appreciate your help.
-
Jul 28th, 2008, 08:36 AM
#14
Frenzied Member
Re: [RESOLVED] Prevent Program Process Termination and Uninstallation
I hope we get credit in your project 
Pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|