.NET Framework - 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.
CallingConvention
(1)
ApiGetWindowLongA
(1)
ApiSetWindowLongA
(1)
CharSet
(1)
GWL_STYLE
(1)
SetLastError
(1)
WindowHandle
(1)
DwStyle
(1)
spuds111 replied...
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);
}
Narasimha replied...
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?
Andrew Morton replied...
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

Framework Hi folks, Consider the following code: [DllImport("winspool.drv", CharSet = CharSet.Unicode, ExactSpelling = false, CallingConvention = CallingConvention.StdCall, SetLastError = true)] private static extern int OpenPrinter(string pPrinterName, out IntPtr phPrinter, IntPtr pDefault); [DllImport("winspool.drv", CharSet = CharSet.Unicode, ExactSpelling = false, CallingConvention = CallingConvention.StdCall, SetLastError = true)] private static extern int ClosePrinter(IntPtr hPrinter); [DllImport("winspool.drv", CharSet = CharSet Unicode, ExactSpelling = false, CallingConvention = CallingConvention.StdCall, SetLastError = true)] private static extern int DocumentProperties(IntPtr hwnd, IntPtr hPrinter, String pDeviceName, IntPtr fine under CPP. Any help would be highly appreciated, TIA, Mehdi C# Discussions IntPtr (1) CallingConvention (1) CharSet (1) DllImport (1) AllocHGlobal (1) FreeHGlobal (1) Marshal (1) Int32 (1) Did you description: Hi folks, Consider the following code: [DllImport(winspool.drv, CharSet = CharSet.Unicode, ExactSpelling = false, CallingConvention = CallingConv
line ( copy from somewhere to create mouse click event ) [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] However, I can't pass complier, the error message is: = > The type oro namespace using directive or an assembly reference ? ) Best regards, Boki. C# Discussions System.Runtime.InteropServices (1) CallingConvention.StdCall (1) DllImportAttribute (1) CallingConvention (1) DllImport (1) CharSet (1) Wienhold (1) Oro (1) Try adding "using System.Runtime.InteropServices line ( copy from somewhere to create mouse click event ) [DllImport(user32.dll, CharSet = CharSet.Auto, CallingConvention =
native code from my .net app SetLastError: = True, CharSet: = CharSet.Ansi, _ ExactSpelling: = True, _ CallingConvention: = CallingConvention.Winapi)> _ The DLL works fine on localhost and production, but hangs on my test
missionname, qlffilename, id:pchar):TCharArray; export; / / My C# definition [DllImport("qn.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern char[] DiskSaveFooter(string missionname, string qlffilename, string id); / / My C# Implementation value': Invalid managed / unmanaged type combination. Any suggestions please? .NET COM Interop Discussions MarshalAsAttribute (1) CallingConvention (1) CharSet (1) DllImport (1) UnmanagedType (1) IntPtr (1) Marshal (1) Check (1) It may work if you define the function as [DllImport("qn.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static extern IntPtr DiskSaveFooter(string missionname, string qlffilename, string id); and then. . . . . IntPtr