RichTextBox in .net giving weird behaviour in Windows7 but working fine in WindowsXP - richtextbox

I have an application in which view and edit of a script(which is a .txt file) has to be performed. I am using a RichTextBox on .net platform for this. When user wants to view a script, I just copy the script in my richtext box with WordWrap true. But when user has to edit it, I have to show it in a single line. This does not require the word wrap property to be true.
But this is working fine on WindowsXP but when viewed on Windows 7 PC, on editing, the script is truncated. If user clicks anywhere on the dialog box which has richtextbox, the whole script can be seen. This happens each time when user selects to Edit it.
Also, If I do a remote desktop to Windows7 PC, the script can be seen properly at once only when editscript is done.
Can someone please help in this?
Can this be graphic card issue? I have checked changing the resolution but it didn't work

Related

Visual Studio 2022 find the next line of code to execute

I am learning a new ASP.NET MVC app that uses some approaches I am not used to / familiar with. Without having to deal with the client side scripts (because there appear to be over a thousand), I want Visual Studio to go into break mode / stop at the first line of code executed on the server.
Is there a way to do that?
For example, I click a button in the web site that run a script that shows a dialog box (I don't believe any server code has executed at this point in this series of events). Then I fill in some fields and click a button in the dialog box that I know sends data back to the server. I want the sever to stop at the first line of code it attempts to execute as a result of the button being clicked.
I thought you used to be able to put the app in Break mode, then you could use the Step Into button to take you to the next line of code but this no longer seems to work.
Any ideas?
You can use my Runtime Flow tool to find out what code is executed on the server when you click a button in the web site. Though you need to manually configure Runtime Flow to monitor your web application as described here https://vlasovstudio.com/runtime-flow/documentation/quick_start.html

Internet explorer started from WScript.exe will not on appear on top

We have recently added a new feature on our application to be able to shell out to another application. One of the commands is WScript.exe
In one part of the script, I wanted to be able to show a dialogue, so I create an instance of Internet Explorer, inject my html, and then wait for a hidden input element to be updated.
The windows scripting file (containing VBS) then calls
Dim explorer
Set explorer = WScript.CreateObject("InternetExplorer.Application")
explorer.StatusBar = 0
explorer.ToolBar = 0
explorer.Navigate "about:blank"
Dim document
Set document = explorer.Document
document.open
document.write html
document.close
explorer.Visible = True
Do
WScript.Sleep 250
Loop Until document.getElementById("myValue") <> ""
This seems to work fine when I am debugging my main application. But when I run the application outside the debugger, the dialogue appears behind the application.
I believe that the problem is explained in the answer to this item:
WScript.Shell AppActivate doesn't work every time
Essentially, this was working because I was developing this in debug mode. When out of debug mode, the instance of iexplore.exe was not directly started by wscript.exe - the iexplore.exe process is actually started by an instance of svchost.exe. This meant that the implicit SetForegroundWindow() does not work.
Can anyone suggest a way I can put this internet explorer windows in the foreground?
Or is there another way I can create a dialogue, without having to distribute any more components?

Selenium IDE simulate press ENTER for javascript configmation box

I am looking for allready for hours how to do this. So don't tell me to use search function. I know there are many things related.
There is many stuff on the internet and here, but no one works for me.
And I need a solution for Selenium IDE or something intergrated with it (if there is anything). Not RC and not WebDriver etc.
I need to simulate a key for an JavaScript confirmation popup, which has "OK" and "Cancel" buttons.
The problem is that I cannot select anything.
Popup appears when the site is opened. The Website itself is visible in the background, but no element can be selected (Firebug shows nothing as well, empty html(?)).
If I press ENTER key the confirmation box disappear (so it works fine manually).
This example seems good, but I can't find any interface in Selenium IDE to do this:
driver.switchTo().alert().accept();
(from Click in OK button inside an Alert (Selenium IDE))
I have only the following pattern:
Or write the test in html, which uses the "Command", "Target", "Value" pattern.
Appreciate any help.
EDIT1:
With the link provided by Janesh Kodikara
I have found that my problem is:
Selenium IDE will not be able to handle alerts that are within the page's onload() function. It will only be able to handle alerts that are generated after the page has completely loaded.
There is no "onload" function in my website, but the script part which creates the alert is inside html which is called with page (not in any function). This must be the same as "onload", because the alert comes immediately when the website is opened.
Once you have a confirmation box, you must consume it (Click OK or Cancel button)
You can use "chooseOkOnNextConfirmation" command to instruct Selenium IDE to simulate clicking OK button.
See http://www.guru99.com/enhancing-selenium-ide-script.html for more details.
You will not see the Javascript popup when IDE script is run.
Selenium IDE
Command : runScript
target : {window.onbeforeunload=function(e){};}
Command :click
target : xpath of button.
This will work fine but you are not able to see popup.

Google Chrome Extension: Print the page silently

I'm developing an internal Google Chrome Extension that needs a way to initiate print the current page to the printer. I do not want the default Print dialog to come up (so, javascript:window.print() is out of question).
As far as I understand, this is not possible just with the JS + HTML plug-in, so I'm also open to using the NPAPI plugin also (with a dummy mime-type). And I'm concerned for Windows platform only.
I'm also open for various hacks / workarounds if possible, though a standard solution would be nice.
If you think this is not possible, let me know if you know any feature request logged for it?
Any suggestions/clarifications are welcome..
In chrome (v18+) we have the --kiosk --kiosk-printing switches. One can print automatically to default printer without print confirmation.
You can see it from this video http://www.youtube.com/watch?v=D6UHjuvI7IE
Since NPAPI allows you to create native C++ plugins that you can interact with through an object tag (which you can use from an extension), that would probably be the way to do it.
The tricky bit is that I don't know of a good way to get the bits for printing the page. The only person I know of who has done something similar to this actually got the window handle for the browser (available through NPAPI) and scraped the bits off of it to print that way, but that won't take into account print stylesheets or anything. You could also try using automation events to try to control the print dialog, but I have no idea if that would work or not.
By design, the browsers try not to let you do something like this, as it could open some serious vulnerabilities if any website could just start printing things to your printer without confirmation...
Anyway, if you find a way to do it with C++ you can use FireBreath to ease the creation of the NPAPI plugin.
There are various extensions that take snapshots of the current web page (for example, this one); you could adapt one to send the image to a printer via an NPAPI plugin.
I've recently been looking for a similar ability, and it seems like it would be quite possible using Chrome's new native messaging api.
https://developer.chrome.com/extensions/nativeMessaging
There are plenty of examples of this with C#, but here is one quick example of troubleshooting Chrome native messaging with a basic C# application
Native messaging from chrome extension to native host written in C#
I realize this may be a day late and a dollar short, but in case anyone else comes across this question, this is the solution that worked for me. From inside a C# app, you can directly print to installed printers using the PrintDocument class. If you figured out a way to get the page image, this would be far easier than using firebreath or NPAPI.
Disable print preview in Google Chrome on Mac
Quit Google Chrome
Launch Terminal on your Mac. (Search “Terminal” using the Search box)
Type defaults write com.google.Chrome DisablePrintPreview -bool true
Close Terminal and open Google Chrome
Disable print preview in Google Chrome on Windows
Close Google Chrome
From your desktop, right click Google Chrome
Click Properties
In the dialog box, add ‘ –disable-print-preview‘ at the end of the Target field sans the apostrophe (make sure to include the space before –)
Click Apply
Disable print preview in Firefox on Mac
In the address bar type “about:config” and press Enter.
Right click on the page, hover over ‘New’ and click on ‘Boolean’
Type ‘print.always_print_silent’ as the preference name and click ‘OK’
Click on ‘true’ and click ‘OK’.
Close the about:config window.
Disable print preview in Firefox on Windows
In the address bar type “about:config” and press Enter.
Right click on the page, hover over ‘New’ and click on ‘Boolean’ Type
‘print.always_print_silent‘ as the preference name and click ‘OK’
Click on ‘true’ and click ‘OK’.
Close the about:config window.
https://support.dryfta.com/how-to-disable-print-preview-in-chrome-firefox-on-windows-mac/

Pspad "File contents were changed. Reload?" dialog bug

I've been using PsPad for quite some time now, always on Windows XP never a problem. But since I've upgraded to Windows7, PsPad is throwing the confirmation dialog "File contents were changed. Reload?" when it doesn't have to. I can reproduce this annoying message by: editing a file, saving it (to the fileserver win3k over a network), viewing that file/page in the browser, going back to PsPad to work on the file. After that last point it throws the dialog, while obviously nothing has changed in the meantime.
Does anybody experience the same bug? Is there something to do about it? PsPad forum has a thread about this, but no solution is provided there.
You can switch it off in program settings / Direct edit button
CheckDocChanges=0
You can switch it off in program settings / Direct edit button CheckDocChanges=0
The DIRECT EDIT button it's a button to the left of the OK button on the program settings dialog box ( in version 4.5.4 ). It's not entirely intuitive but it's there alright if you look.
This occurs because the time on your server and your workstations are not in sync. You can set your workstation to synchronize with the same timeserver as your server, which you will have to find out yourself or from your admin.
To change the time server on your workstation do the following
Open date and time
Go to Internet Time
Change Settings
Put in the server
Click update now and OK

Resources