TommyN14
asked on
Error converting VS6 project to VS2008 Pro
Experts,
I'm converting a VS6 project to VS2008 Pro project using the VS08 Wizard. After correcting all the compile errors, I was able to compile it. This project has to do with watching TV on a PC. It works fine in VS6. After I converted to VS08, when I run the app, it said member not found and open up the TV window with no channel (rainy screen). Below is the code snipets and where the program crashes. TIA.
MyTest.h:
class CMyTestApp : public CWinApp
{
public:
CMyTestApp ();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMyTestApp )
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
....
DECLARE_MESSAGE_MAP()
};
MyTest.cpp:
...
#include "stdafx.h"
#include "MyTest.h"
#include "MyTestDlg.h"
BOOL CMyTestApp::InitInstance()
{
if (!AfxSocketInit())
{
AfxMessageBox(IDP_SOCKETS_ INIT_FAILE D);
return FALSE;
}
AfxEnableControlContainer( );
...
CMyTestDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
return FALSE;
}
MyTestDlg.h:
//{{AFX_INCLUDES()
#include "_hcwwintvocx.h"
//}}AFX_INCLUDES
class CMyTestDlg : public CDialog
{
public:
...
void SetChannel(int channel);
CMyTestDlg(CWnd* pParent = NULL);
// Dialog Data
//{{AFX_DATA(CMyTestDlg )
enum { IDD = IDD_MYTV };
C_hcwWinTVocx m_TV;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMyTestDlg )
protected:
virtual void DoDataExchange(CDataExchan ge* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
....
protected:
HICON m_hIcon;
....
private:
int m_chnl;
.....
};
MyTestDlg.cpp:
#include "stdafx.h"
#include "MyTestDlg.h"
CMyTestDlg::CMyTestDlg(CWn d* pParent /*=NULL*/)
: CDialog(CMyTestDlg::IDD, pParent),
m_chnl( 0 ),
....
{
//{{AFX_DATA_INIT(CMonitor Dlg)
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_ MAINFRAME) ;
}
void CMyTestDlg::DoDataExchange (CDataExch ange* pDX)
{
CDialog::DoDataExchange(pD X);
//{{AFX_DATA_MAP(CMyTestDl g)
DDX_Control(pDX, IDC_TV, m_TV);
//}}AFX_DATA_MAP
}
...
BOOL CMyTestDlg::OnInitDialog()
{
CDialog::OnInitDialog();
SetWindowText( "MY TV" );
SetIcon(m_hIcon, TRUE); // Set big icon
m_TV.SetAnnunciatorEnabled ( FALSE); <<<< The program crashes right here as soon as I start using m_TV object.
....
}
Here is the _hcwwintvocx.h file (comes with the TVTuner)
class C_hcwWinTVocx : public CWnd
{
protected:
DECLARE_DYNCREATE(C_hcwWin TVocx)
public:
CLSID const& GetClsid()
{
static CLSID const clsid
= { 0x79ecb87e, 0x1510, 0x11d2, { 0xa9, 0x82, 0x0, 0xa0, 0xc9, 0x2a, 0x2d, 0xf } };
return clsid;
}
virtual BOOL Create(LPCTSTR lpszClassName,
LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect,
CWnd* pParentWnd, UINT nID,
CCreateContext* pContext = NULL)
{ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID); }
BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect, CWnd* pParentWnd, UINT nID,
CFile* pPersist = NULL, BOOL bStorage = FALSE,
BSTR bstrLicKey = NULL)
{ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID,
pPersist, bStorage, bstrLicKey); }
// Operations
public:
void SetAnnunciatorEnabled(BOOL bNewValue);
.....
};
_hcwwintvocx.cpp file
#include "stdafx.h"
#include "_hcwwintvocx.h"
IMPLEMENT_DYNCREATE(C_hcwW inTVocx, CWnd)
....
void C_hcwWinTVocx::SetAnnuncia torEnabled (BOOL bNewValue)
{
static BYTE parms[] =
VTS_BOOL;
InvokeHelper(0x6803ffce, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
bNewValue);
}
....
I'm converting a VS6 project to VS2008 Pro project using the VS08 Wizard. After correcting all the compile errors, I was able to compile it. This project has to do with watching TV on a PC. It works fine in VS6. After I converted to VS08, when I run the app, it said member not found and open up the TV window with no channel (rainy screen). Below is the code snipets and where the program crashes. TIA.
MyTest.h:
class CMyTestApp : public CWinApp
{
public:
CMyTestApp ();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMyTestApp
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
....
DECLARE_MESSAGE_MAP()
};
MyTest.cpp:
...
#include "stdafx.h"
#include "MyTest.h"
#include "MyTestDlg.h"
BOOL CMyTestApp::InitInstance()
{
if (!AfxSocketInit())
{
AfxMessageBox(IDP_SOCKETS_
return FALSE;
}
AfxEnableControlContainer(
...
CMyTestDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
return FALSE;
}
MyTestDlg.h:
//{{AFX_INCLUDES()
#include "_hcwwintvocx.h"
//}}AFX_INCLUDES
class CMyTestDlg : public CDialog
{
public:
...
void SetChannel(int channel);
CMyTestDlg(CWnd* pParent = NULL);
// Dialog Data
//{{AFX_DATA(CMyTestDlg )
enum { IDD = IDD_MYTV };
C_hcwWinTVocx m_TV;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMyTestDlg
protected:
virtual void DoDataExchange(CDataExchan
//}}AFX_VIRTUAL
....
protected:
HICON m_hIcon;
....
private:
int m_chnl;
.....
};
MyTestDlg.cpp:
#include "stdafx.h"
#include "MyTestDlg.h"
CMyTestDlg::CMyTestDlg(CWn
: CDialog(CMyTestDlg::IDD, pParent),
m_chnl( 0 ),
....
{
//{{AFX_DATA_INIT(CMonitor
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_
}
void CMyTestDlg::DoDataExchange
{
CDialog::DoDataExchange(pD
//{{AFX_DATA_MAP(CMyTestDl
DDX_Control(pDX, IDC_TV, m_TV);
//}}AFX_DATA_MAP
}
...
BOOL CMyTestDlg::OnInitDialog()
{
CDialog::OnInitDialog();
SetWindowText( "MY TV" );
SetIcon(m_hIcon, TRUE); // Set big icon
m_TV.SetAnnunciatorEnabled
....
}
Here is the _hcwwintvocx.h file (comes with the TVTuner)
class C_hcwWinTVocx : public CWnd
{
protected:
DECLARE_DYNCREATE(C_hcwWin
public:
CLSID const& GetClsid()
{
static CLSID const clsid
= { 0x79ecb87e, 0x1510, 0x11d2, { 0xa9, 0x82, 0x0, 0xa0, 0xc9, 0x2a, 0x2d, 0xf } };
return clsid;
}
virtual BOOL Create(LPCTSTR lpszClassName,
LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect,
CWnd* pParentWnd, UINT nID,
CCreateContext* pContext = NULL)
{ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID); }
BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect, CWnd* pParentWnd, UINT nID,
CFile* pPersist = NULL, BOOL bStorage = FALSE,
BSTR bstrLicKey = NULL)
{ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID,
pPersist, bStorage, bstrLicKey); }
// Operations
public:
void SetAnnunciatorEnabled(BOOL
.....
};
_hcwwintvocx.cpp file
#include "stdafx.h"
#include "_hcwwintvocx.h"
IMPLEMENT_DYNCREATE(C_hcwW
....
void C_hcwWinTVocx::SetAnnuncia
{
static BYTE parms[] =
VTS_BOOL;
InvokeHelper(0x6803ffce, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
bNewValue);
}
....
ASKER
jkr,
Thanks for your response. I digged into the HCW OCX documentation and it said to select the hcwWinTVocx from Project->Add to Project->Components and Controls...(in VS6) and it will generate the _hcwwintvocx files. I tried to do the samething in VS2008, but I couldn't find the Components & Controls options. So I went to right click on the Toolbox->Choose Items...->COM Components and select that hcwWinTVocx, but it didn't regenerate the _hcwwintvocx files. After this, I went to Resource View of the project and open the Diaglog IDD_MYTV and it crashed/shutdown VS2008. Do you have any idea how I can regenerate these files or the OLE wrappers u mentioned?
Thanks!
Thanks for your response. I digged into the HCW OCX documentation and it said to select the hcwWinTVocx from Project->Add to Project->Components and Controls...(in VS6) and it will generate the _hcwwintvocx files. I tried to do the samething in VS2008, but I couldn't find the Components & Controls options. So I went to right click on the Toolbox->Choose Items...->COM Components and select that hcwWinTVocx, but it didn't regenerate the _hcwwintvocx files. After this, I went to Resource View of the project and open the Diaglog IDD_MYTV and it crashed/shutdown VS2008. Do you have any idea how I can regenerate these files or the OLE wrappers u mentioned?
Thanks!
Have you tried 'Project|Add Class...'?
ASKER
jkr,
I tried Add Class as you suggested, this is what I did: Project->Add Class->MFC Class From ActiveX Control. In the Add Class From ActiveX Control Wizard window, I select the hcwWinTVocx (from registry), it doesn't show any Intefaces, so I can't select any interface to generate any class. Am I doing something wrong here?
Thanks!
I tried Add Class as you suggested, this is what I did: Project->Add Class->MFC Class From ActiveX Control. In the Add Class From ActiveX Control Wizard window, I select the hcwWinTVocx (from registry), it doesn't show any Intefaces, so I can't select any interface to generate any class. Am I doing something wrong here?
Thanks!
ASKER
jkr, do you have anymore suggestions?
Anyone else has any ideas?
Please help!!! Thanks!
Anyone else has any ideas?
Please help!!! Thanks!
Can you check the module in question with OLEView?
ASKER
jkr,
How do I do that?
Thanks!
How do I do that?
Thanks!
ASKER
jdk,
so I ran the OLEView and under Interfaces, i saw about a doze of hcwWinTVocx, i select each of them and they have different info. I don't know what to look for. Attached is an example of one of them.
Please help. Thanks!
test.gif
so I ran the OLEView and under Interfaces, i saw about a doze of hcwWinTVocx, i select each of them and they have different info. I don't know what to look for. Attached is an example of one of them.
Please help. Thanks!
test.gif
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I don't see any option from OLEView to generate IDL. How do i do that?
Thanks!
Thanks!
ASKER
Thank you!
It seems that the DISPID you are using with 'InvokeHelper()' is no longer valid. Have you tried regenerating the OLE wrappers?