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. [q] How to control the other program's scrollbar?

[q] How to control the other program's scrollbar?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
4 Posts 3 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.
  • L Offline
    L Offline
    linugee
    wrote on last edited by
    #1

    Hi I'm a Korean.. How to control the other program(for example, MS Word, Internet Explore etc...)'s scrollbar? For example, when any button in my program is clicked, my program want to know other program's scrollbar's "range"(or page, position) in client area. how to???

    C 1 Reply Last reply
    0
    • L linugee

      Hi I'm a Korean.. How to control the other program(for example, MS Word, Internet Explore etc...)'s scrollbar? For example, when any button in my program is clicked, my program want to know other program's scrollbar's "range"(or page, position) in client area. how to???

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

      Why on earth would you want to do *that* ? If you enumerate the windows in some manner you can get the CWnd of another Window, then I presume you can call SetScrollPos, etc. Christian I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in. The early bird may get the worm, but it's the second mouse that gets the cheese.

      H 1 Reply Last reply
      0
      • C Christian Graus

        Why on earth would you want to do *that* ? If you enumerate the windows in some manner you can get the CWnd of another Window, then I presume you can call SetScrollPos, etc. Christian I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in. The early bird may get the worm, but it's the second mouse that gets the cheese.

        H Offline
        H Offline
        Hadi Rezaee
        wrote on last edited by
        #3

        Hi Christian. :) But how can i get CWnd pointer from other program ? My month article: Game programming by DirectX by Lan Mader. Please visit in: www.geocities.com/hadi_rezaie/index.html Hadi Rezaie

        C 1 Reply Last reply
        0
        • H Hadi Rezaee

          Hi Christian. :) But how can i get CWnd pointer from other program ? My month article: Game programming by DirectX by Lan Mader. Please visit in: www.geocities.com/hadi_rezaie/index.html Hadi Rezaie

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

          Like this :) BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam) { char* h = new char[255]; GetWindowText(hwnd,h,255); CString text(h); long wl = GetWindowLong(hwnd,GWL_STYLE); CArray* lb = (CArray*)lParam; if (text.GetLength()>0 && IsWindowVisible(hwnd) && text != "Program Manager" && text != "Window Popper") lb->Add(text); return TRUE; } In my code, lParam is a CArray ( nowadays I would use a vector ), and I check the title of the window to see if it's one I want to ignore and if it's visible ( not doing the visibility check gives you a gazillion hidden windows ) and then pass the title into my list. Then I do this in my main code: CArray list; EnumWindows(EnumWindowsProc, (long)&list); and I can do this: CWnd *pOtherWnd = CWnd::FindWindow(NULL, name); if I find the Window I want ( for example, I might search for the first four letters of the title to be Word, but the next three not to be Pad ), then I get the CWnd by calling FindWindow. If I know for sure something is running and it's full title, then I can just go to this step. Christian I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in. The early bird may get the worm, but it's the second mouse that gets the cheese.

          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