How do we disable only the Windows Close Icon from the Control Menu of a window.

Hi,

The users of a system which I support require the close icon "X" on a 
particular window to be removed or disabled. 

We could diable the Minimize or Maximize buttons or the entire Control 
Menu.  But I could not find a way to remove the close icon alone.

Thanks 
Sujatha.
0
sujatha
1/11/2001 3:44:04 PM
sybase.powerbuilder.general 62418 articles. 17 followers. Follow

4 Replies
823 Views

Similar Articles

[PageSpeed] 48

hi,
Here are two methods to do this.
1- use this ,
**globals ext. func.**
FUNCTION BOOLEAN EnableMenuItem(UINT hmenu, UINT d, UINT s) library
"user32.dll"
FUNCTION UINT  GetSystemMenu(UINT i_hwnd, BOOLEAN f) library "user32.dll"

**to disable the close box.**
uint hsysmenu
hsysmenu = GetSystemMenu(handle(this),FALSE)
EnableMenuItem(hsysmenu,6,1027)

**to enable the close box**
GetSystemMenu(handle(this),TRUE)

2 - Here is a another method but it doesnt disables the box, it only
disables the functionalty.
there is event named pbm_syscommand that recieves windows system messages.
You can disable the close request from here .
write this code to this event,
if message.wordparm = 61536 then //wm_close
 message.processed = True
 message.returnvalue = 0
end if
its prevents to close the window. In the sam technique yu can use the
closequery event to.



<sujatha> wrote in message
news:E3B33A877294B68A00566EA9852569D1.00566EBB852569D1@webforums...
Hi,

The users of a system which I support require the close icon "X" on a
particular window to be removed or disabled.

We could diable the Minimize or Maximize buttons or the entire Control
Menu.  But I could not find a way to remove the close icon alone.

Thanks
Sujatha.


0
Adnan
1/11/2001 4:29:02 PM
Since you don't need Minimize/Maximize/Restore and Close you don't need that
menu at all, so you can simply unckeck Control property for the window in the
Window painter

On Thu, 11 Jan 2001 11:08:15 -0500,
 in powersoft.public.powerbuilder.general
Roy Kiesler [TeamSybase] <SPAM_FREE_roy.kiesler@teamsybase.com> wrote: 
>Have a look at the attached demo -- it uses an API call to disable/remove
>the associated Close menu item, which disables the [x] button.
>
>--
><hopethishelps />
>Roy Kiesler [TeamSybase]
>mySybase - http://my.sybase.com
>
><sujatha> wrote in message
>news:E3B33A877294B68A00566EA9852569D1.00566EBB852569D1@webforums...
>> Hi,
>>
>> The users of a system which I support require the close icon "X" on a
>> particular window to be removed or disabled.
>>
>> We could diable the Minimize or Maximize buttons or the entire Control
>> Menu.  But I could not find a way to remove the close icon alone.
>>
>> Thanks
>> Sujatha.
>
>

