May 09, 2024, 09:21:31 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


window with only minbox

Started by dossic, May 27, 2008, 04:03:56 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

dossic

Hi!
I'm trying to create a window with only the @minbox style without maxbox and closebutton.

I easily did that with other BASIC's, but I can't find the trick in EBASIC.

Sorry for the stupid question.

Thanks    Carlo


aurelCB


dossic

informing the user that the window cannot be closed but only minimized if they do not want to see messages on it.

Carlo

talun


aurelCB

Try this:DEF win:window
'Const MF_BYPOSITION = &H400&

WINDOW win,0,0,350,350,@sysmenu-1,0,"Main",main





run = 1
waituntil run = 0
closewindow win
end

sub main
select @class
case @idclosewindow
run=0
case @IDCREATE
CenterWindow win
endselect
return

aurelCB


LarryMc

This is the VB code referenced above converted to EBasic:


'--------- API Menu functions Required -------
DECLARE IMPORT, _GetSystemMenu ALIAS GetSystemMenu(hwnd AS INT,bRevert AS INT),INT
DECLARE IMPORT, _RemoveMenu ALIAS RemoveMenu(hMenu AS INT,nPosition AS INT,wFlags AS INT),INT

CONST MF_BYPOSITION = 0x400
'-----------------------------------------------
DEF w1 as WINDOW
DEF hMenu as INT

OPENWINDOW w1,0,0,350,350,@MINBOX|@SIZE,0,"Simple Window",&main

BEGINMENU w1
    MENUTITLE "Option"
        MENUITEM "Quit", 0, 2
ENDMENU
WAITUNTIL w1 = 0
END
'---
SUB main
SELECT @MESSAGE
    CASE @IDCREATE
DisableCloseWindowButton(w1)
CENTERWINDOW w1
    CASE @IDCLOSEWINDOW
    CLOSEWINDOW w1
    CASE @IDMENUPICK
        SELECT @MENUNUM
            CASE 2: ' user selected Quit
                CLOSEWINDOW w1
        ENDSELECT
ENDSELECT
RETURN
ENDSUB

Sub DisableCloseWindowButton(frm As window)

    Dim hSysMenu As int
    hSysMenu = _GetSystemMenu(frm.hwnd, 0)
    'Remove the Close menu item
    _RemoveMenu (hSysMenu, 6, MF_BYPOSITION)
    'Remove the seperator bar
    _RemoveMenu (hSysMenu, 5, MF_BYPOSITION)
return
endsub


Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

dossic

You are great!

Thanks so much     Carlo