Own Constructor doesn't work.

Hello,

I have created my own derived class which base class is CFileDialog, then I have also created my own contructor to that file, my contructor should open a file dialog box with possiblity of choosing file, but after placing a command button and clicking on it, the only thing I get is something like AfxMessageBox with error message :

Attempted an unsupported action

I use VS C++ 2008, could you please tell me why I get this error message, please see definition of my class, below :

class FileDialog : public CFileDialog
{
DECLARE_DYNAMIC(FileDialog)

public:

// Constructor
FileDialog(BOOL bOpenFileDialog,
LPCTSTR lpszFileName = NULL,
DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
CWnd *pParentWnd = NULL);

};
// Contructor on button click :
void PageFile::OnBnClickedButton1()
{
// TODO: Add your control notification handler code here
FileDialog elo(true);
}


Comments

  • : Hello,
    :
    : I have created my own derived class which base class is CFileDialog,
    : then I have also created my own contructor to that file, my
    : contructor should open a file dialog box with possiblity of choosing
    : file, but after placing a command button and clicking on it, the
    : only thing I get is something like AfxMessageBox with error message
    : :
    :
    : Attempted an unsupported action
    :
    : I use VS C++ 2008, could you please tell me why I get this error
    : message, please see definition of my class, below :
    : [code]
    : class FileDialog : public CFileDialog
    : {
    : DECLARE_DYNAMIC(FileDialog)
    :
    : public:
    :
    : // Constructor
    : FileDialog(BOOL bOpenFileDialog,
    : LPCTSTR lpszFileName = NULL,
    : DWORD dwFlags = OFN_HIDEREADONLY |
    : OFN_OVERWRITEPROMPT,
    : CWnd *pParentWnd = NULL);
    :
    : };
    : // Contructor on button click :
    : void PageFile::OnBnClickedButton1()
    : {
    : // TODO: Add your control notification handler code here
    : FileDialog elo(true); [color=Red]//<-- BRKPT HERE![/color]
    : }
    :
    : [/code]
    :
    [color=Blue]There is no code for FileDialog constructor - only declaration is here. Also, please use a debugger - put a breakpoint at constructor call (see my RED color) and press F11 to step through. You may see which exact line gives an error.[/color]
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion