Sending a command from a web-browser to an app - vb.net

I want to be able to send a stream of data from a user computer to a web-service. That should not be too hard - I would use an application written in dot-net that resides on a user's Windows computer.
However, the tricky part is that the stream-of-data should only be sent (by the app) when the user clicks on a button or a link in a WEB PAGE that is open in his browser. The app itself would be minimized in the system tray. And he should be able to stop the stream by clicking on a stop-button (or link) in that web page..
So I found some info on stackoverflow that says that you can put a link in your page, something like: [a href='alert:"Hello World" ' ] and if you register your application (in this example the app would be called "alert.exe") in the registry, then when the user clicks on the link, he will cause the application to start, and to receive "Hello World" as a parameter.
Anyway, there are complications in my case. I want to be able to tell the application when to start sending data, and when to stop sending data, without starting new instances of the application. If the user clicks START, and the app is already open, I don't want it to open again. I do want a message to go saying "start sending" and if the user clicks on a STOP button (or link) to say "stop sending". The user might click on these web-page buttons several times in a session, and I don't want to close and reopen the program each time.
So a couple of questions:
Am I taking the right approach? Would "plug-ins" be a better idea?
If I am taking the correct approach, is there some way to send commands from a web page to an application?
Is it safe to have my app modify the registry of user computers?
If so, is there a set of commands for doing that?
Is the registry supported by Windows 7, Windows 8, etc? I know it is not supported on a Mac.
Thanks in advance.
LL
P.S. (the info on launching apps from your browser was at: http://msdn.microsoft.com/en-us/library/ie/aa767914%28v=vs.85%29.aspx).

Related

How to handle external applications in a selenium-test?

I am writing a test that verifies that a warning to the user before the user opens a document. If the user says that they still would like to open the document, the document opens in an external application (pdf or word).
But now I have an external application over the browser window, and it messes up for other tests.
So, what are the best practices around this kind of issue? Rewrite of the appliction to allow for not opening documents in test?
Added description:
The problem is twofold.
1) It starts processes (word and acrobat) that fills the desctop and requires resources from the test-slave
2) The external process seems to interfer with other tests since (guessing here) it is located over the browser window.
what i understood from your post is, the document(word/pdf) is opening in the browser window hence you are not able to proceed with further steps. If so, you can verify the Title to make sure the document is opened in browser window and can navigate back using below snippet.
driver.navigate().back();
Hope this helps.
What I understand from the line
'But now I have an external application over the browser window, and it messes up for other tests.'
is that once user clicks on open button a new window opens up (Window based application) since you have mentioned PDF or Word.
You can use robot class in such cases, below code snippet will close the current active window:
Robot rbt = new Robot();
rbt.keyPress(KeyEvent.VK_ALT);
rbt.keyPress(KeyEvent.VK_F4);
rbt.keyRelease(KeyEvent.VK_ALT);
rbt.keyRelease(KeyEvent.VK_F4);
Make sure you deal with sync issues properly so that intended window is closed instead of AUT.

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

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!

SendKeys VB.net

Hi ive developed a application that works with my site by using
SendKeys.send("{ENTER}") to submit info on one of my forms.
Is there a way to stop it from running outside the application?
For example im trying to run the program in the background and when im browsing my facebook or on google it randomly keeps hitting enter.
Any help is greatly appreciated thanks for your time.
The short answer is to look at the windows available for a process and check the titles to see if it's the page you want.
If System.Diagnostics.Process.GetProcessesByName("firefox").MainWindowTitle = 'My Page Title'
...
End If
That said, there are much better ways to do this - If you're using firefox, look into GreaseMonkey, if in Chrome, look at TamperMonkey.
Both allow you to inject custom javascript into any page whose url matches a pattern you choose. In effect, you could write some Javascript to submit a form (say) 30 seconds after page load.
This would have the benefit of working if a different tab is selected as well as not requiring a whole application.
The SendKeys.Send method will indiscriminately send the key stroke to the active application. There is no way to use this API to target a specific application.
You could change your app to try and verify the active application is the one you want to send keys too. This is destined to be a flaky process though. No matter how good your verification is it's always possible that the active app is switched to another app after your verification completes.
If VerifyActiveAppIsTarget() Then
SendKeys.Send("{Enter}") ' Active app could change before this runs
I would persue a different solution for sending data between my apps

Back button overriding in windows phone for webbrowser/view

I am implementing a simple webview application with only one url. I have over ridden back button function for webview navigation (which is working fine). Now my app has only one screen with webview and user visits the links inside main url and navigates using back button.
I want to know that, What is Microsoft Certification Policy as my application has only one screen so should it Close when user press back button anytime? Or Microsoft allows implementing of webview with over ridden back button functionality.
If question is still unclear Kindly tell me. I'll explain more but I need to know answer to this question.
Thanks.
You shoulld be fine, I have submitted applications which works like that myself which passed certification.
As long as the application quits when pressing the back button when there is no more "history" for the webbrowser control it shouldn't be a problem because the user still get the experience of moving "backward" in his use and can finally quit the app.
Regarding WebBrowser control and content of the app please consider this requirement:
"Your app and metadata must have distinct, substantial and legitimate content and purpose. Your app must provide functionality other than launching a webpage."
So, the application's sole functionality must not be only to launch a website.
This is not releated to back button but very important thing that need to be considered!
Best regard

How can I have my own settings menu in my windows application?

I have created a windows service to perform certain task on regular basis. Now I want users to change few parameters by themselves. So user should be able to right click on the service and click on settings and a form should appear. On save button all the values should be saved to the app.exe.config file.
Does anyone have any tutorial or any reference website?
1) Users NEVER right click on a Windows Service. WS are by definition programs that run in background.
2) You can create a service controller, a windows form application that interacts with the service and sends commands like pause, start, stop, etc. Implement your user interface in such controller.
You can start reading this post:
http://msdn.microsoft.com/en-us/library/d56de412(v=vs.100).aspx
Good luck!