Setting the ClassName for a standalone app?

C

CaptainKS

Has anyone ever been able to change the classname for a C# (or even
VB.NET) standalone app?

Using Spy, I can see that the classname .NET gives the app is
"WindowsForms10.Window.8.app*", but I have been unsuccessful and I
haven't seen anyone else who's done it either.

Here's why I'm asking....

SETUP
1 C++ COM DLL who sends messages to an app of the classname
"MyMonitorApp" via SendMessage.
1 C++ MFC EXE who registers it's name as "MyMonitorApp" using the
RegisterClass() call.

TODO
I am attempting to replace ONLY the EXE with a newer .NET version
(the DLL is compiled in too many projects to make a change there right
now).

PROBLEM
The classname. Right now the DLL looks for a specific classname and
..NET assigns one, and won't allow it to be changed (that I know of).

Hewwwp! And, thanks in advance!! :)
Kurt Snyder
(e-mail address removed)
 
D

Dmitriy Lapshin [C# / .NET MVP]

Hi,

This has something to do with the Control's CreateParams property and the
corresponding structure (and any form is actually indirectly inherited from
the Control class).
I'd try to set the CreateParams.ClassName property in the form's constructor
and see what happens.
 
C

CaptainKS

Dmitriy Lapshin said:
Hi,

This has something to do with the Control's CreateParams property and the
corresponding structure (and any form is actually indirectly inherited from
the Control class).
I'd try to set the CreateParams.ClassName property in the form's constructor
and see what happens.

Well, this is something that I've tried (as it seemed logical), but
when you do so, an .Win32Exception is thrown at the earlier point of
"Application.Run(new Form1());" and it additionally says, "Invalid
window class name".

I also tried the same in VB.NET and it gave a similar exception at the
point of "MyBase.New()" in the form's constructor.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top