| |

VerySource

 Forgot password?
 Register
Search
View: 1378|Reply: 8

Help: How to find the window handle

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-11-27 00:00:02
| Show all posts |Read mode
I would like to ask you prawns, how can I find the handle of the child window (generated by MFC), and then realize the control of the content of the child window, thank you!!!
Reply

Use magic Report

0

Threads

20

Posts

21.00

Credits

Newbie

Rank: 1

Credits
21.00

 China

Post time: 2020-11-27 00:15:01
| Show all posts
HWND FindWindow(
  LPCTSTR lpClassName, // pointer to class name
  LPCTSTR lpWindowName // pointer to window name
);
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-11-27 00:45:01
| Show all posts
1. Get the current Active View: CView* pActiveView = pMainFrame->GetActiveView();
2. Get all:
    POSITION pos = m_pDocManager->GetFirstDocTemplatePosition();
    CDocTemplate* pTemplate = m_pDocManager->GetNextDocTemplate(pos);
   
    POSITION docPos = pTemplate->GetFirstDocPosition();
    CDocument* pDoc = pTemplate->GetNextDoc(docPos);

    POSITION viewPos = pDoc->GetFirstViewPosition();
    CView* pView = pDoc->GetNextView(viewPos);

    CWnd* pFrameWnd = pView->GetParent();

    Operate in sequence.
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-11-27 10:00:01
| Show all posts
GetNextWindow() to traverse and find what you want
You can start from GetDesktopWindow()
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-11-27 17:30:01
| Show all posts
still is
HWND FindWindow(
  LPCTSTR lpClassName, // pointer to class name
  LPCTSTR lpWindowName // pointer to window name
);
Easy to use, haha
Reply

Use magic Report

0

Threads

18

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-11-28 14:45:01
| Show all posts
Can use SPY++
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2021-1-2 13:38:46
| Show all posts
HWND FindWindow()
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2021-1-16 15:53:28
| Show all posts
HWND FindWindow()
Reply

Use magic Report

3

Threads

11

Posts

944.00

Credits

Credits
944.00

 China

Post time: 2021-2-1 10:27:00
| Show all posts
Traverse the window, in fromwindow
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list