Hello, everybody. Happy to introduce my new project -
[Winim](https://github.com/khchen/winim).
I like Nim, and I usually coding under Windows. There is a oldwinapi for
Windows API wrapper. But it is old and incompleted. So I start this project.
Compare to oldwinapi, this module:
* More complete (of course).
* Switch between unicode/ansi mode without problem.
* Easily deal with wide-char string and multibyte string like built-in string
type.
* Add Winodws COM support, use Nim to play with COM object like a script
language.
**Install**
nimble install https://github.com/khchen/winim
**MessageBox Example**
import winim
MessageBox(0, "Hello, world !", "Nim is Powerful", 0)
**Interface Example**
import os, winim
var
pIL: ptr IShellLink
pPF: ptr IPersistFile
try:
CoInitialize(nil)
if CoCreateInstance(&CLSID_ShellLink, nil, CLSCTX_LOCAL_SERVER,
&IID_IShellLink, cast[ptr PVOID](&pIL)).FAILED: raise
defer: pIL.Release()
if pIL.QueryInterface(&IID_IPersistFile, cast[ptr PVOID](&pPF)).FAILED:
raise
defer: pPF.Release()
if pIL.SetPath(getAppFilename()).FAILED or pPF.Save("link.lnk",
true).FAILED: raise
except:
echo "something wrong !!"
**COM Example**
import winim.com
comScript:
var dict = CreateObject("Scripting.Dictionary")
dict.add("a", "the")
dict.add("b", "quick")
dict.add("c", "fox")
dict.item("c") = "dog" # this line needs comScript macro
for key in dict:
echo key, " => ", dict.item(key)
More details on website.