473,395 Members | 1,936 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

window stations, desktops and DotNet


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
Then I do a CreateProcess() specifying my custom station/desktop.
(in STARTUPINFO.lpDesktop). This CreateProcess starts my Winforms

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
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 1505

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Wayne Wengert | last post by:
Using the Code Window in VS.NET if I put the mouse cursor over a method such as "Select" and right click I get a nice window defining that method. How do I close that window when I am done reading...
by: HarveyB | last post by:
I would like to generate non-modal popup windows from ASP.Net code-behind. I have tried using Client Side scripting like "function Test(){ window.open('test.htm',_blank,...
by: Dave | last post by:
I'm getting different results when I display a value in the Output window as opposed to the Immediate window. Why? Code to recreate problem: 'Purpose: Get different results from Output...
by: Frances Del Rio | last post by:
I'm trying to open a url in a new window while pg loads (but NOT in a pop-up..) I need to do sthg like // while pg is loading.. window.location ='page.html' // but I need this to open in a...
by: al | last post by:
Hi, When Resizing (maximize and minimize actions) a window, does IE 5.0 adjust asp.net page controls so they are aligned, or do i have to do it(aligning) in code? MTIA, Grawsha
by: elmo | last post by:
HI, This is realy a stupid problem but I cannot find a solution, please help. I have a asp.net page that displays after a user has logged on to the system. On this page is a couple of options and...
by: drodrig | last post by:
Hi. I am trying to close/kill all processes that show visible windows on Windows XP. So far I've created a script that uses win32gui.EnumWindows to iterate through all windows, check for which...
by: =?Utf-8?B?Vmlua2k=?= | last post by:
public void sendKeysTest() { Process myProcess = Process.Start(@"C:\winnt\system32\cmd.exe"); SetForegroundWindow(myProcess.Handle); if (myProcess.Responding) SendKeys.SendWait("{ENTER}");...
by: Safalra (Stephen Morley) | last post by:
(Note: I'm not trying to do anything stupid based on the user's screen size - I'm just curious.) At work today I was looking at the visitor statistics for a client website, and noticed that...
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.