---== Posted via the PFCGuide Web Newsreader ==---
http://www.pfcguide.com/_newsgroups/group_list.asp
0
Dmitriy
1/11/2001 4:41:19 PM
I think the following code will do the trick for you.  I found this bit of 
code on this
site, but do not remember the author, sorry :(


Function ulong GetSystemMenu (ulong hWnd, boolean bRevert) Library 
"user32.dll" 
Function boolean DeleteMenu (ulong hMenu, uint uPosition, uint uFlags) 
Library "user32.dll"
Function boolean DrawMenuBar (ulong hWnd) Library "user32.dll"

// System Menu Command Values
constant ulong SC_SIZE         = 61440
constant ulong SC_MOVE         = 61456
constant ulong SC_MINIMIZE     = 61472
constant ulong SC_MAXIMIZE     = 61488
constant ulong SC_NEXTWINDOW   = 61504
constant ulong SC_PREVWINDOW   = 61520
constant ulong SC_CLOSE        = 61536
constant ulong SC_RESTORE      = 61632
// Menu Flags 
constant ulong MF_BYCOMMAND       = 0

uLong hMenu
ulong hWnd

hWnd = Handle(this)

// get menu handle for this window's system menu 
hMenu = GetSystemMenu(hWnd, False)

// if successful, delete menu items from this window's system menu
// which is displayed when clicking the control box.
// delete menu items close, size, minimize, maximize, move
// DrawMenuBar will redraw the menu with the "deletemenu" changes applied

if hMenu > 0 then
   DeleteMenu(hMenu, sc_close, mf_bycommand)
   DrawMenuBar(hwnd)
end if

By removing items from the system menu of a window, the three boxes which 
normally
appear on the upper right corner of a window may be disabled.
0
anonymous
1/11/2001 10:28:18 PM
Thanks, it worked.
0
sujatha
1/12/2001 6:00:42 PM
Reply:

Similar Artilces:

how to open a pop up window by disabling the main window i.e pop up will remain in the main window until closing
 I need to make subpartitions of the contents of a form(transfring values from a page to a popup) and i need that when we click on a button on a page(main window) then a pop up will open by disabling the main window until n unless popup is closed.i.e focus will not lose from the popup until it is closed.RegardsSHOAIB RIZWAN see links below:http://microsoft.apress.com/asptodayarchive/73815/using-modal-dialog-boxes-in-aspnet-applications http://msdn.microsoft.com/en-us/magazine/cc164247.aspx google can be your friend :) Simply JS | june blog Or use this model on how to open ...

Disable Parent window until child window is closed
Hi, A a child window which reload its opener under certain condition. for this i m using parent.opener.location.reload(). Is there any way I can close my child window that is open. As i see, after parent window reload it would have lost its reference to the child window... Cos when i say child.close() it says child as undefined.Is there anything we could do to close the child window before opening another one? The problem is: I get permission denied error when my parent location changes and my pop up window refers to the previous parent location. If closing is not possible then can...

How to Control a Window from other Window
Hi, I have a window with a complex customer datawindow report (wr_report.dw_report)... Now, I need to automatize the printing of these reports. I will try explain in a simply way.... I've created a "controler window" with a reference to the "report window" w_report wr wr = create w_report I assing values from the "controler window" to the "report window". wr.t_from = x wr.t_ultil = y wr.t_customer = z wr.load_data() wr.print_data() On Debug I can see the parameters are right...

window icon multiplies as windows are closed/open in frame.
In our PB 7.1 application where the main window is of type "mdihelp" and all other windows are of type "main" and they open up within the mdi frame. There is only one main menu and that belongs to the "mdihelp" window type. If I open the first window within the frame using "OpenSheet(w_1,...) and then I open the second window within the same frame using "OpenSheet(w_2,...), I can switch betweeen these two windows form windows in the main windows frame. Now if I closed the w_2 and reopen w_2, the number of window icons becomes two and if I close w_...

superreview granted: [Bug 191871] Find as you type stops working after a while : [Attachment 159748] If focused window is in window hierarchy of window that's closing, clear menu flags
Johnny Stenback <jst@mozilla.jstenback.com> has granted Aaron Leventhal <aaronleventhal@moonset.net>'s request for superreview: Bug 191871: Find as you type stops working after a while https://bugzilla.mozilla.org/show_bug.cgi?id=191871 Attachment 159748: If focused window is in window hierarchy of window that's closing, clear menu flags https://bugzilla.mozilla.org/attachment.cgi?id=159748&action=edit ------- Additional Comments from Johnny Stenback <jst@mozilla.jstenback.com> r+sr=jst ...

superreview requested: [Bug 191871] Find as you type stops working after a while : [Attachment 159748] If focused window is in window hierarchy of window that's closing, clear menu flags
Aaron Leventhal <aaronleventhal@moonset.net> has asked Johnny Stenback <jst@mozilla.jstenback.com> for superreview: Bug 191871: Find as you type stops working after a while https://bugzilla.mozilla.org/show_bug.cgi?id=191871 Attachment 159748: If focused window is in window hierarchy of window that's closing, clear menu flags https://bugzilla.mozilla.org/attachment.cgi?id=159748&action=edit ------- Additional Comments from Aaron Leventhal <aaronleventhal@moonset.net> Seeking r+sr = jst ...

Closing all Child windows when Parent window is closed !!
Hi guys, I am trying to close all child windows when I close my parent window. First of all, I thought of doing this during page onunload event. But my application in asp.net will do many postbacks and everytime the onunload is called and hence my javascript array will be reinitialised everytime. So, I came with another approach where in I am storing the object in a hidden control at server side. So, when the child windows are open, i am adding the objects to the hidden control by appending a delimiter "~". When the parent is closed, I am fetching this array to javascript and the...

Close one window both window close bug
Name: Arquib Ismail Email: arquibismail123atgmaildotcom Product: Firefox Summary: Close one window both window close bug Comments: When i have 2 firefox windows open and i close one window by richtclicking on one firefox window on the taskbar and click close both windows close. Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b2) Gecko/2007121120 Firefox/3.0b2 ...

