CMenu and Dialog-based applications - visual-c++

Is it possible to put a menu in a dialog based application? How?

Yes, it is possible to add menu to the dialog based applications. You can create the menu as a resource and attach the same to the dialog.
If you open the properties for dialog, you can see a Menu as a property for which you can assign an existing Menu ID.
Steps:
Right click on Resource View and
insert a new Menu. (Menu with some ID-- lets say IDR_MENU1 -- is created)
Configure the menu to add required
items in menu and provide the ID,
Caption to the menu items.
Right click on Dialog and open
Properties...
From Menu Combobox, select the ID of
the required menu ( here IDR_MENU1)

You can add a menu resource to a dialog application, but you haven't said which version of Visual Studio you're using so details are hard to provide. You should know that because CDialog isn't derived from CFrameWnd, update routing won't work - you need to read this article for the details.
That article includes instruction for adding the menu if you're using a version of Visual Studio post-VC6, which you probably are - read the "more information" section further down the article for that.

See DLGCBR32 MFC sample in the MSDN.

Related

Android Studio: I want to create a filter icon on my toolbar on specific activity/fragment only, using recycle view

This is the result that I want:
I want to create the filter icon however, I'm not sure if it's even possible. I've searched on youtube however, it's all regarding the search icon. I want the filter icon to be able to open a drawer, in which I'll be able to select what I want to filter. e.g alphabetical order/year, within the recycle view.
you can create menu xml and can load those to the toolbar . onCreateOptionsMenu can be used to inflate the menu and onOptionsItemSelected will help to identify the click of the menu.
Refer : here

How to make a custom dialog in InstallShield?

I'm trying to understand InstallShield (2009)/InstallScript on the fly, because I'm modifying someone else's installation script.
One of the dialogs during the installation procedure previously had one textbox on it, asking for a SQL Server instance, assuming a certain database name. Now I've just completed an enhancement enabling you to choose any database name, not just the default, and I need to add a field to this dialog so the user can input the chosen DB name. Monkey see, monkey do, just make a new control and duplicate and adapt whatever functionality the form had for the first textbox - easy enough, right?
Umm... problem here. It seems that the "SdShowDlgEdit1" form is a generic thing that gets shipped with InstallShield, and is used all over, wherever you have a dialog that needs one textbox. Change that form, and it changes everywhere that it's called... so now I have a spurious 2nd textbox appearing all over my installation wherever there was a single text box before.
Oops. Undo changes, and change the reference to "SdShowDlgEdit2", which is - you guessed it - InstallShield's standard form for dialogs needing 2 textboxes. Now that would be great.... excepting that the previous developer got there before me and added a "browse" button to that form for a place where he needed the 2nd text box to contain a folder path. I don't want that "browse" button, and I can't delete it.
So I think, why don't I create a custom form of my own, and not get under anyone else's toes? So I clone the form, rename the new instance to "EnterDbDetails", delete the "Browse" button and make the form look just right.
Then I go back into the InstallScript to redirect to "EnterDbDetails" and discover that the EzDefineDialog function requires me to pass in the "Resource ID" of the form. Now what was it again... 12018... great... fill in all necessary details, compile, build, and give it a whirl. Looks lovely, all the right default values are filled into the two text boxes - but hey! Why is the browse button there? And why is the text on the labels not what I set?
Back to InstallScript, check the Resource ID - turns out that the original "SdShowDlgEdit2" also has a Resource ID of 12018. Well, that explains that nicely. Silly that InstallShield allows you to have two forms with the same ID, but whatever... So let's go back to my "EnterDbDetails" form and change the ID...
... but the Resource Identifier property is read-only! WTF?
So now I can't use any of the standard forms, and I can't use a custom form because it won't let me change the resource ID.
I am stumped. Can anyone please explain how you are supposed to do something like this, which really ought to be the simplest thing in the world?
Creating New Custom Dialogs in InstallScript and InstallScript MSI Projects
Quote from the site (2015 edition) :
To create a custom dialog, you need to perform the following general steps:
Use the New Dialog Wizard to add a new custom dialog to your project. For more information, see Using the New Dialog Wizard to Add a New Custom Dialog to an InstallScript or InstallScript MSI Project.
Add controls to the dialog. For more information, see Adding a Control to a Dialog in an InstallScript or InstallScript MSI Project.
Create a script function that loads the dialog into memory, displays it on the screen, handles the end user’s interaction with the dialog’s controls, and closes the dialog when the user is finished with it. For more information, see Using InstallScript to Implement Custom Dialogs.
To create a new dialog:
Open the Dialogs view. The Dialogs view is located in the User Interface section of the View List.
Right-click the All Dialogs explorer and then click New Dialog. The Dialog Wizard opens. Click Next to dismiss the Welcome panel.
In the Dialog Template panel, click Interior Wizard Panel, and select the Let me insert this dialog in a User Interface sequence check box.
In the User Interface panel, select Installation in the User Interface Sequence list. In the list of dialogs, select InstallWelcome. Based on these selections, InstallShield will insert your new dialog in sequence immediately following the InstallWelcome dialog.
In the Dialog Position and Condition panel, leave the default settings, and click Finish. Your new dialog appears in the Dialogs list.
Right-click the dialog and select Rename. Rename the dialog WelcomeBitmap.
Using the same technique, you can insert additional dialogs in your installation’s user interface.
In this step, you will modify the WelcomeBitmap dialog that you just created:
First, create a bitmap (using a program like Microsoft Paint) that measures 300 by 150.
Open the Dialogs view.
Expand the WelcomeBitmap dialog’s node. Click English (United States) to open the Dialog Editor.
Click the Dialog Bold Title text box at the top of the dialog. In the Text field, type Welcome Bitmap. This changes the dialog’s main title.
Click the Dialog Normal Description text box at the top of the dialog. In the Text field, type Displays my welcome bitmap. This changes the dialog’s description.
Click the Bitmap button on the Dialog Control toolbar and use the cursor to drag a box on the dialog. Set the Height to 150 and the Width to 300.
In the File field browse to the bitmap file that you created in step 1.
After rebuilding the project (by pressing F7) and running it (by pressing CTRL+F5), the Welcome Bitmap dialog will appear after the Install Welcome dialog.
You need to edit the ResourceID (to something unique) in the Dialog table which is found in the Direct Editor under Additional Tools section in the Installation Designer.
By custimizing standard InstallShield dialogs, like sdWelcome, sdFinish and sdFinishReboot you will be able to use the dialogs default script APIs with the performed customization's

