If it was possible with XP, then it should be with Vista - not sure about the implications though. There may be some differences with the API calls used ( as we have established in some of your earlier projects ). Otherwise you can post it here ( if you want ), and we can help test and identify the issues we encounter.
Yeah, I'm back from a 3-4 month stint.
Working on the next generation of human to computer input devices and all. Button-less mouse.
This project is really awesome, and helpful.
It includes my newest SendKeys module as well.
Basically it's a USB device that uses laser emitters, to detect hand or foot movement.
It was originally designed to help the handicapped, with shaking disorders, or amputees missing fingers, hands, or arms.
However, gamers and online Virtual realities(WoW, SL...) can also use it,
since you can set the laser triggers to just about any sequence of keyboard/mouse strokes or combos.
Oh, and then I added other available events like Delay, SnapToWindow(mouse), and WaitFor different things to happen first before moving on to the next event in the chain list.
Regular users can now automate almost anything.
Sure, wannabe hackers could use it too, but that does not justify keeping the handicapped, handless anymore.
The mini osk, is just icing on the cake, so that they don't have to switch between a normal mouse, and a virtual one during logoff-in.
Nifty auto-login feature too.
I guess my question is more specific to windows services.
Is it not hard to get a windows service with user interface, to show up in the login window?
While on the subject of keyboard input, here is a little tid bit that comes in handy for osks:
Code:
Const HWND_LASTACTIVEWINDOW As Int64 = 8975651603260375040
Private Declare Function apiSetActiveWindow Lib "user32" Alias "SetActiveWindow" (ByVal hWnd As Int64) As Int64
apiSetActiveWindow(HWND_LASTACTIVEWINDOW)
I guess there are some API's that really should be used with 64 bit in mind.
You could use Longs too, but then you'd get flamed for it. lol
This is somewhat a rare exception, and it doesn't even match it's own description.
The SetActiveWindow function activates a window. The window must be attached to the calling thread's message queue.
I wasn't aware that the last window was attached, since you always must use AttachThreadInput for external windows. Hmmm. Cool.
BTW, I'm using a mouse hook to avoid focus from even reaching my osk.
However the titlebar must accept focus, so I call the SetActiveWindow API, only when the mouse enters the client part of the form.
Button presses never recieve the mouse down, so it's smooth like the real thing.
I guess I'm on the right track using motion detection to control a PC.
It just made total sense to me.
Okay, well I just tried to install the osk service on Vista.
It doesn't want to run the service, unless you manually use InstallUtil.exe.
Then the service runs on boot, but does not show it's user interface.
Apparently, it's not so easy. Jeesh, I wonder why.
The main osk works on Vista though.
I would like to get some beta feedback, from Vista/7 users.
If you have xp, and would like to try this on screen keyboard(BETA), then it should work with no problems.
By default, the option for installing the osk on boot, is unchecked, so you will have to check it.
There is a hidden benefit to using it, besides the obvious keyboard functionality.
When you are at the welcome screen(boot), the system is logged on.
This program has a couple extra features, that allow you to open the task manager, msconfig, or launch any other program using ShellExecute.
This is great for killing some of those spywares or viruses before login.
I took a screenshot of the welcome screen.
I put it on the systems desktop, and the computer could not find it at all, when I was logged in, as a user or admin.
So, I went back into the welcome screen, and sure enough, there it was sitting on the systems desktop.
I copied over to my desktop, and here it is:
Installed files
Service name: LOGONCMD.EXE (IBM Touchboard in the ADD Remove Programs list. xp only)
Service Application: TOUCHBRD.EXE (vb6.0 for speed and reliability during logoff.)
Main Application: OnScreenKeyboard.exe
Minor Application: OSKMini.exe
MS Voice packs: Sp5TTIntXP(ADD Remove Programs. xp only)
Last edited by TT(n); July 23rd, 2009 at 01:25 PM.
You must change permissions of the key, which means also taking ownership first.
Then you can modify the reg key's path to start your osk instead.
I assume you can start any app by re-directing that path.
However, I still must navigate to the accesibility options(bottom left) at the welcome screen.
My regular windows osk, does not show up unless you coax it. Common little buddy,... I said start up.
I've read that some people, can't get rid of the osk, and some have to hunt for it.
Sounds like a small bug, because when I clicked apply she says cancel instead.
EDIT UPDATED:
There is an administror setting hidden in the accessibility section, to apply to all desktops or something.
That's why people have to hunt for it, and some accidently turn it on, and can't get it off. heheheh
Might as well have a laugh, for everytime that kind of thing happened to me. Uhhg
In fact I only just recently found that hidden checkbox, all by itself, on some other page off to the side of the config area.
I really hate the Vista/7 hair-brained control panel.
For example, I didn't know that you can click small or large icons, and THAT brings me to a more classic look.
I would have expected just small or large icons that are currently showing. Not an entirely different view.
Who was the idiot behing the keyboard sleeping, when that was written?
The following registry key turns the osk on/off boot.
On
Code:
Dim regkey As Microsoft.Win32.RegistryKey
regkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows NT\CurrentVersion\Accessibility", True)
regkey.SetValue("Configuration", "osk")
regkey.Close()
Off
Code:
Dim regkey As Microsoft.Win32.RegistryKey
regkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows NT\CurrentVersion\Accessibility", True)
regkey.SetValue("Configuration", "")
regkey.Close()
The pointer to the osk, resides in this key:
"hkey_local_machine\software\microsoft\windows nt\currentversion\accessibility\ats\osk"
You can change the osk executable being pointed to like this:
Code:
Dim regkey As Microsoft.Win32.RegistryKey
regkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows NT\CurrentVersion\Accessibility\ATs\osk", True)
regkey.SetValue("ATExe", "osk.exe")
regkey.SetValue("StartExe", Environment.SystemDirectory & "\" & "osk.exe")
regkey.Close()
You need to have full administrative access to this key before setting it.
You may need to gain ownership, in order to get full administrative access to the key. Post 12 offers possible solution
___________
Last edited by TT(n); August 5th, 2009 at 03:58 AM.
It works fairly well. Main problem: the keyboard appears and works for the password but then does not appear after startup, even when I click on a test entry field.
I've got one questions.
Did the main app, appear in the users startup menu?
Did it run at all during a session? Manually started from the program list.
Some security programs may prevent it from being placed in the startup menu. I'd have to respect that.
If not, then I'll have to kill off the mini osk, so that the main osk can load/run without issue after logging in.
They must be interfering with each other.
Works fine here, but that's why I wanted to test on other machines.
Vista beta soon,
Shane
Last edited by TT(n); July 25th, 2009 at 03:10 PM.
I killed the VHD of Windows 7, and so did the my tester, so I can't test it, yet. I will after August 6th, when I get the new bits. I'll try it on the old hard drive after I back it up. I'm running RC right now, but it's my production machine.
I'll slate the beta for august.
Plenty of time to work things out.
I've been on quite a few wild goose chases, trying to find out how to programmatically take ownership of a registry key.
Mainly because Vista/7 uses TrustedInstaller, as the default owner, even though admins are fully allowed ownership!
If you do not take ownership, then some registry changes will throw an error, even for admins.
I couldn't get the framework or API to work, as legend has it.
No clear full examples online either.
If anyone can figure out a solution with the framework, then you get 10 brownie points from me.
An API solution would involve RegSetKeySecurity.
A Framework solution would involve,
But, I found a reliable solution, using microsofts subinacl.exe. http://www.microsoft.com/downloads/d...displaylang=en
You may take ownership only if you are logged in as a user/administrator.
Add subinacl.msi to your project.
You may have to change the .msi extension, so that the IDE accepts it as a file, then rename it(.msi) when the app opens.
I changed mine to subinacl.msi.exe.
Example(take ownership and full control over Vistas registry key for the on screen keyboard):
Code:
Public Class Form1
Private progFiles As String = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
RenameFiles("subinacl.msi.exe")'Take off the dummy extension
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TakeOwnership("hkey_local_machine\software\microsoft\windows nt\currentversion\accessibility\ats\osk")
Threading.Thread.Sleep(0) 'Ownership may take a second or two, so full control would fail, if you are not the owner yet.
TakeFullControl("hkey_local_machine\software\microsoft\windows nt\currentversion\accessibility\ats\osk")
End Sub
Private Sub TakeOwnership(ByVal keyName As String)'Take what's rightfully yours
If IsSubInACL() = False Then Exit Sub
keyName = """" & keyName & """"
Process.Start(progFiles & "\Windows Resource Kits\Tools\subinacl.exe", "/verbose /regkey " & keyName & " /setowner=builtin\administrators").WaitForInputIdle()
End Sub
Private Sub TakeFullControl(ByVal keyName As String)'Take full control after you are the owner
If IsSubInACL() = False Then Exit Sub
keyName = """" & keyName & """" 'Wrap in quotes otherwise "windows nt", will fail because of the space.
Process.Start(progFiles & "\Windows Resource Kits\Tools\subinacl.exe", "/verbose /regkey " & keyName & " /grant=builtin\administrators=f").WaitForInputIdle()
End Sub
Private Function IsSubInACL() As Boolean 'Make sure it's installed if not then do so quietly
If IO.File.Exists("subinacl.msi") = True AndAlso IO.File.Exists(progFiles & "\Windows Resource Kits\Tools\subinacl.exe") = False Then
Process.Start("subinacl.msi", "/quiet").WaitForInputIdle()
End If
For i As Int32 = 1 To 4
If IO.File.Exists(progFiles & "\Windows Resource Kits\Tools\subinacl.exe") = True Then
Threading.Thread.Sleep(400)
IsSubInACL = True
Exit For
End If
Threading.Thread.Sleep(1000)
Next
End Function
Private Sub RenameFiles(ByVal fName As String) 'Strips dummy extension off
If IO.File.Exists(fName) = True AndAlso IO.File.Exists(fName.Substring(0, fName.Length - 4)) = False Then
FileCopy(fName, fName.Substring(0, fName.Length - 4))
End If
End Sub
End Class
While on the subject of Vista ownership, I found a sweet little tool to take ownership of folders.
This avoids the annoying Vista permission errors for administrators.
It adds the item: Take Ownership, to your right click menu.
I'm logged into Win7 RC(32-bit) now, and both osks are working perfectly!
Found a large bug, yet not critical with Win7 RC(32-bit).
The "minimize all" button on the lower right corner needs to be re-written.
Problem:
If a window has "border style none", it messes up the entire process, leaving some windows showing, and some not.
Then if you try to manually minimize the left behind windows, they cause the already minimized windows to be restored to normal. Huh?
Exactly backwards of what was intended.
Then non-related windows toggle each others window state.
Overall, I'd have to give Win7RC a grade of B+.
It's much snappier than Vista so far, and the visual haze is much clearer.
I rarely ever see the infinite circle,.....looping endlessly....
I didn't like the default permission settings, which are a touch worse than Vista.
I could not download things where I wanted to, without jumping through extra hoops.
The control panel is now more miss-organized and miss-categorized than ever before. And there is no classic style this time.
I wouldn't even call the old style classic, it's just one that worked logically.
In closing Win7 is the first real operating system since xp, but it's got it's quirks.
The setup options are pretty handy huh.
Especially the Nothing Beneath option, which works better than AlwaysOnTop.
Although you could use both at the same time, you'll find that the osk takes up it's own unique piece of real estate,
and so AlwaysOnTop rarely applies to begin with.
This avoids other windows overlapping the keyboard(vica versa), which make it harder to interface the computer.
Is there a way of launching the OSK from within a program ?
ie, Click a Button - eg, "ON SCREEN KEYBOARD"
Sure, in Vb6 you could launch the osk with the Shell("path", vbNormalNoFocus ) function.
In .net you could use Process.start("path")
Many other ways I use too.
I think that was what you were asking, but if you need more specifics let me know. For example if you need help obtaining the path or something.
I would also need to have .Net Framework Installed - which version is minimum ?
This was written with VB.NET 2005, so .NET framework 2.0 or higher.
I don't recommend 3.5, as it slows my machines way down, and causes all sorts of side issues and glitches.
Ironically, I ended up re-writing a vb6 version of the mini osk, just in the last few days.
.NET apps, are just not capable of smoothly handling the windows bootups, and logoffs.
vb6 however has such a low overhead that the window immediately responds to exactly
what it is supposed to be doing. Not some wonky .NET behavior.
It's not a question of doing things right, the .NET way either.
Even basic .NET apps(hello world) will have irratic behavior during the boot processes.
vb6 is the smart, reliable, stable solution in this isolated case, and not some fall back crutch.
Good programmers will know this, and know when to occasionally
rely(not resort) on vb6 as a professional, when appropriate.
Originally Posted by George1111
Hi TT(n)
Recently completed one myself in VB6 (not as commercial as yours)
Many thanks
Looks pretty good.
How are you handling the mouse presses and keyboard focus?
----------------
Last edited by TT(n); August 5th, 2009 at 03:55 AM.
Is there a way of launching the OSK from within a program ?
ie, Click a Button - eg, "ON SCREEN KEYBOARD"
Sure, in Vb6 you could launch the osk with the Shell("path", vbNormalNoFocus ) function.
In .net you could use Process.start("path")
Many other ways I use too.
I hunted for OnScreenKeyboard.exe but cant find it
What is the program called and where is it installed ?
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.