How to use windows DLLs?

Hello, I am new in this realm. I do not have any experience with DLLs from any language. I want to get device properties from Win32_PnPEntity. I need available com ports with device names. I found workaround for this:
cmd := exec.Command(“wmic”, “path”, “win32_PNPEntity”, “where”, “Name like ‘%(COM%’”, “get”, “Name”)
out := bytes.Buffer{}
cmd.Stdout = &out
cmd.Stderr = &out
err := cmd.Run()
I want to use dll for this pupose, because, I think it’s the right way, + I want to understand more about go ways with libraries.
Needed DLL libraries is CIMWin32.dll. I dont know how to get win32_PNPEntity data from this dll. Can anyone give me tips on how to understand what to do? How to get dll data, how to use it and so on…

Thanks.

Here is an article about loading and calling DLL functions in Go: https://github.com/golang/go/wiki/WindowsDLLs

It appears to ignore all error handling, which I don’t recommend you follow.

you could also look at existing packages to see examples.
like what is done for lxn/walk with the lxn/win package (witch is re-used by several others…).

OK, I will tray to check them. Thank you.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.