how can i add mouse down event on picture control in vc++

i want indentify all mouse click event like WM_LBUTTONDOWN and WM_LBUTTONUP, on picture control in vc++,
but i am not able to do this
please tell me how can i identifies all events separately.
thanks in advance.
You should enable property "Notify" of PictureControl to get the event.
You can add an event handler to the picture control using Visual Studio IDE and modify the code for handler function. That should be easy.
I'm guessing you're using MFC. In that case you have to add an activex control to your dialog.
i. Adding the control: To add such a control to your dialog box right click your dialog box and click the option called "Insert ActiveX Control". A modal dialog box appears. You have to select "Microsoft Forms 2.0 Image". Click OK. Control is added.
ii. Select an image: Right click your newly added control and select "Properties". Select your desired image clicking the picture attribute. Also there are other properties to customize the picture i.e, stretching, clipping image etc. You'll see your image is loaded into the control.
iii. Adding the handler function: Right click the control and select "Add Event handler". From the new modal dialog box select "MouseDown" or "MouseUp" as message type and click "add and edit". Add your code to achieve desired behavior.
N.B: MFC is not available with Visual C Express. You need a professional version of VS to compile MFC code.

How to add custimized context menu item on right click in browser window?

Here I want to add my custom menu option i.e. ColorZilla, Aptana Studio on web browser right click
You can only do this with a browser plugin. Each browser will have its own syntax for plugins and specifically adding context menu items.
Aleks G. is right you cannot do that directly within the browser.
I don't know if it can help you or if it is what you are looking for but, within the browser you can handle the right click interaction in order to display your own custom menu ( not a particular menu item but the full menu ) ... meaning the default browser menu won't get displayed at all.
In case you are interested, you can have a small sample here

Anyone know how to create a custom menu like this in android apps?

hii,I was just learning android i want create menu like this at this image This Menu
i was confused make this,anyody know how i can do it with 4 item like the link above ?
please help me.
sory if my language english bad.
To my knowledge custom menu and options menu can be modified (adding and removing menu items) easily.
If u want your own custom option menu, you may have to simulate by creating layouts.
1) Creative a layout and inflate the layout and show on clicking on the menu button.
2) If u want to occupy whole screen then better use Images and TextViews and create a new activity and launch the activity on clicking the options menu in OnCreateOptionsMenu().
Please find the links below
Custom menu in android
Android: creating a custom menu on the bottom

Resources