March 28, 2024, 04:12:08 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Windows 10 users (a little test)

Started by Andy, August 18, 2018, 06:06:23 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

August 18, 2018, 06:06:23 AM Last Edit: August 18, 2018, 06:23:32 AM by Andy
Hi,

For those of you who are on Windows 10 (64 bit) I wonder if you could do a little test for me please.

Here is a simple program with one button which is a keyboard bitmap image loaded onto it (bitmap attached).

Can you tell me when you click on the keyboard button if it opens your on screen keyboard?

AUTODEFINE "off"

window mainwin
OPENWINDOW mainwin,0,0,500,300,@CAPTION|@SYSMENU,0,"On screen keyboard",&mainhandler

'On screen keyboard
CONTROL mainwin,@BUTTON,"",200,90,50,25,@CTLBTNBITMAP,1
SETCONTROLTEXT mainwin,1,GETSTARTPATH+"keyboard.bmp"
WAITUNTIL mainwin = 0
END

SUB mainhandler(),INT
SELECT @MESSAGE
CASE @IDCLOSEWINDOW
         closewindow mainwin
         end

CASE @IDCREATE
CENTERWINDOW mainwin

CASE @IDCONTROL
SELECT @CONTROLID
CASE 1
IF @NOTIFYCODE=0
system "osk.exe"   'On Screen keyboard
ENDIF
ENDSELECT
ENDSELECT
RETURN 0
ENDSUB


Thanks,

Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Egil

Did not work on my win10/64 laptop... sorry.
Screendump below says "Unable to start On-Screen Keyboard" in norwegian.


Egil
Support Amateur Radio  -  Have a ham  for dinner!

billhsln

August 18, 2018, 11:52:03 AM #2 Last Edit: August 18, 2018, 11:55:35 AM by billhsln
Windows 10 Pro laptop with touch screen, program comes up, clicked on keyboard icon, nothing happens.  Put in messagebox's and it is going thru the code, just does nothing.  Went to DOS command prompt, did OSK.EXE and it did bring up the keyboard.

Tried: system "C:\\Windows\\System32\\osk.exe"   'On Screen keyboard

Still did nothing.

Bill
When all else fails, get a bigger hammer.

Brian

Andy's code worked for me OK, without any alteration

Brian

Andy

August 18, 2018, 10:36:54 PM #4 Last Edit: August 18, 2018, 11:07:33 PM by Andy
Thanks guys for that.

Bill / Egil,

Could you have a look for me please and tell me does 

OSK.exe exist in your C:\Windows\SysWOW64 folder?

If so, could you try changing the System path in the program to C:\Windows\SysWOW64 to see if that works.

I've also just read that you can use cmd.exe to invoke OSK.exe, but at the moment I can't test that as I can't remember the switches needed.

Thanks,
Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Egil

QuoteOSK.exe exist in your C:\Windows\SysWOW64 folder?
If so, could you try changing the System path in the program to C:\Windows\SysWOW64 to see if that works.

The file exists in that folder, but changing the system path does not help, neither does doubleclicking the filename from within that system folder.
So I'm starting to beleive that there is something with the system setup on my laptop blocking such calls.

My screen is not touch sensitive, so maybe it only works with such screens???


Egil
Support Amateur Radio  -  Have a ham  for dinner!

billhsln

Mine exists only in C:\Windows\System32.  There are no parameters required when I ran it from the command prompt, but it did work from the command prompt.

Bill
When all else fails, get a bigger hammer.

Andy

Thanks guys again for that.

Could you try amending the system path to:

C:\Windows\Sysnative\osk.exe

I've read that this is a special (hidden) folder that allows 32 bit applications to invoke 64 bit ones.

At least that's what I've just read.

Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Egil

Support Amateur Radio  -  Have a ham  for dinner!

Andy

No it doesn't Egil, just been to my friends with 64 bit Win 7, no luck there either.

I need a way around this, maybe a batch file or something?

We must be able to start the on screen keyboard program some way surely?

Any ideas anyone?

Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

fasecero

This works for me but it can have wac problems if it is not handled by the shell


$INCLUDE "windowssdk.inc"

SUB ShowScreenKeyboard() ' WIN LOGO + CTRL + O
keybd_event(VK_LWIN, VK_LWIN, 0, 0)
keybd_event(VK_LCONTROL, VK_LCONTROL, 0, 0)
keybd_event(0x4F, 0x4F, 0, 0)
keybd_event(0x4F, 0x4F, KEYEVENTF_KEYUP, 0)
keybd_event(VK_LCONTROL, VK_LCONTROL, KEYEVENTF_KEYUP, 0)
keybd_event(VK_LWIN, VK_LWIN, KEYEVENTF_KEYUP, 0)
ENDSUB

