Hello,
Is it possible to open a Child Window, and have the Close button removed?
Thanks,
Brian
I dont know that is this problematic part becose i dont try this before .
i think that on dialog things are easier.
After few mumbo-jumbo api-s .
i find this Vb example on internet and convert this to Cb code ,but i think that will work on EBasic to.
However i dont get it on the end window without CloseBox but is disabled.
'MAIN SKELETON
DEF w1:window
DEF a,b,c,d,e,f,g,h,i,j,k,l:int
def text:string
def hmenu:uINT
const CP_NOCLOSE_BUTTON = &H200
const CS_NOCLOSE = 0x200
CONST WS_OVERLAPPED = 0x0
CONST WS_CAPTION = 0xC00000
CONST MF_BYPOSITION = 0x400
Const MF_REMOVE = &H1000
declare "user32",GetSystemMenu(hwnd AS INT,bRevert AS INT),INT
declare "user32",RemoveMenu(hMenu AS INT,nPosition AS INT,wFlags AS INT),INT
declare "user32",GetMenuItemCount(hMenu AS INT),INT
Window w1,0,0,500,400,@caption,0,"NoCloseBox",main
setwindowcolor w1,rgb(200,200,200)
'
'-------------------------------------------------------
CONTROL w1,"B,Close Window,380,54,100,20,0x50000000,1"
showwindow w1,@swhide
' get the handle of the system menu
hMenu = GetSystemMenu(w1, 0)
' get the number of items in the menu
itemCount = GetMenuItemCount(hMenu)
'remove the system menu Close menu item
RemoveMenu(hMenu,itemCount - 1, MF_REMOVE|MF_BYPOSITION)
'remove the system menu separator line
RemoveMenu (hMenu, itemCount - 2, MF_REMOVE|MF_BYPOSITION)
showwindow w1,@swrestore
'----------------------------------
run=1
waituntil run=0
closewindow w1
end
'----------------------------------
Sub main
select @class
case @idclosewindow
run=0
case @idcreate
centerwindow w1
'--------------------------------
case @idcontrol
IF @controlid=1
run=0
ENDIF
'------------------------------
endselect
Return
Hmm weird EBasic show error or i do something wrong ???
EBasic version:
'MAIN SKELETON
DEF w1:window
DEF a,b,c,d,e,f,g,h,i,j,k,l:int
def text:string
def hmenu:UINT
const CP_NOCLOSE_BUTTON = &H200
const CS_NOCLOSE = 0x200
CONST WS_OVERLAPPED = 0x0
CONST WS_CAPTION = 0xC00000
CONST MF_BYPOSITION = 0x400
Const MF_REMOVE = 0x1000
declare import,GetSystemMenu(hwnd AS INT,bRevert AS INT),INT
declare "user32",RemoveMenu(hMenu AS INT,nPosition AS INT,wFlags AS INT),INT
declare "user32",GetMenuItemCount(hMenu AS INT),INT
OpenWindow w1,0,0,500,400,@caption,0,"NoCloseBox",&main
Setwindowcolor w1,rgb(200,200,200)
'
'-------------------------------------------------------
CONTROL w1,@SYSBUTTON,"Close Window",380,54,100,20,0x50000000,1
'showwindow w1,@swhide
' get the handle of the system menu
hMenu = GetSystemMenu(w1, 0)
' get the number of items in the menu
itemCount = GetMenuItemCount(hMenu)
'remove the system menu Close menu item
RemoveMenu(hMenu,itemCount - 1, MF_REMOVE|MF_BYPOSITION)
'remove the system menu separator line
RemoveMenu (hMenu, itemCount - 2, MF_REMOVE|MF_BYPOSITION)
'showwindow w1,@swrestore
'----------------------------------
run=1
waituntil run=0
closewindow w1
end
'----------------------------------
Sub main
select @class
case @idclosewindow
run=0
case @idcreate
centerwindow w1
'--------------------------------
case @idcontrol
IF @controlid=1
run=0
ENDIF
'------------------------------
endselect
Return
EndSub
Error is:
Compiling...
NoCloseX.eba
File: C:\Program Files\EBDev\projects\NoCloseX.eba (27) no appropriate conversion exists
Error(s) in compiling "C:\Program Files\EBDev\projects\NoCloseX.eba"
hMenu = GetSystemMenu(w1, 0)
What kind of conversion dont work here?
The answer(and example) is here:
http://www.ionicwind.com/forums/index.php/topic,2483.msg21203.html#msg21203
LarryMc
Aurel and Larry,
Thanks for the answers. And I am so sorry - I should have
searched harder. The answers to almost everything are
usually here . . .
Brian
So there is the catch :)
Thanks Larry.
Quote from: Brian Pugh on April 10, 2010, 04:27:04 PM
..... I should have
searched harder. The answers to almost everything are
usually here . . .
Brian
Sometimes I ask a question here and then I find out it was asked by ME before and answered!!!
So not to worry.
The only times I get a little aggravated is when a question is asked with little or no details/code and there are a 1,000 possible answers.
And even at that, I have been guilty of a few times. ;)
LarryMc