1. dialog window
- Posted by Flaminio <newpow at TIN.IT> Sep 16, 1999
- 516 views
- Last edited Sep 17, 1999
--------------3F608431593 i'm not able to open a dialog window, i have alleged to this mail the file EXW that attempts to do it... What is wrong ? Can U help me ? Thanks Flaminio, Italy --------------3F608431593 Content-Disposition: inline; filename="wind.exw" include machine.e include dll.e without warning atom user,gdi,kernel,inddlgfrm,dlgtm dlgtm = allocate(28) user = open_dll("user32.dll") gdi = open_dll("gdi32.dll") kernel = open_dll("kernel32.dll") atom RegisterClass, LoadIcon, LoadCursor, GetStockObject, CreateWindow, PostQuitMessage atom ShowWindow, UpdateWindow, GetMessage, TranslateMessage, DispatchMessage atom DefWindowProc, GetLastError, DialogBoxIndirectParam RegisterClass = define_c_proc(user, "RegisterClassExA", {C_POINTER}) LoadIcon = define_c_func(user, "LoadIconA", {C_INT, C_INT}, C_INT) LoadCursor = define_c_func(user, "LoadCursorA", {C_INT, C_INT}, C_INT) GetStockObject = define_c_func(gdi, "GetStockObject", {C_INT}, C_INT) CreateWindow = define_c_func(user, "CreateWindowExA", {C_INT, C_INT, C_INT, C_INT, C_INT, C_INT, C_INT, C_INT, C_INT, C_INT, C_INT, C_INT}, C_INT) ShowWindow = define_c_proc(user, "ShowWindow", {C_INT, C_INT}) UpdateWindow = define_c_proc(user, "UpdateWindow", {C_INT}) GetMessage = define_c_func(user, "GetMessageA", {C_INT, C_INT, C_INT, C_INT}, C_INT) TranslateMessage = define_c_proc(user, "TranslateMessage", {C_INT}) DispatchMessage = define_c_proc(user, "DispatchMessageA", {C_INT}) PostQuitMessage = define_c_proc(user, "PostQuitMessage", {C_INT}) DefWindowProc = define_c_func(user, "DefWindowProcA", {C_INT, C_INT, C_INT, C_INT}, C_INT) DialogBoxIndirectParam = define_c_func(user, "DialogBoxIndirectParamA", {C_INT, C_INT, C_INT, C_INT, C_INT}, C_INT) GetLastError = define_c_func(kernel, "GetLastError", {C_INT}, C_INT) global function DlgFrm(atom hwnd, atom imsg, atom wparam, atom lparam) if imsg = 272 then return(1) -- 272 = WS_INITDIALOG else return(0) end if end function global function WndProc(atom hwnd, atom imsg, atom wparam, atom lparam) if imsg=2 then c_proc(PostQuitMessage, {0}) return(0) end if if imsg=15 then poke4(dlgtm, #00C80000) -- WS_CAPTION|WS_SYSMENU poke4(dlgtm+4, 0) poke4(dlgtm+8, 0) poke4(dlgtm+12, 2) poke4(dlgtm+16, 2) poke4(dlgtm+20, 5) poke4(dlgtm+24, 5) ? c_func(DialogBoxIndirectParam, {0, dlgtm, hwnd, inddlgfrm, 18}) ? c_func(GetLastError, {0}) -- the last function (getlasterror) gives 6 that means invalid hwnd return(0) end if return c_func(DefWindowProc, {hwnd, imsg, wparam, lparam}) end function procedure WinMain() atom ind,msg,id,st1,st2,indwndproc,hwd,id2 id2 = routine_id("DlgFrm") inddlgfrm = call_back(id2) ind = allocate(48) msg = allocate(40) id = routine_id("WndProc") st1 = allocate_string("pippo") st2 = allocate_string("pippa") indwndproc = call_back(id) poke4(ind, 48) poke4(ind+4, 3) poke4(ind+8, indwndproc) poke4(ind+12, 0) poke4(ind+16, 0) poke4(ind+20, 0) poke4(ind+24, c_func(LoadIcon, {0, 32512})) poke4(ind+28, c_func(LoadCursor, {0, 32512})) poke4(ind+32, c_func(GetStockObject, {0})) poke4(ind+36, 0) poke4(ind+40, st1) poke4(ind+48, c_func(LoadIcon, {0, 32512})) c_proc(RegisterClass, {ind}) hwd = c_func(CreateWindow, {0,st1,st2,#00CF0000, #80000000, #80000000, #80000000, #80000000, 0,0,0,0}) c_proc(ShowWindow, {hwd, 1}) c_proc(UpdateWindow, {hwd}) while c_func(GetMessage, {msg,0,0,0}) do c_proc(TranslateMessage, {msg}) c_proc(DispatchMessage, {msg}) end while end procedure WinMain() --------------3F608431593--
2. Re: dialog window
- Posted by Bernie Ryan <bwryan at PCOM.NET> Sep 16, 1999
- 506 views
On Thu, 16 Sep 1999 23:58:39 +0200, Flaminio <newpow at TIN.IT> wrote: >i'm not able to open a dialog window, i have alleged to this mail the >file EXW that attempts to do it... > What is wrong ? Can U help me ? Flaminio dlgtm ( DLGTEMPLATE ) should be total 18 bytes : style - 4 bytes ( DWORD ) styleext - 4 bytes ( DWORD ) cdit - 2 bytes ( WORD ) x - 2 bytes ( short ) y - 2 bytes ( short ) cx - 2 bytes ( short ) cy - 2 bytes ( short ) Bernie