[S] moved some files. Added browser.nim.
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
# _____ ___ ____ ____ _____ ____ ____ _____ _____
|
||||
# |_ _/ _ \| _ \ / ___|| ____/ ___| _ \| ____|_ _|
|
||||
# | || | | | |_) | \___ \| _|| | | |_) | _| | |
|
||||
# | || |_| | __/ ___) | |__| |___| _ <| |___ | |
|
||||
# |_| \___/|_| |____/|_____\____|_| \_\_____| |_|
|
||||
|
||||
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)
|
||||
@@ -1,12 +0,0 @@
|
||||
import winim/lean
|
||||
|
||||
proc fileExists(filename: cstring): bool =
|
||||
result = GetFileAttributesA(filename) != INVALID_FILE_ATTRIBUTES
|
||||
|
||||
const
|
||||
filename = "C:\\path\\to\\your\\file.txt" # double-\ because it's an escape character.
|
||||
if fileExists(filename):
|
||||
echo "File exists."
|
||||
else:
|
||||
echo "File does not exist."
|
||||
|
||||
Reference in New Issue
Block a user