开发者

Get name of active form in console app C#

开发者 https://www.devze.com 2023-01-29 19:10 出处:网络
I would like to ask how i开发者_运维技巧s possible to get name of active form with using console app in C#?

I would like to ask how i开发者_运维技巧s possible to get name of active form with using console app in C#?

I imported System.Windows.Forms; and some some DLL libraries (user32.dll and kernel32.dll) But i dont know, how finish IT.

Thanks very much for any advice.


Is this what you're looking for? This should help you get the title of whatever the active window is, whether it's in your project or not.

How do I get the title of the current active window using c#?


Depending on what exactly your needs are, the Console.Title static property might be what you’re looking for.

string windowName = Console.Title;

or

Console.Title = "ZONK 1-D: A New Text-Based Adventure Game!";


One Way to get the Active form name using c# is using the following line,

    formName=this.page.GetType().ToString()

This will give form name as "ASP_Pages_Formname_aspx" and then we can retrieve the exact formname using string manipulation methods.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号