Webbrowser control not firing events depending on hosting service - webbrowser-control

I have a service that launches a new process to execute steps against a webbrowser control. This is working fine for simple things such as Navigate, Click, HTML scraping etc. Where it breaks down is firing events such as "onmouseup"/"onmousedown" etc. When running in the service these events simply do not fire. Running the exe directly also does not work. When I exercise the exact same code through a unit test however it works perfectly fine. Also instead of launching a new process if I launch the assembly in a new AppDomain it also works fine however this causes the session data to be mixed so it is not a viable option.
Does anyone know why the events fire when launched from an AppDomain but not from it's own process?

Related

How should I design a portable (one executable) WinForm GUI app and Windows Service?

I want to develop an application with VB.NET 4.7.2 Framework, using WinForms. The application must run like a service, that is, ran at Windows startup (after boot, before login). It's intended to run only on a local enviroment, and play some sound files while the local user hasn't logon yet.
My first aproach to this problem was developing a WinForm app that accepted command line args, so when it was executed without args, the GUI appeared to let the user customize some of the features of the program, and when it was executed with args, then no GUI is shown and music is played.
However, the method for detecting when login/logouts and other NT Session Events happened was by hooking a script onto the Windows Scheduler, which ended up being a bad idea, because half of the times, the program would lock up (as the Windows Scheduler would try to execute multiple times) or didn't even execute the program (because it didn't even fire up correctly the login event).
Now, I've considered remaking my code into two programs, a service that runs the code, and a GUI app that sets up the settings for the service program. My idea is to embed an executable inside the main GUI app executable, so it automatically extracts it to a folder in order to run the service program.
However, I can imagine this isn't a pretty clean solution; more so if it triggers by error an antivirus.
I would appreciate some kind of help to get this working on a much clean and safe way.
Note: The main goal of this question is to preserve the all-in-one executable format, if possible. If not, either design a way to run a WinForm app like a system service (run at Windows startup, before login), or two individual programs, one as a service and the other as the GUI program.

Chromium on startup behavior is different that launching it manually

I have a Jetson Nano that runs LXDE. After booting it should automatically start Chromium in kiosk mode and launch a web page. The web page is very simple, just adding and removing some rectangles or images based on web socket messages.
Since sometimes the DOM gets updated, sometimes not, I thought my web page has some bug. But this behavior is only on the Jetson Nano. Furthermore, when I launch the Chromium manually with the exact same parameters, I have no problem at all, everything runs as expected.
I also observed that the Chromium (the autostarted one) instantly updates the DOM correctly when I press Alt+Tab (since it is the only application, no application is really switched). So apparently nothing has happened since the last web socket message, I just press Alt+Tab, and the web page instantly is displaying the correct things. Additionally it is very difficult to bring up the developer console, pressing ctrl+shift+i for several minutes, when you are lucky it fires up the developer console. Once it is there, the web page is again working normally.
I have no idea what I can do about it. I just want to launch the Chrome so it behavior is like when I start it normally.
Currently, the autostart is done inside ~/.config/lxsession/LXDE/autostart with the line #/home/agx/dev/autostart/chromium.sh, this file is:
#!/bin/bash
sleep 60
chromium-browser --new-window --password-store=basic -kiosk --js-flags='--jitless' http://192.168.1.50/index.html
I tried to delay the start hoping it would help but it changed nothing. Same for jitless. I can execute exact this command manually in the console, chromium fires up and behaves normally.
How can I trace this one down?

Get focus of other application from Vb.net Service

I have got a vb.net windows service that runs a File System Watcher to monitor an xml file for changes, when it detects a change it will stop the screen saver running and what I would then like it to do is give one of the other running applications the focus.
I have successfully used Appactivate from a Windows Form App in the past but I think I am correct in saying this doesn't work with Windowless applications (I have tried it and it doesn't).
I have done some Googling but I can't seem to find any way of getting the focus when called from a service \ windowless app. Is this possible?
Thanks
what if you make it a single instance application? and then simply launch its .exe file? it might give focus to the other running application instead of opening a new instance.

VB.Net running as a service

I have built an application that connects to the exchange server and does some scanning tasks on the incoming mail.
Application has a form where i can start and stop scanning,give in an interval, do some other configuration, and a notificationicon in the taskbar to show hide,end and so on..
The problem is that I would like the application to start as a service, because now a user has to log in first on the server before it starts working.
I tried some tools like RunAsService, i had a service, but obviously it didn't run the application.
Of course i understeand now that when the application will run as a service, scanning will be the only thing that will happen, no forms and no notification icons.
However i do not know where to start, should i extract the scanning logic from my configuration as a separate application? What application type should it become then ?
You have two easy options.
First one just create a new Windows Service Project from your New Project button in the Visual Studio, and then just program your app.
Second one, just create a service from the service management window in your computer and add the executable file of your program. It will start running as a service (with visible windows and everything as you coded it).
You should follow this link and schedule your vb.net windows program as windows task
In Your code, at the end ,when everything gets executed you should write Me.Close() to hide your form.

How do I start a console application in one project from a web form in another project?

I have a website created in VS 2010 with .NET 4.0. There are multiple projects in the solution. In one of the projects I have a form that gives a user the option to run a console application that is in another project of the solution. (called update.exe)
I have tried just using
process.start(filepath + "update.exe")
but it doesn't seem to run.
It finds the file but then finishes immediately. I tried adding Console.readKey() to the console application so it would stay open after being called, but it was to no avail.
On top of this, I know that the console app isn't running as I have logs set up throughout the console's code and it never even seems to kick off.
Should I be calling the console app differently? (note: I am writing in VB.net)
Thanks!
Purely speculative here.. but my guess is that when the page finishes processing the process is terminated. Try having the page wait for the process to close.
My 'work-around' for a similar requirement is this:
Use the ASP page to create a CMD or BAT file on the server.
Create/write a service that 'watches' for the CMD/BAT file - and when it finds one, it runs it. The service can be written to start a process as a user.