Giter Site home page Giter Site logo

Comments (7)

Tecnologer avatar Tecnologer commented on August 15, 2024 1

the solution is the same as #80. Use this version: https://github.com/TheTitanrain/w32

from w32.

gonutz avatar gonutz commented on August 15, 2024

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:

https://github.com/gonutz/w32

from w32.

mateors avatar mateors commented on August 15, 2024

@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.

mateors avatar mateors commented on August 15, 2024

@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.

gonutz avatar gonutz commented on August 15, 2024

@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.

mateors avatar mateors commented on August 15, 2024

@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.

gonutz avatar gonutz commented on August 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.