Close button and RichTextbox

How do I get rid of (or disable) the little Close button 
at the upper right hand corner on a child form? I have 
only figured out how to hide the Maximum and Minimum 
buttons, but not the Close button. Any suggestion?

Also, how to determine the number of lines entered in a 
RichTextbox? Where can I retrieve that piece of 
information?

Thanks!!

0
anonymous (74722)
11/18/2003 5:59:42 AM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
633 Views

Similar Articles

[PageSpeed] 55

"C.L." <anonymous@discussions.microsoft.com> wrote in message
news:027f01c3ad99$28a9bd00$a401280a@phx.gbl...
> How do I get rid of (or disable) the little Close button
> at the upper right hand corner on a child form? I have
> only figured out how to hide the Maximum and Minimum
> buttons, but not the Close button. Any suggestion?
>

In your OnInitDialog() function at the top of all other code, add this:

CMenu* pMenu = GetSystemMenu(FALSE);
 pMenu->DeleteMenu(pMenu->GetMenuItemCount() - 1, MF_BYPOSITION);

This will remove the close menu option from the system menu on the dialog,
as well as disable the close button on the top right of the form.

> Also, how to determine the number of lines entered in a
> RichTextbox? Where can I retrieve that piece of
> information?
>
> Thanks!!
>


0
jestock1 (39)
11/18/2003 11:16:23 AM
This is a very, very poor method for doing this. If the format of the menu changes, this
will fail, since it presumes, erroneously, that the LAST menu item is the close item. This
is not always true. There are third-party add-in programs that add items to menus of other
programs. And you have no idea where they add them.

pMenu->DeleteMenu(SC_CLOSE, MF_BYCOMMAND);

always works.
				joe


On Tue, 18 Nov 2003 05:16:23 -0600, "Joe Estock" <jestock@NOSPAMnutextonline.com> wrote:

>"C.L." <anonymous@discussions.microsoft.com> wrote in message
>news:027f01c3ad99$28a9bd00$a401280a@phx.gbl...
>> How do I get rid of (or disable) the little Close button
>> at the upper right hand corner on a child form? I have
>> only figured out how to hide the Maximum and Minimum
>> buttons, but not the Close button. Any suggestion?
>>
>
>In your OnInitDialog() function at the top of all other code, add this:
>
>CMenu* pMenu = GetSystemMenu(FALSE);
> pMenu->DeleteMenu(pMenu->GetMenuItemCount() - 1, MF_BYPOSITION);
>
>This will remove the close menu option from the system menu on the dialog,
>as well as disable the close button on the top right of the form.
>
>> Also, how to determine the number of lines entered in a
>> RichTextbox? Where can I retrieve that piece of
>> information?
>>
>> Thanks!!
>>
>

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
11/18/2003 6:35:01 PM
Thanks a lot for both of your suggestions! It works. In 
fact, I chose to disable the menu item instead.

>-----Original Message-----
>This is a very, very poor method for doing this. If the 
format of the menu changes, this
>will fail, since it presumes, erroneously, that the LAST 
menu item is the close item. This
>is not always true. There are third-party add-in programs 
that add items to menus of other
>programs. And you have no idea where they add them.
>
>pMenu->DeleteMenu(SC_CLOSE, MF_BYCOMMAND);
>
>always works.
>				joe
>
>
>On Tue, 18 Nov 2003 05:16:23 -0600, "Joe Estock" 
<jestock@NOSPAMnutextonline.com> wrote:
>
>>"C.L." <anonymous@discussions.microsoft.com> wrote in 
message
>>news:027f01c3ad99$28a9bd00$a401280a@phx.gbl...
>>> How do I get rid of (or disable) the little Close 
button
>>> at the upper right hand corner on a child form? I have
>>> only figured out how to hide the Maximum and Minimum
>>> buttons, but not the Close button. Any suggestion?
>>>
>>
>>In your OnInitDialog() function at the top of all other 
code, add this:
>>
>>CMenu* pMenu = GetSystemMenu(FALSE);
>> pMenu->DeleteMenu(pMenu->GetMenuItemCount() - 1, 
MF_BYPOSITION);
>>
>>This will remove the close menu option from the system 
menu on the dialog,
>>as well as disable the close button on the top right of 
the form.
>>
>>> Also, how to determine the number of lines entered in a
>>> RichTextbox? Where can I retrieve that piece of
>>> information?
>>>
>>> Thanks!!
>>>
>>
>
>Joseph M. Newcomer [MVP]
>email: newcomer@flounder.com
>Web: http://www.flounder.com
>MVP Tips: http://www.flounder.com/mvp_tips.htm
>.
>
0
anonymous (74722)
11/18/2003 7:12:29 PM
Reply:

