Ladssoft
(wam)
1
Hello.
I want to minimize all windows (for Windows OS) using go.
In perl, this can be achived by simply importing the Win32::OLE module:
use Win32::OLE;
Win32::OLE->new(‘Shell.Application’)->MinimizeAll();
However I have so far not found a way to do this in go.
I appreciate any help
I don’t now how current this package is but maybe you can try:
https://github.com/go-ole/go-ole
I only work with Macs and Linux the last time I tried to interact with Windows over OLE was with Visual Basic 6 10 years ago…
There is also an example folder with some samples maybe you can figure it out?
Ladssoft
(wam)
3
Thanks for pointing me in the right direction, Norbert!
By looking at the function used with Perl, I did some
guesswork - and it turned out to be a very simple thing:
package main
import (
ole "github.com/go-ole/go-ole"
"github.com/go-ole/go-ole/oleutil"
)
func main() {
ole.CoInitialize(0)
unknown, _ := oleutil.CreateObject("Shell.Application")
shell, _ := unknown.QueryInterface(ole.IID_IDispatch)
oleutil.CallMethod(shell, "MinimizeAll")
}
Again, thanks a lot
1 Like
system
(system)
Closed
4
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.