Andy

Thanks Fasecero,

Not sure how to implement what you've posted?

I have found a free alternative 32 bit virtual keyboard program which can be installed on 64 bit windows and executed from any IWB program.

So that's one way around it, but still curious to find a way to invoke the osk.exe in a 64 bit environment.

I tried creating a batch file:


@cecho=off
cd "C:\"
cd "C:\Windows\System32"
start osk.exe
exit


I called it "key.bat" and placed it on the desktop.

Clicking it worked, but again calling it from the SYSTEM command didn't.

Andy.


Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

srvaldez

it could be a permission problem, recently I installed VB6 on Windows 10 and while testing out one of my programs, it failed to run because of the use of SendKey, apparently Windows considers that a security risk.

Andy

Yes, you are right, it could be a permissions problem.

Just thought it was much easier to install a free alternative on screen keyboard with no issues.

Thanks,
Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

fasecero

Quote
Not sure how to implement what you've posted?

Just call ShowScreenKeyboard() and the keyboard should show appear on the screen if you have the same keyboard shortcut to open it :) (WIN LOGO + CTRL + O).

I did some research and this is what I have found. Your code is not working because the System32 directory is reserved for 64-bit applications on 64-bit Windows. To access that folder from 32 bits you must disable the "file system redirection" briefly, do what you want and then enable it again. The following code is only for 64 bit system:


$INCLUDE "windowssdk.inc"
$INCLUDE "Shlobj.inc"

OPENCONSOLE
PRINT

CoInitialize(0)
ShowScreenKeyboard()
CoUninitialize()

PRINT
PRINT "Press any key to exit"
DO:UNTIL INKEY$ <> ""
CLOSECONSOLE

SUB ShowScreenKeyboard()
pointer ptr
istring szPath[MAX_PATH] = ""

IF _Wow64DisableWow64FsRedirection(ptr) THEN
ExpandEnvironmentStrings("%windir%\system32\osk.exe", &szPath, MAX_PATH)
SYSTEM szPath ' ShellExecute (0, "runas", szPath, "", "", SW_SHOWNORMAL)
_Wow64RevertWow64FsRedirection(ptr)
ENDIF
ENDSUB

DECLARE Wow64DisableWow64FsRedirectionTemplate(pointer ptr), INT

SUB _Wow64DisableWow64FsRedirection(pointer ptr), INT
UINT hInst=LoadLibrary("kernel32.dll")

IF hInst THEN
UINT proc = GetProcAddress(hInst, "Wow64DisableWow64FsRedirection")

IF proc THEN
RETURN !<Wow64DisableWow64FsRedirectionTemplate>proc(ptr)
ENDIF

FreeLibrary(hInst)
ENDIF

RETURN 0
ENDSUB

DECLARE Wow64RevertWow64FsRedirectionTemplate(pointer ptr), INT

SUB _Wow64RevertWow64FsRedirection(pointer ptr), INT
UINT hInst=LoadLibrary("kernel32.dll")

IF hInst THEN
UINT proc = GetProcAddress(hInst, "Wow64RevertWow64FsRedirection")

IF proc THEN
RETURN !<Wow64RevertWow64FsRedirectionTemplate>proc(ptr)
ENDIF

FreeLibrary(hInst)
ENDIF

RETURN 0
ENDSUB


if the SYSTEM command fail (it can) you need to start the process as administrator using ShellExecute + "runas"

ShellExecute (0, "runas", szPath, "", "", SW_SHOWNORMAL)

Also, Windows 10 has a new on screen keyboard but to use it you need to implement IValueProvider/ITextProvider COM objects in your control to achieve this but this is a very advanced topic.

Andy

Fasecero,

Thanks, you have put a lot of work into this and it is greatly appreciated!

This is an advanced topic, one that shouldn't need to be as any 32 program really should be able to open something as simple as the built in on screen keyboard.

After considering what's been posted, I have decided to go with the free virtual keyboard, it just keeps life simple, but thanks to all for your suggestions.

Thanks,
Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

fasecero

No worries. This is a hobby to me and I enjoy a lot playing with this stuff no matter how crazy it sounds. It has become so much easier with the passage of time and I had had the best teachers anyone could hope for in the past. That soft it's probably your best bet if the license allows its redistribution for third-party usage.