webbrowser disable script debugging in Visual Basic 6 - vb6

I want to disable script errors from popping up in a VB6 application. (I have VB6 installed on this machine).
Currently, if I navigate to a particular page, it pops up saying "INternet Explorer Script Error: An error has ocurred in the script on this page" ... "Do you want to continue running scripts on this page?"
Setting the webbrowser1.silent to 'true' does not work. Instead all that happens, is instead of displaying an error message, it starts up the actual 'script' debugger, and then exits the program. On a machine without the (visual studio) debugger, it still pops up a message asking to use the debugger, i.e., on Vista, (when silent is set to true).
Manually changing the 'disable script debugging (other)' (and regular one), doesn't seem to working in MSIE (also testing version 6.0 for xp users).
How do I disable script errors?
Thanks in advance!

WebBrowser.ScriptErrorsSuppressed = True
(The above code will Not work in VB6)
(Try this instead)
WebBrowser1.Silent = True

The webbrowser.silent can be reset to true when the application is run if you've set it in the design window. You may have to reset it to true when starting the application (ie: at runtime) and see if that works.

I Think It's That You Need
Write This Code In Your Form_Load Or Everywhere You Want
WebBrowser.ScriptErrorsSuppressed = True

Related

Avoiding "Press any key to continue" when running console application from Visual Studio

When running a console application in Visual Studio via "Start without Debugging" (Ctrl+F5), the console remains open at the end of the run asking to
Press any key to continue . . .
thus requiring to activate the window and hit a key. Sometimes this is not appropriate.
Why this matters:
At the very moment I write json serialisation code, my workflow goes like this:
adapt c# code
run a console app that writes file out.json
view out.json in the browser with a json viewer
do this again and again, no need to debug anything, just trimming serialisation and check output is good.
It is workflows like this, where the "press any ..." behavior is hindering as it requires the steps
activate the console window
press key
.
No answers:
Starting the application outside VS in a separate console is not an answer.
Saying, you dont need this.
I'm pretty sure that you cannot affect or change this behavior.
As you mention, it has nothing to do with your application itself, because it doesn't do it when you double-click on the EXE. You only see this effect when you run the app from within Visual Studio without the debugger attached.
Presumably, when you invoke Ctrl+F5, Visual Studio is running your app in a particular way that causes the console window to remain open. I can think of two ways it might be doing it:
%COMSPEC% /k "C:\Path\To\YourApplication.exe"
or
%COMSPEC% /c ""C:\Path\To\YourApplication.exe" & pause"
With either of these, the pausing behavior you're seeing is baked right into the command used to launch your app and is therefore external to your application. So unless you have access to the Visual Studio sources, you're not going to change it. Calling an exit function from your app won't have any effect because your app has already quit by the time that message appears.
Of course, I can't see why it really matters, aside from an issue of curiosity. This doesn't happen when you start the app with the debugger attached, which is what you'll be doing 99% of the time when you launch the app from the IDE. And since you don't ship Visual Studio along with your app, your users are going to be starting the app outside of VS.
In response to the updates made to your question, the best solution would be to change your app so that it is not a console application. This behavior doesn't affect standard Windows applications; when they get closed, they close for good.
If you do not require any output on the console window, then this is very simple to do: just change the "Application type" in your project's properties. A Windows Forms application will work just fine. If you do not display a window (aka form), one will not be automatically created. This is the difference between regular Windows applications and console applications, which always create a console window, whether you need one or not.
If you do need to display output on the console window, you have a couple of options:
Create and use a simple form with a ListBox or ListView control. Each line that you would normally output to the console, you add as a new item to the list control. This works well if you're not using any "advanced" features of the console.
P/Invoke and call the AllocConsole function to create a console that your Windows application can use. You do not need a form for this.
I found a solution that works if you are using python (I could not test anything else).
You need to go to
Tools -> Options -> Python Tools -> Debugging
Uncheck Wait for input when process exits normally.
I hope you can apply this somehow to your problem.
2020 UPDATE : Microsoft has listened.
It also closes the console in "Start Without Debugging" mode ;)
The setting is a little buried, but works :
Well, at least in Visual Studio 2010, typing
Console.ReadKey(true);
Removes the "Press any key to continue....."
According to the VS2019 documentation:
Automatically close the console when debugging stops: Tells Visual Studio to close the console at the end of a debugging session.
It works, but only if you make sure your project starts with the debugger on. This sounds trivial, but I was trying at first with a solution with two projects, one Console one to copy files to use in my app, the other to run the actual app. I set the Console one to Start without debugging because I don't need debugging on it, but that did not close it after it ran. Only when setting it to Start (with debugging) this option worked.
In vs2017 you have to uncheck the python environment setting under the vs-options:
in german: Auf Eingabe warten, wenn der Prozess normal beendet wird