Similar Artilces:

transfer a field using button
Hi I have a button which opens a form called Second Form; this form has a client ID and the main form also has a client ID. When I create a new form, it gives me a client ID however what I want is the client ID to be generated from the first form. HEre's the code generated: Private Sub Ctl1Y_Form_Click() On Error GoTo Err_Ctl1Y_Form_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "Second Form" stLinkCriteria = "[Client ID]=" & "'" & Me![Client ID] & "'" DoCmd.Open...

Can't see current users expansion button
When I try to follow the directions below to see who is currently logged inot GPS v. 9, I don't get the expansion button the directions refer to. Any ideas? Go to >>Help>>Index>>for keyword to find, enter "user login activity window" You will get the following: File >> User and Company >> Current Users expansion button Use the User Login Activity window to view the users currently accessing Microsoft Dynamics GP, the company each is working in, and the date they started working with that company (based on the internal clock of the current ...

How to lock closed opportunities
Hi, I would like to prevent users from re-opening closed opportunities after a certain period from the Actual Closed Date. This is to prevent them from changing some of the information. The best would be to disable the "Reopen Opportunity" option in the Actions menu for the closed opportunity. I found that there is no access to the menu if I want to use javascript and workflow manager does not seem to cater for this scenario. I also looked at the security privileges but it does not have controls to menu level. Can anyone advise me how I can solve this? Thanks. Hi, Put the...

Annoying Prompt at Close
Hi all, I have an Excel workbook that was originally written in Quattro Pro and later converted to Excel. Every time I close the workbook, even though I have NOT made any changes, it asks me if I want to save the "changes". This is very annoying. Can anyone tell me what I could do to get rid of this prompt? Thanks. CC, you may have a formula in the sheet that is calculating every time the workbook is open, something like =NOW() -- Paul B Always backup your data before trying something new Using Excel 2000 & 97 Please post any response to the newsgroups so others can be...

"save" button not requerying as coded
Using Access 2007 I have a form (frmNewFamily) that is opened when a NotInList event is triggered from a subform in a different form (frmAttendance/sfrAttendee). I have a "Save" button on the frmNewFamily that will save the record, close the frmNewFamily and requery the combo boxes on sfrAttendee. I have it working just great, but I want to delete one of the combo boxes. But as soon as I comment out the requery line, the Save button stops functioning properly. It will save the record to the table, but not close the form or requery the combo box. The same thing...

Predefibed command buttons in 2007??
PPT 2007 on WinXP Just wnet looking for my old friends from teh XP version, those predefined commands buttons for Next slide, previous slide, End and beginning of presentation. Can't find them. The only option I see for command buttons is to insert VBA code. Are these functions still available, but just hiding from me. can anyone point me in teh direction of these tools? If these predefined command buttons are truly no langer part opf PPT 07 can you offer the code to do "next slide", "previous Slide", "End of show", and "Beginning of show...

