Help with w32 library

agolangf · · 383 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p><a href="https://github.com/AllenDang/w32/blob/master/user32.go" rel="nofollow">https://github.com/AllenDang/w32/blob/master/user32.go</a></p> <p>How do I use FindWindowW which takes two <code>*uint16</code>?</p> <pre><code>func FindWindowW(className, windowName *uint16) HWND { ret, _, _ := procFindWindowW.Call( uintptr(unsafe.Pointer(className)), uintptr(unsafe.Pointer(windowName))) return HWND(ret) </code></pre> <p>}</p> <p>What do I give it and where do I get it?</p> <hr/>**评论:**<br/><br/>silentcon: <pre><p>nvm I found out how:</p> <pre><code>classPtr := syscall.StringToUTF16Ptr(&#34;MediaPlayerClassicW&#34;) handle := w32.FindWindowW(classPtr, nil) </code></pre></pre>gott_modus: <pre><blockquote> <p>Win32 API with Go</p> </blockquote> <p>why not just write it in c then, man.</p></pre>Saltones: <pre><p>Weird reasoning. Maybe he doesn&#39;t want to touch C</p></pre>SilentWeaponQuietWar: <pre><p>gott_modus is basically a C troll account. Their post history is littered with low-effort posts that simply say:</p> <blockquote> <p>why not just write in c then, man.</p> </blockquote> <p>Seriously, he just uses that same response multiple times, in multiple threads.</p></pre>gott_modus: <pre><p>At this point, Go and C are similar enough to where it seems like it actually would be easier to work with Win32. If he was working in Java or C# or even Rust I&#39;d see the point in dealing with it, because they&#39;re all very different from C in their own ways.</p></pre>PaluMacil: <pre><p>Maybe he doesn&#39;t write C. I have a 10 year career with of C#, Python, Go, JavaScript, TypeScript, VBA, VBScript, SQL and never have I written C. Could I? Probably... do I want to? Yeah, I enjoy learning. Do I have time? Not right now.</p></pre>gott_modus: <pre><blockquote> <p>Maybe he doesn&#39;t write C. I have a 10 year career with of </p> <p>Do I have time? Not right now. </p> </blockquote> <p>Well, it&#39;s been 10 years. Sounds to me like you just need to make the time for it. If you like Go, C will come a bit more naturally. </p></pre>PaluMacil: <pre><p>I&#39;d like to, but there are a lot of things to do out there, and I haven&#39;t gotten into drivers, graphics, kernels, hardware, etc and have enough on my plate for a while with APIs, web frameworks, data processing, and various other things that don&#39;t need C. Perhaps I&#39;ll force some time this weekend on your suggestion.</p></pre>gott_modus: <pre><p>Well, that&#39;s fair enough. As we get older it can be hard to feel motivated for things which don&#39;t have direct application - I don&#39;t blame you.</p></pre>JHunz: <pre><p>You can want to take advantage of the significant features of Go and also simultaneously want to work with the Win32 API</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

383 次点击  
加入收藏 微博
0 回复
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传