How to disable IE8 script error message?

I'm using CodedUI on IE8, and get this error message:
Stop running this script?
A script on this page is causing your web browser to run slowly.
If it continues to run, your computer might become unresponsive.
I've read some forums and did the following: Tools > Internet Options > Advanced tab > Browsing
Check the "Disable script debugging (Internet Explorer) checkbox
Check the "Disable script debugging (Other) checkbox
Uncheck the "Display a notification about every script error" checkbox
and this message still appears...
Can anyone assist me here?
IE has a registry setting for that
Error message: "A script on this page is causing Internet Explorer to run slowly"
but that requires you so change the registry on each client machine and for each user.
It will however allow you script to run so you can profile it and find out whats causing the delay.
Also look at this SO question How to mimic effects of MaxScriptStatements (i.e. prevent “A script on this page is causing Internet Explorer to run slowly”) without changing the registry?

Using GlobalFlags to call vsjitdebugger with VS2010

I've upgraded to Win7 and VS2010. Previously on Win2K and VS2008, I used GlobalFlags to debug an application on startup, simply by setting it's debugger to vsjitdebugger - see the screenshot below. Unfortunately, this doesn't work on my current setup - a google and search of SO haven't turned up any answers.
Thanks in advance.
UPDATE: Forgot to mention that my global flags settings do seem to have some effect - running my command on the command line causes Windows to say the program has crashed - it works just fine without the global flags. This is leading me to think my command line for the debugger is incorrect - but that's just a guess. I'd be interested in hearing from anyone who's got this to work.
alt text http://img825.imageshack.us/img825/3538/55489547.png
Running the 64-bit version of Windows 7? Using the 32-bit version of gflags.exe?
You can also edit the registry directly. An example .reg file for notepad.exe:
REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe]
"Debugger"="vsjitdebugger.exe"
Run the VS2010 on Win7 with administrator privilege, "vsjitdebugger.exe" works fine.
It looks like there's an extra step in Win7 which I wasn't expecting - it throws up a "MyProgram has stopped working" screen first. If you look at the details, it says it's an application crash.
You get the options:
"Check online for a solution and close the program"
"Close the program"
"Debug the program"
Clicking debug then pops up the vsjitdebugger dialog and all is well.

MS Access 2003 does not enter into debug mode and ignores breakpoints

I developed a small VBA procedure in MS Access 2003 module (just one public Sub)
The database is locked for me only, nobody else has access to the file.
My code works but there is a small bug I want to find and fix
I need to debug my VBA code. I put breakpoint at the first line of the procedure.
However, when I run this code, it never stops at the breakpoint and never enters to debug mode. Seems like VBA debugger is not working or disabled. I was not able to find any option how it is possible to disable/enable VBA debugger, I supposed it should be always enabled. Now I can debug this code only with the help of putting a lot of message boxes, but it takes a lot of time...
Please see:
ACC2002: Breakpoints Are Ignored in Visual Basic for Applications Code
Enable the Use Special Access Keys startup option.
To do so, follow these steps:
Open the database in which the breakpoint has been set.
On the Tools Menu, click Startup.
In the Startup dialog box, click to select the Use Special Access Keys
check box.
Click OK to close the Startup dialog box.
Close and then reopen the database.
Run the code that contains the breakpoint. Note that execution of the
code pauses at the breakpoint, as you
would expect.
Office 2010 Steps to resolve:
File
Options
Current Database
Make sure "Use Access Special" is checked.
Close and reopen Database.

Internet Explorer 8 64bit and Selenium Not working

