Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. how do I get the classname?

how do I get the classname?

Scheduled Pinned Locked Moved C#
tutorialquestioncsharp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Stephan Wright
    wrote on last edited by
    #1

    Hy everyone! I would like to check the classname of my application at runtime, meaning I would like to receive WindowsForms10.Window.8.app87 for example. I am able to fetch this via Spy++ but I have no idea how to fetch this (this string) via C# code. So if anyone of you knew how to fetch this via C# code please let me know. Because I do need this to get access to a running application and do not want to use the name of the window because maybe I will display statusinfos there. Thanks! Stephan.

    N 1 Reply Last reply
    0
    • S Stephan Wright

      Hy everyone! I would like to check the classname of my application at runtime, meaning I would like to receive WindowsForms10.Window.8.app87 for example. I am able to fetch this via Spy++ but I have no idea how to fetch this (this string) via C# code. So if anyone of you knew how to fetch this via C# code please let me know. Because I do need this to get access to a running application and do not want to use the name of the window because maybe I will display statusinfos there. Thanks! Stephan.

      N Offline
      N Offline
      Norman Timo
      wrote on last edited by
      #2

      This would work with following solution! Something like that should return your class name: Type myClassType = this.GetType(); string appName = myClassType.Name; // returns Class Name Or you use: string appFullName = myClassType.FullName; // returns Class Name with namespace etc... Hope this is working. With greetings Norman-Timo

      S 1 Reply Last reply
      0
      • N Norman Timo

        This would work with following solution! Something like that should return your class name: Type myClassType = this.GetType(); string appName = myClassType.Name; // returns Class Name Or you use: string appFullName = myClassType.FullName; // returns Class Name with namespace etc... Hope this is working. With greetings Norman-Timo

        S Offline
        S Offline
        Stephan Wright
        wrote on last edited by
        #3

        Hy! Sorry, not really! It only displays the selfdefined class! But I do need WindowsForms10.Window.0.app8a for example (that's what spy++ says my classname to be. I just did some debugging and I guess this strange name is created after the run command. WindowsForm because it inherits from WindowsForms and Window because it's a window. But after the run command I am not able to get this anymore. Well I think I have to switch to another solution, maybe I should write the handleID in the registry for the other applications to fetch it. Thanks anyway! Stephan.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups