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. Managed C++/CLI
  4. GetWindowRect wrong dimensions

GetWindowRect wrong dimensions

Scheduled Pinned Locked Moved Managed C++/CLI
helpquestion
10 Posts 4 Posters 11 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.
  • L Offline
    L Offline
    lacir
    wrote on last edited by
    #1

    Hi there, I am having the big problem with getting the area of hwind with routine GetWindowRect. Even Spy++ or his implementation returns rectangle, that is smaller than real area. Its a some special kind of application, I am looking for some alternative to GetWindowRect, or how can I get all the window area programmatically correct.

    L 1 Reply Last reply
    0
    • L lacir

      Hi there, I am having the big problem with getting the area of hwind with routine GetWindowRect. Even Spy++ or his implementation returns rectangle, that is smaller than real area. Its a some special kind of application, I am looking for some alternative to GetWindowRect, or how can I get all the window area programmatically correct.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      The GetWindowRect function returns the correct size of any window. If your code is not working then you need to provide more details.

      L 1 Reply Last reply
      0
      • L Lost User

        The GetWindowRect function returns the correct size of any window. If your code is not working then you need to provide more details.

        L Offline
        L Offline
        lacir
        wrote on last edited by
        #3

        Its casino application, I am using GetWindowRect standard way.

        L V 2 Replies Last reply
        0
        • L lacir

          Its casino application, I am using GetWindowRect standard way.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Sorry, but that tells us nothing.

          1 Reply Last reply
          0
          • L lacir

            Its casino application, I am using GetWindowRect standard way.

            V Offline
            V Offline
            Victor Nijegorodov
            wrote on last edited by
            #5

            Could you show your code?

            L 1 Reply Last reply
            0
            • V Victor Nijegorodov

              Could you show your code?

              L Offline
              L Offline
              lacir
              wrote on last edited by
              #6

              HWND hwnd = FindWindow("HwndWrapper[PokerClient.exe;;518cf654-e6cb-47c5-9916-be16cbf1e961]", NULL);
              GetWindowRect(hwnd, &wr);
              AdjustWindowRect(&wr, WS_BORDER, true);

              As I said its weird behaviour of GetWindowRect Edited code, it was from the last operation when I was trying get also parent window.

              V L 2 Replies Last reply
              0
              • L lacir

                HWND hwnd = FindWindow("HwndWrapper[PokerClient.exe;;518cf654-e6cb-47c5-9916-be16cbf1e961]", NULL);
                GetWindowRect(hwnd, &wr);
                AdjustWindowRect(&wr, WS_BORDER, true);

                As I said its weird behaviour of GetWindowRect Edited code, it was from the last operation when I was trying get also parent window.

                V Offline
                V Offline
                Victor Nijegorodov
                wrote on last edited by
                #7

                lacir wrote:

                HWND hwnd = FindWindow("HwndWrapper[PokerClient.exe;;518cf654-e6cb-47c5-9916-be16cbf1e961]", NULL);
                GetWindowRect(parrent, &wr);
                AdjustWindowRect(&wr, WS_BORDER, true);

                You call FindWindow but then ignore the value it returns. Then you are using some other value parrent as a windows handle to obtain the window rectangle for. Is it what you want? :confused:

                D 1 Reply Last reply
                0
                • L lacir

                  HWND hwnd = FindWindow("HwndWrapper[PokerClient.exe;;518cf654-e6cb-47c5-9916-be16cbf1e961]", NULL);
                  GetWindowRect(hwnd, &wr);
                  AdjustWindowRect(&wr, WS_BORDER, true);

                  As I said its weird behaviour of GetWindowRect Edited code, it was from the last operation when I was trying get also parent window.

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  You are calling AdjustWindowRect with the Window's dimensions. But the first parameter to AdjustWindowRect is supposed to be the dimensions of the client area of the Window.

                  1 Reply Last reply
                  0
                  • V Victor Nijegorodov

                    lacir wrote:

                    HWND hwnd = FindWindow("HwndWrapper[PokerClient.exe;;518cf654-e6cb-47c5-9916-be16cbf1e961]", NULL);
                    GetWindowRect(parrent, &wr);
                    AdjustWindowRect(&wr, WS_BORDER, true);

                    You call FindWindow but then ignore the value it returns. Then you are using some other value parrent as a windows handle to obtain the window rectangle for. Is it what you want? :confused:

                    D Offline
                    D Offline
                    deXo fan
                    wrote on last edited by
                    #9

                    This line:

                    GetWindowRect(parrent, &wr);

                    Should (probably!) either be:

                    GetWindowRect(hwnd, &wr);

                    Or:

                    GetWindowRect(GetParent(hwnd), &wr);

                    V 1 Reply Last reply
                    0
                    • D deXo fan

                      This line:

                      GetWindowRect(parrent, &wr);

                      Should (probably!) either be:

                      GetWindowRect(hwnd, &wr);

                      Or:

                      GetWindowRect(GetParent(hwnd), &wr);

                      V Offline
                      V Offline
                      Victor Nijegorodov
                      wrote on last edited by
                      #10

                      I don't know... :confused: The OP seems to disappear... :~

                      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