Trying to make a duplicate roster with a button.
Previously posted in wrong forum. 'HERE' (http://www.excelforum.com/showthread.php?t=265167) Thanks for the help guy -- virte ----------------------------------------------------------------------- virtex's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1488 View this thread: http://www.excelforum.com/showthread.php?threadid=26517 ...

Closing Access
I have a split database. On the frmSwitchboard form I have a CmdExit button that closes all the forms and recorsets which are connected to the backend, then uses the DBEngine to compact and backup the database. Since there are several frontends to this database, I would like to know if there is a way to force people to use the CmdExit button to exit the database rather then using the default Windows X button that is located in the top right corner of the Access container? Can the Close button be removed or disabled? I know it can be removed from forms, but I haven't seen or read...

Trying to Open Tools in Word closes program
We have recently upgraded to a Roaming Profile System at our office. We have an employee that can't open Tools from the menu in Word. The program closes and askes if you want to send the data to Microsoft. I logged off her account and logged on mine and I am able to access the Tools menu using the same computer in each instance. This says to me that it's a profile problem, but I have no idea what the solution would be. I have tried doing a repair and reinstalling. Neither of these solutions worked. Any other ideas? Thanks I think I would completely remove the program, reb...

outlook 2003 doesnt close
Evrytime I close outlook 2003, I have this error message. "Outlook is not responding If you are using an Exchange Server email account, you can cancel pending server requests by clicking the Outlook icon in the notification area, and then clicking Cancel Service Request on the shortcut menu." If I try to start again outlook, it will create another process in task manager. The only way I can close outlook is by ending the process (outlook.exe) from the task manager. I am using winXP and I have all the patches for xp and office 2003. Also I reinstall the office and still doesnt ...

Excel 2000 Workbook close button hides instead of close
We received an excel file in email. When we click the Workbook close button (the X) it hides the work book instead of closing it. When we unhide it, something changes and the close button works as normal, but we are asked to save changes even if we don't make any. Looks like there is some code in the background doing something or other. I'd check the workbook code, particulary the Workbook_BeforeClose event. It is more likely some code or functions are changing the worksheet contents than a bug in Excel. -- Regards, Bill Lunney www.billlunney.com "Steven Robinson" &...

Button not bring up Macro I created
I have created a Macro and a button that is suppose to link to the Macro. The button I created can't find the Macro. Does anyone know a good place to find a how to for this? Thanks Right click the button, on the dropdown click 'Assign Macro' The list of macro's will appear, assign the appropriate one to the button, Regards, Alan. "A.S." <A.S.@discussions.microsoft.com> wrote in message news:295A08DB-21DD-45D3-A610-525182AE40B8@microsoft.com... >I have created a Macro and a button that is suppose to link to the Macro. >The > button I created can...

Dynamic creation of owner-drawn button inside a dialog
Hi some months ago I created a owner-drawn button class that works really fine when assigning this class to a resource id via a DDX member variable. But now we want to reuse this class for dynamic creation of a button control inside the OnInitDialog member funtion of a dialog. Creating the control like that MyButton.CreateNULL,NULL,WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON|BS_OWNERDRAW,CRec t(0,0,100,100),this,2); seems to be OK. But the button never appeared inside the dialog. DrawItem of the button class is never called. So what may be missing? Thanks in advance Bernd How have you declared My...

Partial Year Close
Hello! We are on calendar year but we need to do another close as of January as we got acquired. What's the best way to do this? We tried manually zeroing out P&L accounts as of 1/31/2010 but now when we print a TB as of January it's zero. Thanks!!! One option is to just go into Fiscal Period setup and change the year to reflect the dates of your short year. Set up the next year to have the remaining months and just go from there. Your 'year' id will be 1 year ahead, but your reports will be correct. "Marisol" wrote: > Hello! We are on c...

Global template normal on closing Outlook
Can anyone tell me how to fix an error I get when I close MS Outlook. It asks if I want to save changes and if I click on yes it won't close and asks again. The statement is "Save changes to Global template normal". Sounds like you are using Word as your e-mailk editor. In Word you want to uncheck "Prompt before ssaving normal template". In Office 2007 - Word Options | Advanced. "Pat" wrote: > Can anyone tell me how to fix an error I get when I close MS Outlook. It asks > if I want to save changes and if I click on yes it won't c...

Query Button Problem
On my form, I need to put a button to run a query. When using the toolbox in the Design View, I use the Command Button Toolbar, then use MIscellaneous, then Run Query. I select the correct one, and save it to the form. When I try to use it, I get an error message, and it will not work. What is going wrong? Can't figure it out if you don't provide an error message. On Fri, 1 Feb 2008 10:52:00 -0800, Shari <Shari@discussions.microsoft.com> wrote: >On my form, I need to put a button to run a query. When using the toolbox in >the Design View, I use the Command Button To...

