how to get GetTickCount value in golang(i am trying to get the idle time of the system ,i am able to get GETLASTINPUTINFO)

592 views
Skip to first unread message

Vijay Kumar Giri

unread,
Nov 18, 2015, 8:31:01 AM11/18/15
to golang-nuts
This is my soures  code ,i am geting value please help me whether the output is correct or not .

package main

import(
"syscall" 
"fmt"

func main(){

user32 := syscall.MustLoadDLL("kernel32.dll") 

getTickCount     := user32.MustFindProc("GetTickCount")
fmt.Printf("%T\n",getTickCount)
fmt.Println(getTickCount)
fmt.Println(getTickCount.Name)
//fmt.Println(getTickCount.addr)
}
===============================MY OUTPUT IS ======================================================================
*syscall.Proc
&{0xc0820046a0 GetTickCount 140735246786720}
GetTickCount
=================================================================================================================
This is my soures  code ,i am geting value please help me whether the output is correct or not .

Brad Fitzpatrick

unread,
Nov 18, 2015, 8:44:29 PM11/18/15
to Vijay Kumar Giri, golang-nuts
You have to call the Call method on the returned *syscall.Proc you get from MustFindProc...

Its signature is:
//    func (p *Proc) Call(a ...uintptr) (r1, r2 uintptr, lastErr error) {

So:

    ticks, _, err := getTickCount.Call()


--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages