I am writing in C # trying to write a special on-screen keyboard (OSK) for an application. To make it accessible, I have created a form that has several buttons representing the keys, and calls them SendKeys
and sends the appropriate key.
This form is owned by the main window that is shown when the app starts for the first time, using the owner
property. In this way, the OSK pops up whenever the user focuses the app, and it stays at the top of the main window, if it is said that the main window is dragged over it.
All this works very well, but because I have the model that I want to use with OSK, I tried to make it in a separate thread, its message loop ( Application.Run
), so it can still be usable with any model dialog, in the main thread.
The problem with this is that, obviously, due to cross-threaded calls due to being in a separate thread, InvalidOperationException
s may be due. A typical example of this when calling application.Run (osk)
with a new thread, there is a cross-thread error because it attempted to update the handle of the window with the master (main window) Still working. / P>
My question is, is it possible on a proprietary form on a thread that is different from the owner securely? And, if unsuccessful, is it possible to emulate the features of the proprietary form (i.e. should always be on the top for the main window only, and when the main window is centered then it arises)?
Thank you, and sorry it's misleading.
I think that this is actually a bug in the Windows form, using the handled property through the wrong thread There is some indispensable due to the way to check. SDK docs for SetParent are not obvious, it indicates that both windows are of the same application. There is no mention of being related to the same thread. I know for a fact that the need for 'one application' is not difficult, Windows has the epicapate code that works for windows with different processes. Adobe Acrobat now uses it for a long time, which certainly meets the 'single thread' requirement.
Okay, press the problem and try it. Set control. Before you set your masters to check, custom, cross-track calls to lie back, true back in. And check it out. If you are having trouble, try setting up the painting instead of establishing the owner. Windows Form actually uses SedwindoLopRT which is not recommended by SDK.
Comments
Post a Comment