lost newsgroup command button
I followed Outlook's help topic to add a "news" selection to the "go" menu. I started "news" from that icon/selection under the "go" menu and all worked fine. My second attempt to open "news" the selection was missing. I tried to reinstall the selection but now "news" is missing from the customize "go" selection. Thanks. To get the News command back, go back to the Programs tab in Control Panel | Internet Options and change the default newsreader to Outlook Express. If OE prompts you to make it your default new...

Exit button.
I want to put a button on a worksheet that closes Excel. I have worked out how to create the button and attach a macro to it but not how to create a macro that exits Excel. Orf Bartrop sub leave() application.quit end sub -- Don Guillett SalesAid Software donaldb@281.com "Orf Bartrop" <orf@southcom.com.au> wrote in message news:4091F54E.40806@southcom.com.au... > I want to put a button on a worksheet that closes Excel. I have worked > out how to create the button and attach a macro to it but not how to > create a macro that exits Excel. > > Orf Bartrop >...

Userform button setting variable from formula
I have a userform that contains windows media player. I want to set CommandButton4 to take the value of the formula in cell A2 of the active sheet and set it as the value of variable named 'inset'. I'm finding the VBA code on this much harder to write than I thought it would be. Any ideas please, anyone? Hi Teepee I am a bit confused by your request but I think that it as simple as: Private Sub CommandButton4_Click() inset = Range("A2").Value MsgBox ("The value of cell A2 is: " & inset) End Sub Regards Shau -- Shaun -----------------------------...

Error when closing an Activity
CRM 3.0 upgraded from 1.2 Most things work but the following error is displayed when closingan activity. Although the activity is closed. How can I fix this? [SoapException: Server was unable to process request.] System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +1496 System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +218 Microsoft.Crm.Platform.Proxy.TaskWebService.Retrieve(Guid id, ColumnSetBase columnSet) +100 Microsoft...

Command button on got focus not working
Greetings all. I've got a popup form for adding a note to a notes table. On the form there is a command button to insert the note then close the add note form. It works fine when sub fires from the on click event of the button. However, if I take the same code and put it in the got focus event, I get an error, shown below after the code. The message is inserted, and the main form is requeried, bu the add not popup does not close. If I hit ok on the error message, then hit enter again, the add not popup then closes. My intention is that the user can simply hit enter after typin...

Drawer does not pop for open/close
Howdy, My cash drawer no longer opens when I try to count open/close It opens fine for all other transactions. we are currently using a no sale to open it when we count the drawer. I recently installed new reciept templates along with TPI payment software It is a star TSP700 printer using the windows raster driver. The OPOs drivers were not opening the drawer at all any thoughts? thanks -- Jon Kahn Confluence Kayaks When running RMS and using OPOS with the drawers and receipt printers, our reseller told us that OPOS and Windows drivers sometimes do not work well together. They rec...

Error Message Received Almost Every Time on Closing
When I close WL Mail, 90% of the time I get an error message similar to this one: Unable to send or receive messages for the Aol account. Header download for the 'Apple Mail To Do' folder did not complete. Your server has unexpectedly terminated the connection. Possible causes for this include server problems, network problems, or a long period of inactivity. Server Response: Server: 'imap.aol.com' Windows Live Mail Error ID: 0x800CCC0F Protocol: IMAP Port: 143 Secure(SSL): No The only difference I see in such messages is the name of the folder that did no...

Missing Publish to GAL button
How can I install the "Publish to GAL" button under Microsoft Outlook 2000, Tools, Options, Security?? ...

Form/window Close
I have a main page 'MyMainForm' containing a button. When this button is clicked; another form 'MySubForm' opens up which contains two buttons (OK & Exit). When OK button is clicked; the code behind this button processes some data and displays an alert and then goes back to 'MySubForm'. What do I need to do so 'MySubForm' is closed automatically when processing is done and OK is clicked on alert box? Ryan wrote: > I have a main page 'MyMainForm' containing a button. When this button is > clicked; another form 'MySubForm'...