Comments (7)
the solution is the same as #80. Use this version: https://github.com/TheTitanrain/w32
from w32.
I have an actively maintained fork which I use to create both 32 and 64 bit applications, both for work and for private projects. It has diverged quite a bit from this original fork. You could give it a try instead:
from w32.
@gonutz I have gone through your repo, could you please write a README.md file with the basic step by step implementation with few example how we can use it.
from w32.
@gonutz can you guide me how can i get a window handle from a process id? basically i want to grab the running browser url. currently i get the process list and process id but no idea how to get the job done. i have read Microsofts windows api guideline but its too huge that i cant find any option. i am struggling since last week.
from w32.
@mateors I think that is a great idea, I will think of some examples with common tasks to guide people through some very basic Windows API concepts and then put links to MSDN in the readme as well. Since the Windows API is huge there could be thousands of samples but the real documentation is that of the WinAPI itself, which is at MSDN.
As to your concrete problem, I usually use the EnumWindows for these things and then just scan the window class or window title for what I want. This little piece of code:
package main
import (
"fmt"
"github.com/gonutz/w32"
)
func main() {
w32.EnumWindows(func(w w32.HWND) bool {
fmt.Println(w32.GetWindowText(w))
return true
})
}
will print a bunch of window titles, one of which reads
user32.go:1039:10: cannot use flag (type uint32) as type uintptr in argument to procRedrawWindow.Call · Issue #83 · AllenDang/w32 - Mozilla Firefox
which ends in Mozilla Firefox
. This gives me the HWND window handle of the browser. Unfortunately browsers are typically implemented with custom controls, see this stackoverflow question and answer. This means you cannot just call EnumChildWindows and search for URLs but instead have to do something more involved. For this I do not know the solution. If you find it, please share it here, I would be interested as I have tried something like this in the past but then chose a different route eventually.
from w32.
@gonutz Thank your for your quick response.
I am working on it, if i get any solution definitely share with you.
could you please give me an example of EnumProcesses() ? how i get process list using this func?
Also don't forget to share your email.
from w32.
Alright, I just updated the API of EnumProcesses and added a new function EnumAllProcesses. Please pull the latest changes and just call EnumAllProcesses to get all process IDs in the system.
from w32.
Related Issues (20)
- Unable to install after 1 May merges HOT 1
- Could not determine kind of name for C.DWORD and C.INPUT HOT 7
- mobiles HOT 2
- why this package need cgo?
- add RedrawWindow and RDW_FRAME
- Does this package need panic when error is return or just return the error? HOT 1
- Cannot run in windows7 64bit。why?How can fix it? HOT 4
- I've gotten an error "0x3b02 User stopped resource enumeration." while I used the ExtractIcon HOT 1
- failed install on Windows 10 Home 64 bit HOT 5
- restart gracefully
- cannot use flag (type uint32) as type uintptr in argument to procRedrawWindow.Call HOT 2
- Unable to Use for cross compiling HOT 1
- GPL HOT 1
- I Tried to pull the package and i got a error HOT 1
- how to check current user language (locale)
- how do i use go to call DLL
- [The solution] user32.go:1039:10: cannot use flag (type uint32) as type uintptr in argument to procRedrawWindow.Call HOT 5
- Is there an example of the call of readeventlog? Thank you
- Callback example
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from w32.