I am trying to get selenium tests to run. Yet every time I try to run a tests that should run IE I get a error on line 863 of htmlutils.js It says that I should disable my popup blocker. The thing is I went to IE tools-> turn of popup block.
So it is disabled and I get this error.
Is there something else I need to disable. I actually don't even know what version of Internet explorer it is running since I am using Windows 7 Pro 64bit version. So when I do use IE I use 64bit version but I am under the understanding if the site or something like that does not support 64bit it goes to 32bit.
So not sure what I need to do it to make it work.
This is the lines where it does
function openSeparateApplicationWindow(url, suppressMozillaWarning) {
// resize the Selenium window itself
window.resizeTo(1200, 500);
window.moveTo(window.screenX, 0);
var appWindow = window.open(url + '?start=true', 'selenium_main_app_window');
if (appWindow == null) {
var errorMessage = "Couldn't open app window; is the pop-up blocker enabled?"
LOG.error(errorMessage);
throw new Error("Couldn't open app window; is the pop-up blocker enabled?");
}
Where is this log.error message stored? Maybe I can post that too.
I had a similar problem on Vista and IE8
I would get the same error message
Couldn't open app window; is the pop-up blocker enabled?"
Running my remote control as Admin wasn't an option for me, and also a poor idea from a security perspective.
So in the end I manage to solved this by changeing browser from "*ietha" to "*iexploreproxy"
grid_configuration.yml
hub:
port: 4444
...
- name: "Internet Explorer 8 on Vista"
browser: "*iexploreproxy"
...
Alternatively, you can change browser string from the code:
ISelenium selenium = new DefaultSelenium("localhost", 4444, "*iexploreproxy", "http://www.google.com/");
Works like a charm.
The only question remaing is if this somehow affects the outcome of the test cases. So far no, but I'll update this answer in case that would happen.
I ran into this on Windows 7 64bit.
My solution was:
Disable popup block. - Select "Tools/Popup Blocker/Turn off pop-up blocker"
Disable IE protected mode. - Untick "Tools/Internet Options/Security/Enable protected mode"
It'd be better just to disable protected modes for known trusted hosts/addresses. I'll leave that as an exercise for the reader.
I was experiencing the same problem. I ran the Selenium RC server as an administrator and everything worked fine.
I, too, am experiencing this very problem on a Windows 7 64bit box, trying to run Selenium on it to test and ASP .Net MVC application, written in C#.
I am still trying to work out the answer for myself, but I thought I'd post here to tell you of a little progress I have made in getting something to work, albeit in Firefox instead of IE.
Here's the line I changed:
selenium = new DefaultSelenium("localhost", 4444, "*chrome C:/Program Files (x86)/Mozilla Firefox/firefox.exe", "http://www.bbc.co.uk/");
I would ideally like for this to work in Internet Explorer 8, but if for the moment, I can begin getting tests working and later change over to use IE again, then great.
Hope this helps for your problem with it all.
I had the same problem on Windows 7 64bit IE8. The first step was to disable the IE popup blocker. Then, I got a message in the status bar saying that "Pop-ups were blocked on this page. Press the 'Ctrl' key to allow the pop-ups".
It turns out that the Google Toolbar was providing this feature. Disabling it solved the problem. View > Toolbars > Google to toggle.
John.
If you happen to be doing this from JavaScriptMVC, there is a reference you need to change in \jmvc\plugins\test\drivers\selenium.js:
1) Change iexplore to iexploreproxy and you should get better results:
msie : (/iexploreproxy/i).test(browserStartCommand),
2) At this point, you'll find that you still get the popup error, but a separate instance of IE has started. Leave that IE window open and restart the tests, but not Selenium.
3) Next, the windows should show up in the right place, but IE gives the annoying block active content warning. Allow the content to run and restart the tests, but not Selenium itself.
This is super clunky, but it at least gets you past that part. If I find more methodical ways to do these things I'll update as needed.
I have had the same problem and have found another solution which works for me. Just use the *iexploreproxy setting in the browserString.
I used:
selenium = new DefaultSelenium("localhost", 4444, "*iexploreproxy C:/Program Files/Internet Explorer/iexplorer.exe", "http://www.bbc.co.uk/");
I hope that works for others too :)
You can start the test when you disable the Security mode of Internet. Don´t know the correct name for it, but in dutch it is beveiligde modus.
I tried modifiing the security settings to dublicate this security mode, but couldn´t find the correct setting for it. It must therefor block more then you can set manually.

Resources