The attribute of the dialog is set to do not Title Bar. What should I do if I have an icon in the taskbar?

zhaozj2021-02-17  51

In the dialog-based application, the property set in the dialog box is not title bar, and the generated program has no icon in the taskbar, I have encountered this problem in a interface program.

The help of the 9CBS of Sam1111), Chief, 2ndboy, Waiwaiwai and other friends finally concluded.

Add: in OnInitDialog ():

ModifyStyle (0, WS_SYSMENU);

SetwindowText ("MyTITE");

Yes.

Seeing English materials given by Waiwaiwai (I don't understand) Waiwaiwai (I don't understand)

Bug: Dialog Editor Doesn't Permit a Taskbar icon if The titlebar is off

ID: Q249291

-------------------------------------------------- ------------------------------

The Information in this Article Applies TO:

Microsoft Visual C , 32-Bit Editions, Versions 5.0, 6.0

-------------------------------------------------- ------------------------------

Symptoms

It is possible to create an MFC dialog box-based application with no title bar by turning off the dialog box's standard Title bar style. However, when the application runs, the shell taskbar displays a blank button with no icon and no text, even though The icon resource exisss.

Cause

.

Resolution

Manually add the WS_SYSMENU style by editing the resource as text. If you will be editing any resources afterwards, you will also need to move the dialog resource to the res / .rc2 file. This prevents the resource editor from overwriting your change , but it it also prevents you from being able to edit the dialog box with the resource editor.

STATUS

Microsoft Has Confirmed this to be a bug in the microsoft products listed at the beginning beginning of this article.

More information

For some applications, a dialog box functions conveniently as a main window. Visual C provides a dialog-based option in the MFC AppWizard (exe) for that purpose. If you want a main dialog window without a standard title bar in such an application, You Must Edit The Dialog Properties in ResourceView. To do this, FOLLOW THESE Steps in Your Open Project: from the file menu, select new. Select The MFC AppWizard (exe). Name It Notitle and Click OK.

In step 1 of the appwizard, select dialog-based. Click Finish, The Click Ok on The Confirmation Dialog Box.

In ResourceView, Expand The Dialog Resources. Double-Click IDd_notitle_dialog.

Right-Click An Unused Area of ​​The Dialog Box, and SELECT Properties.

In The Properties Editor, Click The Styles Tab, And Clear The Title Bar Check Box.

If you build and run the project at this point, you will notice that the button that the shell normally displays in the taskbar for your running application is completely blank. There is no icon, and there is no text.

If you go back to the Properties editor for the main dialog box at this point, you will notice that various items in the Styles tab are disabled. One of those items is the System menu check box. That check box controls adding the WS_SYSMENU style to .. the dialog resource The dialog needs this style in order for the application icon to appear in the taskbar for additional information on how to display an icon in the title bar, click the article number below to view the article in the Microsoft Knowledge Base:

Q179582 HOWTO: SET The Title Bar icon in A Dialog Box

Though the resource editor prevents adding the WS_SYSMENU style to a dialog box with no title, the combination is possible. You can manually edit the .rc file to put the WS_SYSMENU style in and verify that it causes an icon to appear in the .

In The open as dropdown list, select text.

TYPE NOTITLE.RC IN The File Name Edit Box, Then Click Open. IF The ResourceView Is Open for the Project, You Will See A Warning Dialog Box That The Resource Editor Will Be Closed. Click Ok to Allow That.

Move Down to the Dialog Section of the .rc file. Locate the IDd_notitle_dialog Dialogex Resource.

On The Line Labeled Style Following The Dialog Name, Append:

| WS_SYSMENU

Now, SELECT The Lines Defining The Dialog Resource, Starting With The Resource Name Down to and incompuding The end tag. Using The Standard Editor, SELECT by Dragging The Mouse over Those Lines.

From The Edit Menu, SELECT CUT. The SELECTED DISAPPEARS.

Open the notitle.rc2 resource file. On The Workspace Pane, Click The Fileview Tab. Expand The Project's Resource Files Folder, and Double-Click The Notitle.rc2 File.

Position the cursor at the end of any text in the NoTitle.rc2 file (or at another convenient location), then from the Edit menu, click Paste. The dialog resource has now been transferred to the manually edited resource file.

Press Ctrl F5 To Build and Run The Project. Note That An Icon Now Appears on The Taskbar Button Associated with your application.

Clearing the Title bar check box also disables the Caption field in the dialog resource General properties. If you add a CAPTION entry in the resource with or without a WS_CAPTION style, you will get a title bar anyway. To display text in the taskbar button, You Must Call SetWindowText () in The oncreate () Handler OR Some Other Appropriate Place: from the view menu, select classwizard.

On The Message Maps Tab, SELECT The Main Dialog Class from The Class Name Drop Down List.

In The Messages List, Double-Click The WM_CREATE MESSAGE. Click The Edit Code Button.

Under The Todo Line, Just Before The Return From The Function, ADD:

SetwindowText ("MyTITE");

...........................

Additional Query Words:

Keywords: Kbeditor Kbide KbresourceED KBVC600Bug KBDsupport KBGRPDSTools

Version: Winnt: 5.0, 6.0

Platform: Winnt

Issue Type: KBBUG

转载请注明原文地址:https://www.9cbs.com/read-29232.html

New Post(0)