SendKeys VB.net - 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

Related

How to generate Domino dialogboxes on traditional (non-xpages) webforms

I want to have a popup/dialogbox with an "OK" button on it that will close the dialogbox...after someone performs a task on a Domino webform. I know I used overlays in xpages before, but the current application I am maintaining was built with traditional Domino forms (lots of pass-thru HTML) and my initial attempt to build an overlay effect did not work.
I have tried using javascript code of:
var window = window.open(url, windowName, [windowFeatures]);
...but this has not been successful. No errors in debug, yet my url page does not pop up. I am hoping someone might be able to provide a snippet of what you use so I can see where I am going wrong.
The url parameter I am passing is correct, as I used an alert to show me what was going in there, but I am doing something basic wrong.
If I can answer any questions for you I can do that as well.
Thank you
The only way I know to display a dialog box in a classic Domino web application is to do just like you would on any HTML-based webpage. Either you create your own popup functionality, or you use one of the many plugins available.
When I work with classic Domino web applications, I have often added Bootstrap to it, to make things look a bit better. Then I can use either the native Bootstrap dialog boxes, or a plug-in called Bootbox.js. But there are many other ones.

Sending a command from a web-browser to an app

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).

Forms open and load very slow. Sometimes they won't open

I have a relatively small VB winforms project.
It is currently used to launch numbers hyperlinks and some apps on a server.
There are a couple functions that do all the work, but the it really boils down to:
System.Diagnostics.Process.Start("iexplore.exe", urlVar)
or if it is an app sitting on the server, the variable passed into the function appLinkVar will contain the need file path to launch the application.
System.Diagnostics.Process.Start(appLinkVar)
The "items" are stored on a SQL Local Database (.mdf)
Id, appName, appLink, appClickCount, appFavList,anddecision, which tells the function if it is calling a website or opening an executable.
Currently, there are forty rows in the database and I project 150+ in the end that need to be updated centrally and often (weekly). But that's a different question for later. The reason I added in it in this question was for insight as to why I am using a database instead of a Setting or XML file for some links. (better suggestions welcome)
My admin main form loads Visible = False and loads the icon in the system try. So you can't actually see the first form that opens. It is a hidden admin window and it's main purpose is to put the icon in the system tray. The green RJ icon - http://snag.gy/VBa6c.jpg
Then all of the app interaction is around the notify icon. Example: the app loads on hover. right-click for settings and options etc.
Once the primary form loads, on mouse over the "Primary Label" for example and the white form to the left appears and so on. Not much to it. http://snag.gy/excKr.jpg
The Frequently Accessed items is currently stored on the database called appClickCount, this will be coming off of the database and to another recommended way of storing the data. But when I initially added the database, I noticed some lag in the main form loading. It would take it 5-7 seconds to populate the Frequently Accessed Items List and so on. So I changed the code from mainWindow.show() to mainWindow.visible(). Worked great for me. opened and closed very quickly. But after some use today by a tester, the application became almost unresponsive. He clicked on the notification icon numerous times and the app failed to load. Then threw a SQL time out error. It was the end of the day and I couldn't grab a screenshot.
I need to make this more reliable.
After some discussion the other day on SO, I was talking to someone that recommended I re-write the app in C# WPF, and that is definitely the plan. But I need this thing to past testing as is in VB this week. Where can I start troubleshooting the delay in opening? What other suggestions do you have to improve the application? Do I need to have an invisible form load first so I have access to a system tray icon or is there a better way?
I have talked to quite a few people on here lately and got some really good advice, I figured I would lay it all out here and see what input you guys can give a new guy... I'm also gonna go hang in the C# room for a little bit if you have any further questions.

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

VB.Net automate flash in WebBrowser

I've passed many hours searching the web for a solution to something which seems obvious, but without results.
I need to automate a task in a Flash application running on my intranet.
I can't change the Flash application nor do I have access to the source code.
it's not a Flash movie but an application.
I can't download the swf.
I'm using a WebBrowser in a form. The Flash app is displaying without issues.
So far, I have been able to automate the task (clicking on some buttons, then inputting text and finally saving the results on a server). It works but it's not clean at all because I use hard-coded timers to wait a given action is done and then I click on very specific point at given coordinates in the application.
What I would like to do:
Avoid hard-coded timers. the Flash application takes some time to display all elements on the window (from 20 to 60+ sec). I would like to be able to detect when all elements are loaded. I tried to retrieve the text of the windows handle, but while I can retrieve the Flash hwnd, I can't retrieve the content (through messages).
In brief, instead of waiting 60sec (and not being 100% sure it's enough), if the last element to load in the Flash app has "ABC" written in it, I would like to detect it's displayed so that I can continue the sequence (click on the next button).
I'm using VB.net. Any hints to achieve that would be appreciated.
Lol. I am trying to do the same thing but with no results. You can try to see if there are POST/GET codes that can help you if the application has an online nature. Other than that you can only simulate clicks, because flash can't be easily interacted with. This is why most of the things are going to swap with HTML5 now.