I have a devexpress gridcontrol in my main windows form which I want to populate its datasource depending on an event that occurs when my windows mobile phone is connected to the desktop pc via usb port(activesync). The problem is that the method called by the event is executing on an another thread. As soon as I assign my gridcontrol a new datasource, It attempts to redraw the control and at that point It gives me the "object reference not set to an instance of an object" error. I did my best to figure out whether it really is doing its job on a different thread since I did not created that new thread myself. Consequently, I came to the understanding that it really is since the thread that the method working on has different thread Id and even trying to make a small animation to be worked on the new thread to see if the the form gets locked while that endless animation running. So It is sure that I attempt to populate my devex gridcontrol from a different thread. How can I come over such situations not to get any reference issues.
I am developing this on a windows form project created on visual studio 2003 and relying on .net framework version of 1.1 and on windows 7 x86 o/s
Devex controls have to be handled on the main UI thread.
Just invoke the method to work on the UI thread :)
Related
I am trying to automate certain things in a remote desktop using surface migration techniques in blueprism.
I have to open Windows Remote Desktop and enter the login details, but i am unable to identify it in application modeller. After launching mstsc.exe using the application modeler the identify button disappears and turns back to launch and due to this i am unable to use region mode to identify or spy elements.
Any solutions for this?
Snippet of the application modeller
I solved this problem creating 2 objects.
- Object one will execute "mstsc.exe"
- Object two will attach an existing mstsc.exe execution
So you have to launch mstsc.exe in your first object then go to the second one and attach it. If everything goes fine, you'll be able to use the application modeler in your second object and identify whatever you need to.
Example first object:
1
Example second object:
2
I'm maintaining an existing VB6 application.
It's built as an AcitveX control. The build process builds a CAB file which is then fired into a Browser from an HTM file.
My question is, is there any way to detect the Zoom setting once the Application is loaded in the Browser?
It's not a WebBrowser project so, I can't use that object to query the setting, at least I don't think so...
During the ActiveX initialization process you are guaranteed to get a SetClientSite callback, among many others, which will give you an IWebBrowser2 pointer. There may be some timing issues with regards to zoom, but this is a starting point.
In my WPF application, used one graphics application as a control. But this graphics control/tool will run in separate process and WPF application is run in separate process. Problem is when i am navigating from one screen to some other screen, my WPF application window is minimized or going behind to other applications some times.
I want this problem to rectify. Please any give me solution for this.
I'm about developing an application level VSTO addin that consists, among others, of a UI with an embedded Webbrowser control and a simple REST-style service, based upon WCF's WebServiceHost. The service delivers content, in particular flash movies, to the embedded browser. This used to work like a charm until yesterday. For some still unknown reason (maybe some .NET update that changed some internal processing), the complete Word application now freezes when the browser loads a flash movie from the embedded server. It still works when I move the webserver code into a separate process, and it also works when the flash movie is already in the browser cache, so I am quite sure that it is the combination of serving and displaying the flash movie both in the addin that is causing the problem.
I did some research (which I should have done earlier, maybe) and learned that multi-threading and VSTO addins do not go well together. And running a webservice surely implies some kind of multi-threading.
So my question is: is there any chance to make this kind of architecture run reliably? If so: what am I missing? Or should I better try another approach? If so: what would you recommend?
Note: Using "file://" urls and thus loading the content directly from the disk is not an option since I cannot guarantee a common docroot and need to put some logic between the UI and the content serving.
VSTO add-ins are STA, so you should consider researching WCF and STA (see related SO post).
You could always host the WCF service as a windows service to avoid the STA issues of the VSTO add-in host.
I have developed a library to manipulate HTML to conform to our needs using the WebBrowser control, however I need this library to work on a web app and not a winforms app. The main issue I get is this:
"ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment."
I understand this is because the WebBrowser control needs to be ran in a STA Thread, but obviously a web app isn't an STA environment. Its a server side process though so its not in a page itself. Any ideas on how I can get round this? I considered setting the AspCompat="true" attribute on the Page tag of a hidden page and running it from that but I would rather a more elegant solution.
Cheers
Instantiate and perform your work in a new thread upon which you have explicitly set the ApartmentState via SetApartmentState().