How can i keep focus on my own application or regain it when lost in delphi? [duplicate] - api

I need to create a simple Delphi application, kiosk style.
It is a very simple thing, a single form where the user writes some personal info to register to an event. 4 TEdit and a TButton.
What I want to achieve is to avoid the user does any action different then typing in TEdit or clicking on the TButton. For example I don't want he does ALT TAB (switchin applications), pressing windows key on keyboard, doing ctrl-alt-canc, etc...
I can add a passowrd protected Button that enables/disables this "Kiosk mode", in this way as I need to exit the kiosk mode I simply press that button and exit.
How to achieve this "kiosk mode" in Delphi without intercepting all the keystrokes manually? Or did anyone already develop this so it can be shared?

I think you'd better create a new desktop, and run your app in there. When your app is done, you can bring back user's desktop. That is how Windows login screen works. Of course Windows login screen uses a special secure desktop. Your app in a separate desktop would be isolated. You will have a desktop background with no start menu, taskbar, or desktop icons because explorer.exe is not running there automatically. Of course a can start a new process, using Task Manager, but desktops in Windows are securable objects; therefore, you can make restrictions if you want. Of course if your app has sufficient permissions.
To create a new desktop, you can use CreateDesktop Windows API, and to switch to the newly created desktop, you can use OpenDesktop function.

You can try Change the Windows Shell.
When you start windows, you don't execute the default shell (explorer.exe), you can execute your application.
Al internet you can find alternative Shell (more attractive) to default windows like:
BlueBox or
SharpE
This option is used for purposes similars at the application that you are developing. Kiosks or TPV.
For change the default applicacion you must modify a registry key:
In Win3.x and Win9x, SYSTEM.INI file:
[boot]
shell=MiAplicacion.exe
In Win2k and WinXP, use Registry:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
Shell=MiAplicacion.exe
If you test this option, think the mode to turn the configuration to the original value (button or option). You must reboot to test changes.
ADDED: In addition, if you search on the web some similar at this "Delphi Change default windows shell", you can find more code, samples and information about this.
Regards
P.D: Excuse me for mistakes with english.

Well but if someone can open the taskmgr he could just create a new task and run explorer.exe from there so its not really secure though...
Ok Taskmgr can be stopped with policies...
Well and for disabling the cad sequence you can use saslibex which Remko Weijnen had created you can find it here: SASLibEx
kindest regrads,
s!

Related

App modeller, Identify button not showing up in blueprism spying

I am creating calculator VBO in blueprism object studio.
In application modeller I gave calc.exe path and able to launch calculator, but I am not getting identify option to spy on any element..
In Element, After clicking Launch buttion, identify is appearing for a split of sec and Launch button is coming back instead of Identify
PS- As mentioned in videos and links, I have launched calc via application modeller not directly via windows..
I am using windows 10, BluePrism V.5.0.11.0 versionenter image description here
Windows 10 calculator is complicated case, please consider using different application in your training. For example paint is much simpler to get started.
If you really need to get that going, then you may need to launch application first, using one object, and afterwards use second object to attach and interact with it.
can be two reasons
1. Either your application is not launched properly.
2. Sometimes we face problems with some versions of applications.
The best way to fix your problem is
Edit your settings remove the application path from the navigate stage.
Launch the application separately
Open Navigate stage > Action > Attach
Provide the window title within quotes (example: "Calculator")
Click OK then run the object
Now if you go to application modeller
You will be able to see the identify button under the element.
Hope this will help you.
I resolved this by unchecking "Disable invasive techniques (hooking)".
The Windows 10 calculator runs with process name win32calc which is also located under c:\windows\system32.
So when you launch the application please make you identify the applications process name and its location
I resolved this by circumventing to windows 7 calculator instead of a windows 10 calculator on windows 10.
Link to download win 7 calculator for win 10-
https://winaero.com/download.php?view.1795
This will be installed in the same place as your default calculator.
Inside-
C:\Windows\System32
The name of the app in my case was "calc1.exe" to avoid collisions with the default calculator.
I used this as my base reference app for spying and it worked.
Also note, the hover to highlight button seems to be a bit buggy, try a bit hit and trail to get you required button to be highlighted and mark using "Ctrl+LeftClick"

Show Networks Flyout (the "connect-to-network" thingie) without explorer.exe running

