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 to change the classname???

How to change the classname???

Scheduled Pinned Locked Moved C#
csharphelptutorialquestion
12 Posts 4 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.
  • M mojo_geo

    I create a winform by c# 2003. The form's classname like "windows.forms.app3",I must change the it to the particular name that like "myForm". Thanks for you help.

    C Offline
    C Offline
    Christian Graus
    wrote on last edited by
    #2

    If you use F2 to rename the file in the solution Explorer, I think it will rename the class for you. Yo ucan also right click on the name and rename it via the refactor menu. Finally, you can just do a global search and replace.

    Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

    M P 2 Replies Last reply
    0
    • C Christian Graus

      If you use F2 to rename the file in the solution Explorer, I think it will rename the class for you. Yo ucan also right click on the name and rename it via the refactor menu. Finally, you can just do a global search and replace.

      Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      M Offline
      M Offline
      mojo_geo
      wrote on last edited by
      #3

      Sorry, maybe my question is not clear. The classname is not my class name. use the tools SPY++, you can find the form's classname is "windows.forms.app3". i want change it.

      C 1 Reply Last reply
      0
      • M mojo_geo

        Sorry, maybe my question is not clear. The classname is not my class name. use the tools SPY++, you can find the form's classname is "windows.forms.app3". i want change it.

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #4

        well, why on earth would you want to do that ? I doubt you can.

        Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

        M 1 Reply Last reply
        0
        • C Christian Graus

          If you use F2 to rename the file in the solution Explorer, I think it will rename the class for you. Yo ucan also right click on the name and rename it via the refactor menu. Finally, you can just do a global search and replace.

          Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #5

          Christian Graus wrote:

          If you use F2 to rename the file in the solution Explorer, I think it will rename the class for you. Yo ucan also right click on the name and rename it via the refactor menu. Finally, you can just do a global search and replace.

          Only works on a "modern" IDE. VS 2003 didn't have the fancy refactoring - this was introduced in 2005.

          Deja View - the feeling that you've seen this post before.

          My blog | My articles

          C 1 Reply Last reply
          0
          • C Christian Graus

            well, why on earth would you want to do that ? I doubt you can.

            Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

            M Offline
            M Offline
            mojo_geo
            wrote on last edited by
            #6

            My winform is controled by other software. It use windows api function "sendmessage" send the windows message to my form. The function need 2 parms "form's classname & form's title". so i must change the classname to specific name like "myForm".

            C 1 Reply Last reply
            0
            • P Pete OHanlon

              Christian Graus wrote:

              If you use F2 to rename the file in the solution Explorer, I think it will rename the class for you. Yo ucan also right click on the name and rename it via the refactor menu. Finally, you can just do a global search and replace.

              Only works on a "modern" IDE. VS 2003 didn't have the fancy refactoring - this was introduced in 2005.

              Deja View - the feeling that you've seen this post before.

              My blog | My articles

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #7

              Which is why I also said 'search and replace' :p

              Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

              1 Reply Last reply
              0
              • M mojo_geo

                My winform is controled by other software. It use windows api function "sendmessage" send the windows message to my form. The function need 2 parms "form's classname & form's title". so i must change the classname to specific name like "myForm".

                C Offline
                C Offline
                Christian Graus
                wrote on last edited by
                #8

                No, you don't need to do that. SendMessage takes a HWND, you can FIND the hwnd based on name or title, using different APIs.

                Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

                1 Reply Last reply
                0
                • M mojo_geo

                  I create a winform by c# 2003. The form's classname like "windows.forms.app3",I must change the it to the particular name that like "myForm". Thanks for you help.

                  A Offline
                  A Offline
                  AndrewVos
                  wrote on last edited by
                  #9

                  Override CreateParams, and set the class name yourself. Not sure if it will give you an exact name though, but it's worth a try.


                  www.andrewvos.com

                  A 1 Reply Last reply
                  0
                  • A AndrewVos

                    Override CreateParams, and set the class name yourself. Not sure if it will give you an exact name though, but it's worth a try.


                    www.andrewvos.com

                    A Offline
                    A Offline
                    AndrewVos
                    wrote on last edited by
                    #10

                    Hmm. Doesn't work.


                    www.andrewvos.com

                    M 1 Reply Last reply
                    0
                    • A AndrewVos

                      Hmm. Doesn't work.


                      www.andrewvos.com

                      M Offline
                      M Offline
                      mojo_geo
                      wrote on last edited by
                      #11

                      Thanks. That is no answer :((

                      A 1 Reply Last reply
                      0
                      • M mojo_geo

                        Thanks. That is no answer :((

                        A Offline
                        A Offline
                        AndrewVos
                        wrote on last edited by
                        #12

                        If you want to use SendMessage to send something to a window, do what was mentioned above. Maybe inherit a NativeWindow, and set the caption to something like "My Special Window". Then you can use FindWindow("My Special Window") to find the handle of the window you want to SendMessage to. All you need to do then is override WndProc in the NativeWindow. Have a look at FindWindow on pinvoke.net.


                        www.andrewvos.com

                        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