I want to try this new csExWB class out. But I do not see a clear path on how to encorporate it into a hello-world like project. If one has say a VS2010 hello-world project, where thet made a simple form-based app that had the WebBrowser control in it. What would one have to do to use csExWB instead of the WebBrowser control?
I figure in the form_Load method, one would instantiate an instance of the csExWB class and pass the WebBrowser control to it, so the csExWB class could override it, but I do not see anything in csExWB to do this.
Also, what would one add as a reference to the hello-world project? Would they add a reference to csExWB.dll? What about Interop.CSEXWBDLMANLib.dll? Would one need to add that as well. Also, what about that csExWBDLMan.dll?
First of all csExWB must have been a monumental effort and Mike deserves enormous credit for his oevre ....
It is possible to incorporate csExWB into one's own project, but it requires some tenanicty. I had an application which included a WebBrowser control (effectively this is IE) and had got almost to the completion of my project when I git a problem which I could not overcome (downloading a file without the irritating "File Download" pop-up"). After 2 weeks of frustration I decided the only answer was a webbrowser like csExWB which does (I think) everything WebBrowser/IE does ... but also with a 'silent' and 'automatic' (or at least semi-automatic) file download capability. Perfect.
I did hit a few glitches though:
1. My original application had to be changed to build from 'Any CPU' down to 'X86'
2. I had to get the DemoApp working completely and then .... very slowly ... take components out of it until I had a barebones frmMain form which was JUST the browser window.
3. Could not get this barebones browser to work with 'Visible = false' (it just doesn't seem to want to 'go') so I reduced the browser window down to Size = (0,0) as a workaround )
4. Had to register the CSEXWBLDMANLib.dll library in the C:\Windows\SysWOW64 directory rather than C:\Windows\System32 before the program would build
5. Had to hack IN code to delete csExWB browser cookies and cache entries before I could get 'consistent' access to my target website
Apart from that, lots more grey hairs and many wrinkles, everything in my application is a thousand times better than using WebBrowser/IE
Hey folks! I got it encorporated. Here is what I had to do!
I had a VS2010 hello-world app. The app added the csExWB.dll and csExWBDLMANLib.dll as references. Supposedly this should also take care of registering csExWBDLMANLib.dll, albeit in my test, I had already manually run RegSvr32 on it ahead of time.
In my app, I added the old WebBrowser, so I could have something to work with the GUI of VS2010's form editor, and I named it "WebBrowser_Main".
Then I simply declared a cEXWB in my app's main form as a data member;
public csExWB.cEXWB cEXWB_This = null;
And in the MyForm's Constructor I instatiated it as such:
then in the MyForm_Load I added the event handler like this:
public void MyForm_Load(object objSender, EventArgs EventArgs_Param)
cEXWB_This.BeforeNavigate2 += new csExWB.BeforeNavigate2EventHandler(cEXWB_This_BeforeNavigate2);
cEXWB_This.NavigateComplete2 += new csExWB.NavigateComplete2EventHandler(cEXWB_This_NavigateComplete2);
cEXWB_This.DocumentComplete += new csExWB.DocumentCompleteEventHandler(cEXWB_This_DocumentComplete);
cEXWB_This.ProgressChange += new csExWB.ProgressChangeEventHandler(cEXWB_This_ProgressChange);
as far as i understand this should be done on the ProtocolHandlerOnBeginTransaction event.
i'm using the m_AdditionalHeadersToAdd field - but it does not seem to work, the server side still responds as if this header did not exist.
i've tried the BeforeNavigate2 event with headers field as well
this is working well when i use HttpWebRequest class or ordinary framework's web browser control with the invoke:
this.webBrowser1.Navigate(@"https://www.xxx.xx/xx", "", null, "X-header: header");
Use Visual Studio's configuration manager to set it to compile to an x86 platform. I am on Windows 7 64bit and using C# 2008 Express.
Instructions are from here:
1. G in to the menu option Tools>Options and the in the dialog box tick the box in the bottom right corner to "Show all settings"
2. Once the settings expand go to "Projects and Settings" expand it and click on "General"
3. Check the option which is called "Show advanced build configurations", then close the dialog box
4. Now if you right click on the solution explorer, chose properties
5. Goto "Configuration Properties", now you should be able to see the platform drop down. This will probably have only "Any CPU" selected; if so click on "Configuration Manager"
6. Chose the option "New" under the "Active Solution Platform" drop down box
7. Chose the new platform of x86 and copy your settings from "Any CPU"
8. Then just make sure that your projects in your solution refer to x86 as the platform rather that "Any CPU"
On a 64-bit Windows installation, the path C:\Windows\SysWow64 may also be an option. Note: Counter-intuitively, on x64 Operating System, "System32" contains 64-bit system libraries and tools, while "SysWow64" contains 32-bit libraries and tools. e.g. Regedit.exe and Odbcad32.exe. "Wow" stands for "Windows-On-Windows", which is the virtual machine or backwards-compatibility that allows 32-bit processes to execute hosted on a x64 Operating System. In the same way that NTVDM hosts 16-bit processes in a x86 Operating System.
I noticed your code works for script errors and i have tried using it but not having alot of luck. I implemented all the requirements for the script error to run but do i require CBT hook? I would appreciate to know what code is required that handles the script errors.
I want two csExwb processes (not threads but csExwb of two programs,program A and program B). Program A log in the website and pass the cookie and session information to Process B and then Process B can visit the website without loging in. Reason to run programs like this is you can terminate process B any time you want and release the momery of Process B. Something like IE8 and Chrome.
Any idea? Many thanks!