Requirements:
Our application replaces the usual windows shell (explorer.exe). This is a product requirement for a closed system that we're supplying.
We oughtta let the user select a wi-fi network and connect to it.
The problem: The wi-fi networks dialog only shows up when explorer.exe is running
What we tried:
Write our own wi-fi manager that uses wlan API. It lists connectible networks and allows the user to connect/disconnect. Problem: too many network types/configuratons that have to be tested, especially when the wheel has already been invented and reinvented all over.
Try and check how is the networks dialog implemented. It appears that it's and undocumented COM interface (IUIRAdioManager). Problem: it's undocumented, so no API
Use an existing network manager, for instance the one that comes with the driver. Problems: it's ugly, not to the product's taste; and it opens too many options for the user, like creating and loading profiles, browsing for files on a file system - these things are unacceptable.
Running explorer.exe just for the purpose of showing the networks dialog and then killing it. Problem: once we run explorer.exe - it pops up metro view and hides our fullscreen application or shows the taskbar.
The latter seems like the preferred solution: no need to reinvent the wheel, it does what's needed. Just gotta make explorer.exe not pop out, keep it quiet in the background.
So, we're down to two options:
How to show the networks flyout dialog without explorer.exe?
How to run explorer.exe without it popping out metro or taskbar above our application?
Your first solution would be incredibly difficult to implement. I am almost certain that the Networks window is dependent on explorer.
However, your second is entirely possible.
To hide the taskbar, you will need to find a window (using FindWindowEx) to find the taskbar (name is Shell_traywnd). This will hide the taskbar and start button. EDIT: Unless you are implementing your own taskbar, you might want to set the taskbar to autohide.
Next you will need to hide all of the metro programs. In a similar fashion as above, find the class named EdgeUiInputWndClass and close it. You should be able to get the process name of it and then kill the process.
Windows key. This is a little more difficult. You will probably need to use a program and delete the key or a keyboard hook (a low level keyboard hook) and just ignore key presses with the same scancode as the windows key. Left Windows is 0x5b and Right is 0x5c (source). Note that this will not block Ctrl+Alt+Del.
Finally, to show the Flyout, you can run %windir%\explorer.exe shell:::{38A98528-6CBF-4CA9-8DC0-B1E1D10F7B1B}
(source).
EDIT2:
You should also be able to hide toast notifications via this
Of course, I don't see why you cannot just use Windows 8/8.1 and put the app in kiosk mode.

How to disable the CTRL key in vb.net

I have written a program for work that kills windows explorer (effectively hides desktop icons, taskbar and start menu) so no users can access the internet from our machines, this works well as most machines are touch screen so no keys can be pressed and no access to OSK, but to go a step further I am needing to disable the CTRL key when explorer is not running (Killed in my program) then enable it when they are back (Active in my program).
I've searched Google and seen a lot of ideas but none seems to work, i've got a timer that kills task manager if it starts up, the reason i need to stop CTRL is incase a keyboard is present on the machine i need to stop any shortcuts from being activated and they mostly seem to use the CTRL key.
I know they might be other short cuts but the guys who use my machines aren't the brightest bunch of people in the world but they might be one that 'is reight good ont tinternet'.
Cheers for any advice
Mark
You should look into Kiosk mode.
Here is an example of enabling it in Windows 8.1:
Enable Kiosk Mode in Windows 8.1
If you are still using Windows 7, there are workarounds, like this one:
Creating a Kiosk Machine with Windows 7 and Two Free Applications

The form fails to popup in windows 8

I have a chat application written in VB.net which is used to chat between users who are connected in LAN inside a office . The application popups whenever user gets new chat message. It works fine in windows XP. But sometimes in windows 8 the application fails to popup the chat window. So my chat window is not appearing at the top when popup occurs for new messages.
I have tried using setwindowspos, form.Show(), form.BringToFront() which can bring the form to topmost. But sometimes this will not work properly.
So is there any other method other than those three(which i have mentioned above) i have used which can make the form popup and bring it to front.
Your WinForms app is a desktop application, so it's likely that the reason the pop-up is not being displayed in Windows 8 is because the desktop is not visible.
Remember that Windows 8 brings with it a whole new Start Screen interface and relegates the desktop to an alternate mode. All desktop applications still run, but they run in this separate mode and cannot interact with the new Metro applications (or whatever they're calling them nowadays). Yes, it's too bad that the usability folks at Microsoft didn't listen to Larry Tesler and have decided instead to mode us in, but c'est la vie.
So anyway, the pop-up is still being displayed, but it's being displayed on the desktop, which is not visible. Bringing it to the top isn't doing any good because it's already at the top of all the other windows on the desktop. If you click on the "Desktop" tile in the Start Screen, you should see your window.
Fixing this problem is going to take some work. Forcing a focus switch to the desktop mode is a horrible idea from a usability perspective, and I'm not sure it's even possible. A better solution would be to look into using Toast notifications instead, which can be done from a desktop application.

Get keyboard keyPress in windows service (vb)

I am working on a windows service application that required to get the barcode reader characters and saving the value in database, I have tried some methods like this one:
http://www.codeproject.com/Articles/7294/Processing-Global-Mouse-and-Keyboard-Hooks-in-C
But they not working in the windows service app, does anyone knows how can I get the keyboard/barcode reader characters in the windows service?
Appreciate the help in advance,
Regards,
As already mentioned you can't get access to the keyboard and screen from a windows service in Windows platforms starting from Vista (the interact with desktop setting is no longer supported)
So you are better off just writing a standard application that launches when a user logs into the workstation.
Since most barcode readers function like keyboards your other problem will be determining when a barcode has been entered as opposed to normal keyboard activity. Either using some kind of attention sequence (like clicking on a tray icon) or timing the speed of characters (barcode characters will appear to be "typed" very quickly)
Your global keyboard hook will work just fine from a user-mode application too :-)
Happy coding