468,765 Members | 1,198 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,765 developers. It's quick & easy.

window stations, desktops and DotNet

Hi,

I have a C# Winform application. I'm trying to run the application
under a custom window station and desktop. First, I have an original
(non-dotnet) process that does a CreateWindowStation() and
CreateDesktop().
Then I do a CreateProcess() specifying my custom station/desktop.
(in STARTUPINFO.lpDesktop). This CreateProcess starts my Winforms
app.

The Winforms app fails as soon as it tries to create the event thread:

System.TypeInitializationException: The type initializer for
"System.Drawing.SafeNativeMethods" threw an exception. --->
System.Runtime.InteropServices.ExternalException: Failed to create
system events window thread.
at Microsoft.Win32.SystemEvents.EnsureSystemEvents(Bo olean
requireHandle, Boolean throwOnRefusal)
at Microsoft.Win32.SystemEvents.InvokeOnEventsThread( Delegate
method)
at System.Drawing.SafeNativeMethods.Initialize()
at System.Drawing.SafeNativeMethods..cctor()
--- End of inner exception stack trace ---
at System.Drawing.SafeNativeMethods.CreateIconFromRes ourceEx(Byte*
pbIconBits, Int32 cbIconBits, Boolean fIcon, Int32 dwVersion, Int32
csDesired, Int32 cyDesired, Int32 flags)
at System.Drawing.Icon.Initialize(Int32 width, Int32 height)
at System.Drawing.Icon..ctor(Type type, String resource)
at System.Windows.Forms.Form.get_DefaultIcon()
at System.Windows.Forms.Form.get_Icon()
at System.Windows.Forms.Form.UpdateWindowIcon(Boolean redrawFrame)
at System.Windows.Forms.Form.CreateHandle()
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Control.SetVisibleCore(Boolea n value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at System.Windows.Forms.Control.Show()
at com.tonic.tde.ui.TDE.Main(String[] args) in

However if I spawn a plain-jane Win32 windows app, or notepad.exe,
it works fine and the new app uses my station/desktop.

If I create a custom desktop, but use the default station (Winsta0),
Winforms works correctly, and uses the custom desktop.
Nov 16 '05 #1
0 1234

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Wayne Wengert | last post: by
12 posts views Thread by HarveyB | last post: by
14 posts views Thread by Frances Del Rio | last post: by
4 posts views Thread by al | last post: by
4 posts views Thread by elmo | last post: by
4 posts views Thread by drodrig | last post: by
7 posts views Thread by =?Utf-8?B?Vmlua2k=?= | last post: by
3 posts views Thread by Safalra (Stephen Morley) | last post: by
reply views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.