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 / C++ / MFC
  4. need a handle to a CStatic object

need a handle to a CStatic object

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
10 Posts 6 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
    SteamEngine
    wrote on last edited by
    #1

    :confused:I have a pointer to a CStatic object but i need a handle to it cos i need to reposition it on the screen with the help of SetWindowPos function. How can i obtain a handle to the object if I have pointer and is there any other way to move/reposition the CStatic object. Plzz Help !!! Anshul

    C N M S 4 Replies Last reply
    0
    • S SteamEngine

      :confused:I have a pointer to a CStatic object but i need a handle to it cos i need to reposition it on the screen with the help of SetWindowPos function. How can i obtain a handle to the object if I have pointer and is there any other way to move/reposition the CStatic object. Plzz Help !!! Anshul

      N Offline
      N Offline
      Naveen
      wrote on last edited by
      #2

      if StaticCtrl is an object of CStatic, then StaticCtrl.m_hWnd points to the handle to that static control.

      nave

      1 Reply Last reply
      0
      • S SteamEngine

        :confused:I have a pointer to a CStatic object but i need a handle to it cos i need to reposition it on the screen with the help of SetWindowPos function. How can i obtain a handle to the object if I have pointer and is there any other way to move/reposition the CStatic object. Plzz Help !!! Anshul

        C Offline
        C Offline
        Cedric Moonen
        wrote on last edited by
        #3

        Err... You don't need its handle. Just call the MoveWindow function directly:

        pStaticCtrl->MoveWindow(...);


        Cédric Moonen Software developer
        Charting control

        S 1 Reply Last reply
        0
        • S SteamEngine

          :confused:I have a pointer to a CStatic object but i need a handle to it cos i need to reposition it on the screen with the help of SetWindowPos function. How can i obtain a handle to the object if I have pointer and is there any other way to move/reposition the CStatic object. Plzz Help !!! Anshul

          M Offline
          M Offline
          Maxwell Chen
          wrote on last edited by
          #4

          HWND CStatic::GetSafeHwnd() const;


          Maxwell Chen

          1 Reply Last reply
          0
          • S SteamEngine

            :confused:I have a pointer to a CStatic object but i need a handle to it cos i need to reposition it on the screen with the help of SetWindowPos function. How can i obtain a handle to the object if I have pointer and is there any other way to move/reposition the CStatic object. Plzz Help !!! Anshul

            S Offline
            S Offline
            see me
            wrote on last edited by
            #5

            Hey....do you want to know that how to give the first param of SetWindowPos( ) u have an object to the CStatic like CStatic objMyStatic; then get handle like this objMyStatic.m_hWnd; :)

            Dream bigger... Do bigger...Expect smaller aji

            S 1 Reply Last reply
            0
            • S see me

              Hey....do you want to know that how to give the first param of SetWindowPos( ) u have an object to the CStatic like CStatic objMyStatic; then get handle like this objMyStatic.m_hWnd; :)

              Dream bigger... Do bigger...Expect smaller aji

              S Offline
              S Offline
              SteamEngine
              wrote on last edited by
              #6

              see i will tell u, there are many CStatic objects on the client window, right. Now what happens is that the user clicks on one of them and i get the address of that object in the 'this' pointer. Now i want to move this object according to the mouse drag on the screen, with the help of SetWindow Pos func and Invalidate(TRUE); I have the address of the CStatic object which the user is trying to drag.How do i get the handle of this object so that i can move it. is there any way to find out the handle with the help of this pointer.

              H 1 Reply Last reply
              0
              • S SteamEngine

                see i will tell u, there are many CStatic objects on the client window, right. Now what happens is that the user clicks on one of them and i get the address of that object in the 'this' pointer. Now i want to move this object according to the mouse drag on the screen, with the help of SetWindow Pos func and Invalidate(TRUE); I have the address of the CStatic object which the user is trying to drag.How do i get the handle of this object so that i can move it. is there any way to find out the handle with the help of this pointer.

                H Offline
                H Offline
                Hamid Taebi
                wrote on last edited by
                #7

                if you have a derived CStatic what do you need?

                _**


                **_

                WhiteSky


                S 1 Reply Last reply
                0
                • C Cedric Moonen

                  Err... You don't need its handle. Just call the MoveWindow function directly:

                  pStaticCtrl->MoveWindow(...);


                  Cédric Moonen Software developer
                  Charting control

                  S Offline
                  S Offline
                  SteamEngine
                  wrote on last edited by
                  #8

                  see i will tell u, there are many CStatic objects on the client window, right. Now what happens is that the user clicks on one of them and i get the address of that object in the 'this' pointer. Now i want to move this object according to the mouse drag on the screen, with the help of SetWindow Pos func and Invalidate(TRUE); I have the address of the CStatic object which the user is trying to drag.How do i get the handle of this object so that i can move it. is there any way to find out the handle with the help of this pointer. otherwise tell me how i can move the CStatic window along with the mouse.

                  1 Reply Last reply
                  0
                  • H Hamid Taebi

                    if you have a derived CStatic what do you need?

                    _**


                    **_

                    WhiteSky


                    S Offline
                    S Offline
                    SteamEngine
                    wrote on last edited by
                    #9

                    i need to move the CStatic object which is again a window along with mouse drag. The moment user clicks in the window i get the pointer to it in the this pointer, but SetWindowPos func takes the handle of the window as tha paramater so now what to do ????

                    H 1 Reply Last reply
                    0
                    • S SteamEngine

                      i need to move the CStatic object which is again a window along with mouse drag. The moment user clicks in the window i get the pointer to it in the this pointer, but SetWindowPos func takes the handle of the window as tha paramater so now what to do ????

                      H Offline
                      H Offline
                      Hamid Taebi
                      wrote on last edited by
                      #10

                      See Here[^] maybe it is some helpful to you

                      _**


                      **_

                      WhiteSky


                      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