34 lines
1.1 KiB
Nim
34 lines
1.1 KiB
Nim
# _____ ___ ____ ____ _____ ____ ____ _____ _____
|
|
# |_ _/ _ \| _ \ / ___|| ____/ ___| _ \| ____|_ _|
|
|
# | || | | | |_) | \___ \| _|| | | |_) | _| | |
|
|
# | || |_| | __/ ___) | |__| |___| _ <| |___ | |
|
|
# |_| \___/|_| |____/|_____\____|_| \_\_____| |_|
|
|
|
|
import std/random
|
|
|
|
type
|
|
HANDLE* = int
|
|
HWND* = HANDLE
|
|
UINT* = int32
|
|
LPCSTR* = cstring
|
|
|
|
proc MessageBox*(hWnd: HWND, lpText: LPCSTR, lpCaption: LPCSTR, uType: UINT): int32
|
|
{.discardable, stdcall, dynlib: "user32", importc: "MessageBoxA".}
|
|
|
|
# example implementation: MessageBox(0, "Hello, world !", "Nim is Powerful", 0)
|
|
|
|
|
|
var
|
|
titlemessages = @["Are you really free?",
|
|
"Poland!"]
|
|
captionmessages = @["From the river to the sea, Palestine will be free.", "We are the people of Heaven.",
|
|
"War is peace. Slavery is freedom. Ignorance is strength.","Kurva mac!"] # todo: convert to cstrings
|
|
randomize() # seeds randomizer
|
|
|
|
var
|
|
randomtitle:cstring = sample(titlemessages).cstring
|
|
randommessage:cstring = sample(captionmessages).cstring
|
|
|
|
if isMainModule:
|
|
MessageBox(0, randomtitle, randommessage, 0)
|