Closing all the new window when parent window is closed!
hi,  Consider that now i am opening a site 'www.asp.net' in the IE and after that i'm using ctrl+N or File->New->window to open a new window. Now if I close the first window, i want the window that is opened using ctrl+N to be closed. Is there any way to achieve this in Java Script?regards,M.S.PalaniSaami regards,M.S.PalaniSaami.http://dotnetcurve.blogspot.com/"Preserve our Mother: Earth" I dont think this is possible. But if you open any pop up from the main window you can close all the pop up once the main window is closedVikram www.vikramlakhotia.comPlea...

Disabling Windows File Protection in Windows 2000 and Windows XP
This short article is intended to clear up confusion about how to disable Windows File Protection. I've seen errant information posted in many places and felt it necessary to sum up the truth of the matter. When Windows File Protection was first introduced in Windows 2000 I found it bothersome. After doing some research on how to disable it I was surprised to learn that Microsoft only provided a mechanism to do so when a kernel debugger is active by setting the SFCDisable registry value to 1 or 2 . The MSDN article describing this is here: http://support.microsoft.com/support/kb...

On closing child window, control to focus back to a parent window textbox
I have a parent window which calls a child window. In the child window I select a value and it copies the value to a parent text box and closes the child window. My query is at the same time I want the control to move the focus to the parent text box as well. I am not currenly not able to move focus to a textbox in parent window. FYI, I use UpdatePanel and master page in the parent window and update panel in the child window. Have you implemented some code?If yes please post that code  Click on 'Mark as Answer' if this post is helpful.ImranKhan pathan  ...

Close all child windows as well when closing their parent window
Hi all: How can I implement this feature with JS?  Take nothing on looks; take everything on evidence.- Charles Dickens  You can implements this type of functionality by calling some function in child window which call using document.setInterval. In this function you can check for the parent object. if parent object is null that call seft.close();ThanksPankaj GohelPlease Mark as Answer if you find the post useful. Hi,   this.ClientScript.RegisterClientScriptBlock(this.GetType(), "Closeme", "window.opener.location.reload();window.close();", true)...

Closing nested child windows when closing the parent window
Hi I want to close all the child window when i close the parent window. Actually the scenario is from the parent window i am opening one child window and the child window contains DataGrid. The Datagrid contails the FooterTemplate and in the FooterTemplate a button will be placed so when we click on dat button it will once again opens one more child window. Now i want to close all the child and nested child windows should be closed when i close the parent window can any one help me plz Thanks in Advance Awaiting for reply Regards Krisamigo There really is no definite way to do that ...

i want to close popup window when i close main window
dear all, advance thanks...can anybody help me.... i am using VS 2005 web application based on VB. i am using this following code for popup the window.   Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), "popup", "window.open('webpopup.aspx?querystring','','scrollbars=yes,menubar=no,height=700,width=1000,resizable=yes,toolbar=no,location=no,status=no')", True) my requirements are 1.whether this code will work in firefox?if no how i want to call this for both IE and firefox 2.when i will close the main window i want to close thi...

Web resources about - How do we disable only the Windows Close Icon from the Control Menu of a window. - sybase.powerbuilder.general

How To Disable Facebook’s Tag Suggest
Facebook last week quietly reintroduced its tag suggest feature, which uses facial-recognition technology to assist users in tagging their friends ...

How do I disable the video autoplay? - Facebook-Hilfeforum - Facebook
Stop the video autoplay! Give an option to disable! STOP! STOP!

Whopper Sacrifice Forced to Disable Behavior by Facebook (Updated)
... waves for its creative (and aggressive) use of Facebook friend removals as a way to spread the application, Facebook has forced it to disable ...

Sitelinks Wont Disable - Flickr - Photo Sharing!
More at www.seroundtable.com/archives/018695.html

Disable Bullying. Lauren Potter (Glee Star) Speaks Out - YouTube
Lauren Potter of Glee and her mother Robin Sinkhorn speak out against the bullying of children with special needs. If you're inspired by their ...

Java Warning - PC users told to disable Java - Security Flaw
Despite a fix, US authority continues to recommend users disable Java in their browsers.

US DOT: Auto makers should disable in-dash electronics when cars are moving
Automobile makers should prevent drivers from using their in-vehicle electronic devices to browse the Internet and send text messages while their ...

Java Warning - PC users told to disable Java - Security Flaw
Despite a fix, US authority continues to recommend users disable Java in their browsers.

Java Hack - Experts Urge PC Users To Disable Java - Security Flaw
A flaw in Java software is so dangerous that people should stop using it, security experts warn. JavaScript disabled. Please enable JavaScript ...

Green tea 'disables hypertension drug'
... the world's healthiest drinks and is renowned for staving off heart disease and cancer. But a Japanese-led study has found that green tea disables ...

Resources last updated: 11/29/2015 10:04:07 PM