<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("MediaPlayerClassicW")
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'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'd see the point in dealing with it, because they're all very different from C in their own ways.</p></pre>PaluMacil: <pre><p>Maybe he doesn'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'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'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'd like to, but there are a lot of things to do out there, and I haven'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't need C. Perhaps I'll force some time this weekend on your suggestion.</p></pre>gott_modus: <pre><p>Well, that's fair enough. As we get older it can be hard to feel motivated for things which don't have direct application - I don'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
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传