I just got BlueGUI a few weeks ago so I'm not sure whether openDialog works properly for me, but I know that this code (to call the API manually) does work for me:
start_ion_system()
print openBox("Open...","All Images|*.bmp;*.jpg;*.jpeg|Bitmap Image|*.bmp|JPEG Image|*.jpg;*.jpeg|All Files|*.*")
suspend for key
end
function start_ion_system()
global user32num as byte
global kernel32num as byte
global comdlg32num as byte
enable_ion_system()
endfunction
function enable_ion_system()
user32num = get_free_dll()
load dll "user32.dll",255
kernel32num = get_free_dll()
load dll "kernel32.dll",254
comdlg32num = get_free_dll()
load dll "comdlg32.dll",comdlg32num
endfunction
function disable_ion_system()
delete dll user32num
delete dll kernel32num
delete dll comdlg32num
endfunction
function openBox(title as string,filefilter as string)
filepath as string
filepath = ion_internal_browseDialog(0,title,filefilter)
endfunction filepath
function ion_internal_browseDialog(browsetype as boolean,title as string,filefilter as string)
rem variables:
FileBoxFlags as dword
PathBufferSize as dword
hWnd as dword
hMod as dword
fileboxtitle as string
filepath as string
FileBoxFlags = 2627588
PathBufferSize = 256
hWnd = call dll(user32num,"GetActiveWindow")
hMod = call dll(kernel32num,"GetModuleHandleA",0)
filefilter = filefilter+"||"
title = title+"||"
dim memb(4) as word
memb(1) = get_free_memblock()
make memblock memb(1),76
memb(2) = get_free_memblock()
make memblock memb(2),PathBufferSize
memb(3) = get_free_memblock()
make memblock memb(3),len(filefilter)
memb(4) = get_free_memblock()
make memblock memb(4),len(title)
ion_internal_dump(memb(3),filefilter)
ion_internal_dump(memb(4),title)
write memblock dword memb(1),0,76
write memblock dword memb(1),4,hwnd
write memblock dword memb(1),8,hmod
write memblock dword memb(1),12,get memblock ptr(memb(3))
write memblock dword memb(1),28,get memblock ptr(memb(2))
write memblock dword memb(1),32,PathBufferSize
write memblock dword memb(1),52,FileBoxFlags
write memblock dword memb(1),48,get memblock ptr(memb(4))
if browsetype
call dll comdlg32num,"GetSaveFileNameA",get memblock ptr(memb(1))
else
call dll comdlg32num,"GetOpenFileNameA",get memblock ptr(memb(1))
endif
filepath = ion_internal_getStringDump(memb(2))
delete memblock memb(1)
delete memblock memb(2)
delete memblock memb(3)
delete memblock memb(4)
undim memb()
endfunction filepath
function ion_internal_dump(memblock_num,str as string)
p as dword
cur_byte as byte
for p=1 to len(str)
cur_byte=asc(mid$(str,p))
if cur_byte=asc("|") then cur_byte=0
write memblock byte memblock_num,p-1,cur_byte
next p
endfunction
function ion_internal_getStringDump(memblock_num)
p as dword
str as string
cur_byte as byte
do
cur_byte=memblock byte(memblock_num,p)
if cur_byte=0 then exit
str=str+chr$(cur_byte)
inc p
loop
endfunction str
function get_free_dll()
num as byte
num = 255
while num>0 and dll exist(num)
dec num
endwhile
endfunction num
If this doesn't work, might something be different about your windows API calls?
I hope this helps.
-Xol
XolTech, Ltd: IonRay IDE for DBPro in progress