Change ClassName in c#
-
Hi, If I built a windows application in VS2008, the class name I got is something like WindowsForms10.Window.8.app.0.378734a Is it possible to change this class name? I tried to do
protected override System.Windows.Forms.CreateParams CreateParams { [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)] get { System.Windows.Forms.CreateParams cp = base.CreateParams; cp.ClassName = "MyTestApp.MainForm"; return cp; } }
But every time I run my application, I got this error
Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.
Any idea? Cheers :)
-
Hi, If I built a windows application in VS2008, the class name I got is something like WindowsForms10.Window.8.app.0.378734a Is it possible to change this class name? I tried to do
protected override System.Windows.Forms.CreateParams CreateParams { [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)] get { System.Windows.Forms.CreateParams cp = base.CreateParams; cp.ClassName = "MyTestApp.MainForm"; return cp; } }
But every time I run my application, I got this error
Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.
Any idea? Cheers :)
-
RYU^^ wrote:
Any idea?
Why on earth would you want to do such a thing?
xacc.ide - now with TabsToSpaces support
IronScheme - 1.0 alpha 4a out now (29 May 2008)
((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))leppie wrote:
Why on earth would you want to do such a thing?
Do you mean changing the class name from WindowsForms10.Window.8.app.0.378734a to MyTestApp.MainForm? Well, I need to do that so that I can use FindWindow(). The reason I need to use FindWindow() is because that is the only function I can find in NSIS (NULLSoft) to find out whether specific application is running or not. Cheers :)
-
leppie wrote:
Why on earth would you want to do such a thing?
Do you mean changing the class name from WindowsForms10.Window.8.app.0.378734a to MyTestApp.MainForm? Well, I need to do that so that I can use FindWindow(). The reason I need to use FindWindow() is because that is the only function I can find in NSIS (NULLSoft) to find out whether specific application is running or not. Cheers :)
You must use RegisterClassEx first.