what is the classname

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Wilfried Mestdagh

    what is the classname

    Hi,

    I want to post a message from another application to my C# application. It
    works but I cannot fint the window if I fill in the class name. eg:

    namespace SomeNameSpace
    {
    partial class Main: Form
    {
    Text = "this is the title";

    and in the other program
    ClassName := 'Main';
    WindowTitle := 'this is the title';
    Win := FindWindow(Clas sName, WindowTitle);

    does only work if I make ClassName := nil

    --
    rgds, Wilfried

  • Mattias Sjögren

    #2
    Re: what is the classname

    [color=blue]
    >I want to post a message from another application to my C# application. It
    >works but I cannot fint the window if I fill in the class name. eg:[/color]

    The Win32 window class name isn't the same as your Form class name.



    Mattias

    --
    Mattias Sjögren [MVP] mattias @ mvps.org
    http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
    Please reply only to the newsgroup.

    Comment

    • Wilfried Mestdagh

      #3
      Re: what is the classname

      OK thanks that explains wy I cannot find it with FindWindow. But how do I
      find out what the classname is ?

      rgds, Wilfried

      Comment

      • Willy Denoyette [MVP]

        #4
        Re: what is the classname

        By calling WIN32 API GetClassName (user32.dll) using the Handle returned by
        FindWindow(Ex).

        Willy.

        "Wilfried Mestdagh" <WilfriedMestda gh@discussions. microsoft.com> wrote in
        message news:31C56825-79F3-49FE-9AE7-A17396C38D6A@mi crosoft.com...[color=blue]
        > OK thanks that explains wy I cannot find it with FindWindow. But how do I
        > find out what the classname is ?
        >
        > rgds, Wilfried[/color]


        Comment

        • Wilfried Mestdagh

          #5
          Re: what is the classname

          the classname returns: "WindowsForms10 .Window.8.app.0 .bf7771"

          question is: where does this come from ? I want to say to customars to
          FindWindow with specific class and title, just as it is the case in win32
          progrrams where the classname is the class name of the window (the form).

          rgds, Wilfried

          Comment

          • Willy Denoyette [MVP]

            #6
            Re: what is the classname

            The class name is the name given by Windows Forms when it is registering the
            "Window class" by calling Win32's RegisterClass(E x), you have no way to
            control this in .NET.

            Not sure what you mean with your last sentence, there is no notion of a
            "form" in Win32, there is only a Classname by which you register the class
            (RegisterClass( Ex)) and CreateWindow.

            Willy.

            "Wilfried Mestdagh" <WilfriedMestda gh@discussions. microsoft.com> wrote in
            message news:2956F02A-1CE0-4ECB-991A-E6451E9702E4@mi crosoft.com...[color=blue]
            > the classname returns: "WindowsForms10 .Window.8.app.0 .bf7771"
            >
            > question is: where does this come from ? I want to say to customars to
            > FindWindow with specific class and title, just as it is the case in win32
            > progrrams where the classname is the class name of the window (the form).
            >
            > rgds, Wilfried[/color]


            Comment

            • Willy Denoyette [MVP]

              #7
              Re: what is the classname

              Sorry, when I said there is a way to control this, I meant no "easy way".
              The NativeWindow class encapsulates this low level Window stuff, search the
              MSDN doc's for more info and a sample.

              Willy.

              "Wilfried Mestdagh" <WilfriedMestda gh@discussions. microsoft.com> wrote in
              message news:2956F02A-1CE0-4ECB-991A-E6451E9702E4@mi crosoft.com...[color=blue]
              > the classname returns: "WindowsForms10 .Window.8.app.0 .bf7771"
              >
              > question is: where does this come from ? I want to say to customars to
              > FindWindow with specific class and title, just as it is the case in win32
              > progrrams where the classname is the class name of the window (the form).
              >
              > rgds, Wilfried[/color]


              Comment

              • Mattias Sjögren

                #8
                Re: what is the classname

                >Sorry, when I said there is a way to control this, I meant no "easy way".[color=blue]
                >The NativeWindow class encapsulates this low level Window stuff, search the
                >MSDN doc's for more info and a sample.[/color]

                And you can also override the CreateParams property of a Control or
                Form. But that will only let you change the "Window" part of the whole
                window class name.



                Mattias

                --
                Mattias Sjögren [MVP] mattias @ mvps.org
                http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
                Please reply only to the newsgroup.

                Comment

                • Willy Denoyette [MVP]

                  #9
                  Re: what is the classname


                  "Mattias Sjögren" <mattias.dont.w ant.spam@mvps.o rg> wrote in message
                  news:e8FRm5gFFH A.3608@TK2MSFTN GP14.phx.gbl...[color=blue][color=green]
                  > >Sorry, when I said there is a way to control this, I meant no "easy way".
                  >>The NativeWindow class encapsulates this low level Window stuff, search
                  >>the
                  >>MSDN doc's for more info and a sample.[/color]
                  >
                  > And you can also override the CreateParams property of a Control or
                  > Form. But that will only let you change the "Window" part of the whole
                  > window class name.
                  >[/color]

                  Mattias,

                  Same problem with the NativeWindow class, only a System class name (CONTROL)
                  is allowed as classname, and this also becomes a part of the whole window
                  class name, quite unusable IMO.

                  Willy.


                  Comment

                  Working...