Download Jar. Uses 3917K of libraries. Click here for Pure Java version (2561L/16K).
1 | !7 |
2 | |
3 | !include once #1030303 // JNA Win32 |
4 | |
5 | p {
|
6 | User32.INSTANCE.EnumWindows(new WNDENUMPROC {
|
7 | int count = 0; |
8 | @Override |
9 | public boolean callback(HWND hWnd, Pointer arg1) {
|
10 | char[] windowText = new[512]; |
11 | User32.INSTANCE.GetWindowText(hWnd, windowText, windowText.length); |
12 | new RECT rect; |
13 | User32.INSTANCE.GetWindowRect(hWnd, rect); |
14 | S wText = Native.toString(windowText); |
15 | |
16 | // get rid of this if block if you want all windows regardless of whether |
17 | // or not they have text |
18 | if (wText.isEmpty()) {
|
19 | return true; |
20 | } |
21 | |
22 | print("Found window with text " + hWnd + ", total " + ++count
|
23 | + " Text: " + wText + ", rect: " + rect); |
24 | return true; |
25 | } |
26 | }, null); |
27 | |
28 | print("done");
|
29 | } |
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1030296 |
| Snippet name: | List Windows on Windows |
| Eternal ID of this version: | #1030296/10 |
| Text MD5: | 0e52bb681fe0ebffb83f95b666587558 |
| Transpilation MD5: | 722bb402fa08f625eb3cb9ff53f8cb33 |
| Author: | stefan |
| Category: | javax / windows |
| Type: | JavaX source code (desktop) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-11-30 13:41:52 |
| Source code size: | 816 bytes / 29 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 733 / 1867 |
| Version history: | 9 change(s) |
| Referenced in: | [show references] |