In one of my codes which uses User32APIs, I need to transmit more
than 9 parameters to the DLL, what is apparently feasible with the
memblocks and the types of datas.
I started to test on a simple function of the DLL, ShowWindow,
which contains only two parameters, but, that doesn't work.
` set in window mode using DBpro
set window on
` load the dll
global user32 = 1
load dll "user32",user32
` define constants usable with user32 ShowWindow command
#constant SW_HIDE = 0
#constant SW_NORMAL = 1
#constant SW_MAXIMIZE = 3
#constant SW_MINIMIZE = 6
#constant SW_RESTORE = 9
#constant SW_SHOW = 5
#constant SW_SHOWDEFAULT = 10
#constant SW_SHOWMAXIMIZED = 3
#constant SW_SHOWMINIMIZED = 2
#constant SW_SHOWMINNOACTIVE = 7
#constant SW_SHOWNA = 8
#constant SW_SHOWNOACTIVATE = 4
#constant SW_SHOWNORMAL = 1
` get the active window handle
hWnd = call dll(user32,"GetActiveWindow")
` create the memblock and fill it with datas
` dword = 4 bytes
make memblock 1,8
write memblock dword 1,0,hWnd
write memblock dword 1,4,SW_MAXIMIZE
` create a type for the dll declaration and create a var
type ShowWindow
hWnd as dword
nCmdShow as dword
endtype
maximize as ShowWindow
maximize.hWnd = hWnd
maximize.nCmdShow = SW_MAXIMIZE
` call the function
` declaration = hWnd As Long, nCmdShow as long
result = call dll(user32,"ShowWindow",hWnd,SW_MAXIMIZE) ` this line work without problem
result = call dll(user32,"ShowWindow",get memblock ptr(1)) ` this doesn't work
result = call dll(user32,"ShowWindow",maximize) ` idem : doesn't work
` display the result of the dll command, and some info
print "Handle = ",hWnd
print "Pointer = ",*maximize," , ",maximize
print "Result = ",result
` wait then end
wait key
Can somebody say me what's wrong with my code, please ?
RPG Engine and Odyssée : http://modsoftware.ifrance.com