aUCBLogo Demos and Tests / dltest
			
				
			
			to dltest
;   testINIDll
   ::user32=DynamicLibrary "user32
   ::kernel32=DynamicLibrary "kernel32
   hWnd=FindWindowA [aUCBLogo-4.7]
   show hWnd
   myWindow=CreateWindow "Hallo [Button] 0 0 300 200 200 100 hWnd 0
   ignore ShowWindow :myWindow
   moveDemo :myWindow
   ignore readChar
   show DestroyWindow :myWindow
   (show "GetCurrentDirectory "; GetCurrentDirectory)
end
to moveDemo :hWnd
   maxx=GetScreenMaxX
   maxy=GetScreenMaxY
   y=0
   dy=0
   ddy=1
   x=(GetWindowRect hWnd).1
   dx=1
   while [not key?]
   [   y=y+dy
      if or y > maxy y < 0 [y=y-dy dy=-dy]
      dy=dy+ddy
      x=x+dx
      if or x > maxx x < 0 [x=x-dx dx=-dx]
      MoveWindow hWnd x y
      dispatchMessages
   ]
   MoveWindow hWnd 0 0
end
to testINIDll
   INIDll=DynamicLibrary "inidll
   show INI_SetPfad [test.ini]
   show INI_SetWert [TestSection1][TestName1] 1234
   show INI_SetWert [TestSection2][TestName2] [Hallo]
   pr INI_GetWert [TestSection2][TestName2]
   throw "stop
end
to INI_SetPfad filename
   output DLCall INIDll [SetPfad] (list "Bool
      "Pfad "Word filename
      "Anlage "Bool true)
end
to INI_SetWert section valname value
   output DLCall INIDll [SetWert] (list "Bool
      "Abschnitt "Word section
      "ItemName "Word valname
      "ItemWert "Word value
      "Anlage "Bool true)
end
to INI_GetWert section valname
   value=StringBuffer 256
   result=DLCall INIDll [GetWert] (List "Bool
      "Abschnitt "Word section
      "ItemName "Word valname
      "ItemWert "Word value)
   if not result [throw "Error]
   output StringBufferToWord value
end
to SetFocus hWnd
   ignore DLCall user32 [SetFocus] (list "Int
      "hWnd "Int hWnd)
end
to ShowWindow hWnd
   output DLCall user32 [ShowWindow] (list "Int
      "hWnd "Int hWnd
      "nCmdShow "Int 1)
end
to CreateWindow _name classname exstyle style x y width height parent menu
   output DLCall user32 [CreateWindowExA] (list "Int
      "dwExStyle "Int exstyle
      "lpClassName "word classname   ;pointer to registered class name 
      "lpWindowName "word _name   ;pointer to window name 
      "dwStyle "Int style      ;window style 
      "x "Int x   ;horizontal position of window 
      "y "Int y   ;vertical position of window 
      "nWidth "Int width      ;window width 
      "nHeight "Int height   ;window height 
      "hWndParent "Int parent   ;handle to parent or owner window 
      "hMenu "Int menu   ;handle to menu or child-window identifier 
      "hInstance "Int LogoInstance   ;handle to application instance 
      "lpParam "Int 0      ;pointer to window-creation data 
   )
end 
to DestroyWindow hWnd
   output DLCall user32 [DestroyWindow] (List "Int
      "hWnd "Int hWnd)
end
to FindWindowA title
   output DLCall user32 [FindWindowA] (list "Int 
      "Class "Int 0
      "Title "Word title)
end
to GetParent hWnd
   output DLCall user32 [GetParent] (list "Int 
      "hWnd "Int hWnd)
end
to GetSystemMetrics index
   output DLCall user32 [GetSystemMetrics] (list "Int
      "index "Int index)
end
to GetScreenMaxX
   output GetSystemMetrics 0
end
to GetScreenMaxY
   output GetSystemMetrics 1
end
to GetWindowRect hWnd
   local [status iarr]
   iarr=IntArray 4
   status=DLCall user32 [GetWindowRect] (list "Int
      "hWnd "Int hWnd
      "rect "IntArray iarr)
   output iarr
end
to MoveWindow hWnd x y
   local [xy status]
   rect=GetWindowRect hWnd
   status=DLCall user32 [MoveWindow] (list "Int
      "hWnd "Int hWnd
      "X "Int x 
      "Y "Int y
      "nWidth "Int rect.3-rect.1
      "nHeight "Int rect.4-rect.2
      "bRepaint "Int 1)
end
to GetCurrentDirectory
   local [buf status w]
   buf=StringBuffer 256
   status=DLCall kernel32 [GetCurrentDirectoryA] (list "Int
      "bufferLength "Int count buf
      "buffer "Word buf)
   output StringBufferToWord buf
end