tags:

views:

61

answers:

1

I am creating a simple Windows form through Visual Studio->Visual c++->MFC->MFC Application. It only contains one static edit (label), a browse button and one button. Here I put a browse button by right clicking in the dialog box and I selected "Add ActiveX control", "SelectFile class".

Now when I run the form it works, but I want the path where the user selected from the browse button, so the path should be displayed in Button, when clicking "button". Here I cannot access the SelectFile class control within "buttonclick event".

Help me to resolve my problem. Thank you.

+2  A: 

So, what you call the Browse Button is your activex control, right? In the dialog editor, right click it and choose 'Add a variable'. The wizard will create a variable in your dialog class for your ActiveX control. Let's say you call it m_BrowseButton.

From there on, you can access methods of the ActiveX control using code such as:

m_BrowseButton->Method(blah);

HTH,

Serge - appTranslator