CallingConvention
(1)
ApiGetWindowLongA
(1)
ApiSetWindowLongA
(1)
CharSet
(1)
GWL_STYLE
(1)
SetLastError
(1)
WindowHandle
(1)
DwStyle
(1)

osk.exe

Asked By Narasimha
18-Apr-07 05:02 PM
I am trying to use the osk.exe which is the Windows On Screen Keyboard
control in my C# application. While the application works, I also want to be
able to remove the menus and the form controls so that the user cannot
actually use any of the menu options on the keyboard control but only use the
key pad. Is there any way I can do that from within my code like create a
wrapper that will suppress them. Basically I want the OSK to look like a
windows form but with the FormBorderStyle set to None. The only thing the
user should be able to do other than click on the letters and use the keypad
should be to move it around.

osk.exe

Asked By spuds111
18-Apr-07 06:57 PM
On Apr 19, 7:02 am, Narasimham <Narasim...@>

Not sure if this is the best way but it was the only way I could find
try the following (c++)

[DllImport("USER32", EntryPoint="SetWindowLongA",
SetLastError=true,
CharSet=CharSet::Unicode, ExactSpelling=true,
CallingConvention=CallingConvention::Winapi)]
static int apiSetWindowLongA(IntPtr WindowHandle, int Index,
int NewVal);

[DllImport("USER32", EntryPoint="GetWindowLongA",
SetLastError=true,
CharSet=CharSet::Unicode, ExactSpelling=true,
CallingConvention=CallingConvention::Winapi)]
static int apiGetWindowLongA(IntPtr WindowHandle, int Index);




private: void RemoveMenu()
{int WS_SYSMENU    = '\x80' << 12;
int GWL_STYLE = (-16);
int dwStyle;
dwStyle = apiGetWindowLongA(Handle, GWL_STYLE);
apiSetWindowLongA(Handle, GWL_STYLE, dwStyle &=
~WS_SYSMENU);
}

Thanks for the update.

Asked By Narasimha
19-Apr-07 04:34 PM
Thanks for the update. This certainly gets rid of the options to close th
window. Would you also know of any mechanism where I can play around with the
Menus and perhaps remove the options I dont want the user to see?

osk.exe

Asked By Andrew Morton
20-Apr-07 11:31 AM
If you make a copy of osk.exe (preferably with a different name to avoid
ohno seconds) then you can open it in VS (File->Open). From there, you can
play around and delete parts of the menus.

However, I doubt if you'd be allowed to distribute such a hacked version.

Andrew
Post Question To EggHeadCafe