Howdy, Stranger!

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

Categories

Issues with a pointer

RbickRbick Member Posts: 17
Hey guys, I'm back, with the last error I'm having with this damn program! I keep getting error C2065 telling me that "theApp" (my pointer) is an undeclared identifier. However, when I right click on it and click "go to definition", it takes me to where I defined it here in activeX.cpp.

[code]const GUID CDECL BASED_CODE _tlid =
{ 0xD641C5BC, 0x10EA, 0x4114, { 0xAC, 0xF, 0x10, 0x2E, 0xA9, 0xCB, 0x99, 0x7E } };
const WORD _wVerMajor = 1;
const WORD _wVerMinor = 0;

CActiveXApp::CActiveXApp()
{

}

[b]CActiveXApp *theApp;[/b]

// CActiveXApp::InitInstance - DLL initialization

BOOL CActiveXApp::InitInstance()
{
BOOL bInit = COleControlModule::InitInstance();
m_hButtonControl = NULL;
if (bInit)
//Loading the .dll 'cause its a ***!
m_hButtonControl= ::LoadLibrary( _T( "dapassthru.dll" ));
return bInit;
}



// CActiveXApp::ExitInstance - DLL termination

int CActiveXApp::ExitInstance()
{
// TODO: Add your own module termination code here.

return COleControlModule::ExitInstance();
}[/code]

And here in Activex.h:

[code]class CActiveXApp : public COleControlModule
{
public:
BOOL InitInstance();
int ExitInstance();
CActiveXApp();

protected:
HMODULE m_hButtonControl;
};

extern const GUID CDECL _tlid;
extern const WORD _wVerMajor;
extern const WORD _wVerMinor;

[b]extern CActiveXApp *theApp;[/b][/code]

The file I use it in is AudioStuff.cpp, and it uses theApp to point to CActiveXApp to initiate a .dll among other things:

[code]void CALLBACK WaveCallback(HWAVEOUT hWave, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2)
{

CActiveXPropPage *dlg =(CActiveXPropPage*)[b]theApp->[/b]m_pMainWnd;
WAVEHDR *hdr = (WAVEHDR *)dw1;

if( uMsg == WOM_DONE ) [/code]


If you guys can see what I'm doing wrong, your help would be really appreciated. Thanks.

«1

Comments

  • BitByBit_ThorBitByBit_Thor Member Posts: 2,444
    Did you include activeX.h in AudioStuff.cpp?

    Best Regards,
    Richard

    The way I see it... Well, it's all pretty blurry
  • RbickRbick Member Posts: 17
    Yep that did it. Its always the silly little things.

    Only problem: I now have a couple external errors. I'm sure its not related, but anyone dealt with these before? Apologies for having so many issues, but this is my first project using Visual Studio, and it definitely takes some adjusting to.

    Thanks for the help.
  • BitByBit_ThorBitByBit_Thor Member Posts: 2,444
    : Yep that did it. Its always the silly little things.
    :
    : Only problem: I now have a couple external errors. I'm sure its not
    : related, but anyone dealt with these before? Apologies for having so
    : many issues, but this is my first project using Visual Studio, and
    : it definitely takes some adjusting to.
    :
    : Thanks for the help.
    :

    Yeah I know :) The best thing is, 1 error can cause a landslide and produce much more vague errors. Usually it's best to fix them one at a time, and recompile after each fix.
    Anyway, post your errors and the relevant code parts and we'll see what we can do.

    Best Regards,
    Richard

    The way I see it... Well, it's all pretty blurry
  • RbickRbick Member Posts: 17
    : Yeah I know :) The best thing is, 1 error can cause a landslide and
    : produce much more vague errors. Usually it's best to fix them one at
    : a time, and recompile after each fix.
    : Anyway, post your errors and the relevant code parts and we'll see
    : what we can do.
    :
    : Best Regards,
    : Richard
    :
    : The way I see it... Well, it's all pretty blurry

    Excellent, I will be forever in your debt. Well I have 24 external errors, well I guess we could say 23, as they all lead up to one big fatal error =(.
    Here is one of them, which is in my ActiveXPropPage.obj file upon compilation. It claims it is on line 4 of the obj file, which cannot be read by a human being...

    [code]Error 1 error LNK2001: unresolved external symbol "public: virtual struct CRuntimeClass * __thiscall CActiveXPropPage::GetRuntimeClass(void)const " (?GetRuntimeClass@CActiveXPropPage@@UBEPAUCRuntimeClass@@XZ) ActiveXPropPage.obj[/code]

    This is the error. I assumed I would find the problem with the GetRunTimeClass function/class in the file. Only problem is, this doesn't exist.

    Also, this other error:

    [code]Error 8 error LNK2019: unresolved external symbol __imp__waveInAddBuffer@12 referenced in function "void __stdcall WaveCallback(struct HWAVEOUT__ *,unsigned int,unsigned long,unsigned long,unsigned long)" (?WaveCallback@@YGXPAUHWAVEOUT__@@IKKK@Z) AudioStuff.obj [/code]

    This comes up in my AudioStuff.obj. The same error holds true for all WaveIn/WaveOut functions I use for streaming audio in the .cpp and header files.

    Here is an example. I didn't think I needed to define these functions in the header file since that is already done in mmsystem.h which is included to Audiostuff.cpp.
    [code]
    void CALLBACK WaveCallback(HWAVEOUT hWave, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2)
    {

    CActiveXPropPage *dlg =(CActiveXPropPage*)theApp->m_pMainWnd;
    WAVEHDR *hdr = (WAVEHDR *)dw1;

    if( uMsg == WOM_DONE )
    {
    hdr->dwBytesRecorded = 0;
    hdr->dwUser = 0;
    }
    else if (uMsg == WIM_DATA )
    {
    if( hdr->dwBytesRecorded && dlg->audioPlayer.m_bInStarted )
    dlg->serviceMicAudio(hdr->lpData, hdr->dwBytesRecorded);

    waveInAddBuffer((HWAVEIN)hWave, hdr, sizeof(WAVEHDR));
    }
    }[/code]

    The definition in mmsystem.h is below:
    [code]
    WINMMAPI MMRESULT WINAPI waveInOpen( OUT LPHWAVEIN phwi, IN UINT uDeviceID,
    IN LPCWAVEFORMATEX pwfx, IN DWORD_PTR dwCallback, IN DWORD_PTR dwInstance, IN DWORD fdwOpen);

    WINMMAPI MMRESULT WINAPI waveInClose( IN OUT HWAVEIN hwi);
    WINMMAPI MMRESULT WINAPI waveInPrepareHeader( IN HWAVEIN hwi, IN OUT LPWAVEHDR pwh, IN UINT cbwh);
    WINMMAPI MMRESULT WINAPI waveInUnprepareHeader( IN HWAVEIN hwi, IN OUT LPWAVEHDR pwh, UINT cbwh);
    WINMMAPI MMRESULT WINAPI waveInAddBuffer( IN HWAVEIN hwi, IN OUT LPWAVEHDR pwh, IN UINT cbwh);
    WINMMAPI MMRESULT WINAPI waveInStart( IN HWAVEIN hwi);
    WINMMAPI MMRESULT WINAPI waveInStop( IN HWAVEIN hwi);
    WINMMAPI MMRESULT WINAPI waveInReset( IN HWAVEIN hwi);
    WINMMAPI MMRESULT WINAPI waveInGetPosition( IN HWAVEIN hwi, IN OUT LPMMTIME pmmt, IN UINT cbmmt);
    WINMMAPI MMRESULT WINAPI waveInGetID( IN HWAVEIN hwi, OUT LPUINT puDeviceID);[/code]

    Thanks =)


  • BitByBit_ThorBitByBit_Thor Member Posts: 2,444
    : Excellent, I will be forever in your debt. Well I have 24 external
    : errors, well I guess we could say 23, as they all lead up to one big
    : fatal error =(.
    : Here is one of them, which is in my ActiveXPropPage.obj file upon
    : compilation. It claims it is on line 4 of the obj file, which cannot
    : be read by a human being...
    :
    : [code]: Error 1 error LNK2001: unresolved external symbol "public: virtual struct CRuntimeClass * __thiscall CActiveXPropPage::GetRuntimeClass(void)const " (?GetRuntimeClass@CActiveXPropPage@@UBEPAUCRuntimeClass@@XZ) ActiveXPropPage.obj[/code]:
    :
    : This is the error. I assumed I would find the problem with the
    : GetRunTimeClass function/class in the file. Only problem is, this
    : doesn't exist.
    :

    I just slapped myself on the forehead sooooo hard. I had the entire reply typed, and then my optical mouse shot to the upper-right corner and I killed the window. Grrrr

    Anyway, a bit shorter version of what I said the first time:

    The first error is probably because there is a (virtual) function declared which is called GetRuntimeClass, but that has not been defined: the function is in the class definition, but it's body has not been written.
    Try commenting out the function declaration in the CActiveXPropPage.h file, and see if that doesn't cause any other related errors.

    : Also, this other error:
    :
    : [code]: Error 8 error LNK2019: unresolved external symbol __imp__waveInAddBuffer@12 referenced in function "void __stdcall WaveCallback(struct HWAVEOUT__ *,unsigned int,unsigned long,unsigned long,unsigned long)" (?WaveCallback@@YGXPAUHWAVEOUT__@@IKKK@Z) AudioStuff.obj [/code]:
    :
    : This comes up in my AudioStuff.obj. The same error holds true for
    : all WaveIn/WaveOut functions I use for streaming audio in the .cpp
    : and header files.
    :
    : Here is an example. I didn't think I needed to define these
    : functions in the header file since that is already done in
    : mmsystem.h which is included to Audiostuff.cpp.
    : [code]:
    : void CALLBACK WaveCallback(HWAVEOUT hWave, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2)
    : {
    :
    : CActiveXPropPage *dlg =(CActiveXPropPage*)theApp->m_pMainWnd;
    : WAVEHDR *hdr = (WAVEHDR *)dw1;
    :
    : if( uMsg == WOM_DONE )
    : {
    : hdr->dwBytesRecorded = 0;
    : hdr->dwUser = 0;
    : }
    : else if (uMsg == WIM_DATA )
    : {
    : if( hdr->dwBytesRecorded && dlg->audioPlayer.m_bInStarted )
    : dlg->serviceMicAudio(hdr->lpData, hdr->dwBytesRecorded);
    :
    : waveInAddBuffer((HWAVEIN)hWave, hdr, sizeof(WAVEHDR));
    : }
    : }[/code]:
    :
    : The definition in mmsystem.h is below:
    : [code]:
    : WINMMAPI MMRESULT WINAPI waveInOpen( OUT LPHWAVEIN phwi, IN UINT uDeviceID,
    : IN LPCWAVEFORMATEX pwfx, IN DWORD_PTR dwCallback, IN DWORD_PTR dwInstance, IN DWORD fdwOpen);
    :
    : WINMMAPI MMRESULT WINAPI waveInClose( IN OUT HWAVEIN hwi);
    : WINMMAPI MMRESULT WINAPI waveInPrepareHeader( IN HWAVEIN hwi, IN OUT LPWAVEHDR pwh, IN UINT cbwh);
    : WINMMAPI MMRESULT WINAPI waveInUnprepareHeader( IN HWAVEIN hwi, IN OUT LPWAVEHDR pwh, UINT cbwh);
    : WINMMAPI MMRESULT WINAPI waveInAddBuffer( IN HWAVEIN hwi, IN OUT LPWAVEHDR pwh, IN UINT cbwh);
    : WINMMAPI MMRESULT WINAPI waveInStart( IN HWAVEIN hwi);
    : WINMMAPI MMRESULT WINAPI waveInStop( IN HWAVEIN hwi);
    : WINMMAPI MMRESULT WINAPI waveInReset( IN HWAVEIN hwi);
    : WINMMAPI MMRESULT WINAPI waveInGetPosition( IN HWAVEIN hwi, IN OUT LPMMTIME pmmt, IN UINT cbmmt);
    : WINMMAPI MMRESULT WINAPI waveInGetID( IN HWAVEIN hwi, OUT LPUINT puDeviceID);[/code]:
    :
    : Thanks =)
    :
    :
    :

    You need to link against mmsystem.dll. The multimedia API's aren't standardly included, so you must tell your linker to link against mmsystem.dll. Under the project settings dialog there should be linker settings. Probably there's a list of standard libraries (kernel32.lib, user32.lib, gdi32.lib, etc...). If you add mmsystem.lib to that it should work.

    Best Regards,
    Richard

    The way I see it... Well, it's all pretty blurry
  • RbickRbick Member Posts: 17
    : The first error is probably because there is a (virtual) function
    : declared which is called GetRuntimeClass, but that has not been
    : defined: the function is in the class definition, but it's body has
    : not been written.
    : Try commenting out the function declaration in the
    : CActiveXPropPage.h file, and see if that doesn't cause any other
    : related errors.

    NICE! The linker was the problem with most of those. I hadn't even thought to mess with that. Still, I'm getting the error:

    [code]error LNK2001: unresolved external symbol "public: virtual struct CRuntimeClass * __thiscall CActiveXPropPage::GetRuntimeClass(void)const " (?GetRuntimeClass@CActiveXPropPage@@UBEPAUCRuntimeClass@@XZ) ActiveXPropPage.obj [/code]

    It is really bothering me, since I don't remember using this struct, nor can I find it in my program. It is located in afxctl.h and afx.h, which can be seen below.

    afxctl.h
    [code]public:
    class_name##Factory(REFCLSID clsid, [b]CRuntimeClass[/b]* [b]pRuntimeClass[/b],
    BOOL bMultiInstance, LPCTSTR lpszProgID) :
    COleObjectFactoryEx(clsid, pRuntimeClass, bMultiInstance,
    lpszProgID) {}
    virtual BOOL UpdateRegistry(BOOL);[/code]

    and in afx.h
    [code]// Classes declared in this file
    // in addition to standard primitive data types and various helper macros

    struct [b]CRuntimeClass;[/b] // object type information

    class CObject; // the root of all objects classes[/code]

    I'm not sure why it is doing this, but I'm working on it. Thor, your help has been most appreciated, thank you.

  • BitByBit_ThorBitByBit_Thor Member Posts: 2,444
    : : The first error is probably because there is a (virtual) function
    : : declared which is called GetRuntimeClass, but that has not been
    : : defined: the function is in the class definition, but it's body has
    : : not been written.
    : : Try commenting out the function declaration in the
    : : CActiveXPropPage.h file, and see if that doesn't cause any other
    : : related errors.
    :
    : NICE! The linker was the problem with most of those. I hadn't even
    : thought to mess with that. Still, I'm getting the error:
    :
    : [code]: error LNK2001: unresolved external symbol "public: virtual struct CRuntimeClass * __thiscall CActiveXPropPage::GetRuntimeClass(void)const " (?GetRuntimeClass@CActiveXPropPage@@UBEPAUCRuntimeClass@@XZ) ActiveXPropPage.obj [/code]:
    :
    : It is really bothering me, since I don't remember using this struct,
    : nor can I find it in my program. It is located in afxctl.h and
    : afx.h, which can be seen below.

    The struct isn't the problem. There's a function that's not been implemented: CActiveXPropPage::GetRuntimeClass. Could you please post the code in your CActiveXPropPage.h and CActiveXPropPage.cpp files?

    The function might be defined only in the base class, but in that case something went wrong with setting up the ActiveX application (I assume you used the Wizard to create the project?).

    Best Regards,
    Richard

    The way I see it... Well, it's all pretty blurry
  • RbickRbick Member Posts: 17
    : The struct isn't the problem. There's a function that's not been
    : implemented: CActiveXPropPage::GetRuntimeClass. Could you please
    : post the code in your CActiveXPropPage.h and CActiveXPropPage.cpp
    : files?
    :
    : The function might be defined only in the base class, but in that
    : case something went wrong with setting up the ActiveX application (I
    : assume you used the Wizard to create the project?).

    Ok, here it goes...

    AcitveXPropPage.cpp

    [code]// ActiveXPropPage.cpp : Implementation of the CActiveXPropPage property page class.

    #include "stdafx.h"
    #include "ActiveX.h"
    #include "ActiveXPropPage.h"

    #ifdef _DEBUG
    #define new DEBUG_NEW
    #endif

    //IMPLEMENT_DYNCREATE(CActiveXPropPage)

    // Message map
    BEGIN_MESSAGE_MAP(CActiveXPropPage, COlePropertyPage)
    ON_BN_CLICKED(IDC_BUTTON1, &CActiveXPropPage::OnBnClickedButton1)
    ON_WM_SYSCOMMAND()
    ON_WM_PAINT()
    ON_WM_QUERYDRAGICON()
    ON_WM_TIMER()
    //}}AFX_MSG_MAP
    ON_NOTIFY(NM_CLICK, IDC_LIST1, OnNMClickList1)
    ON_CONTROL(WM_LBUTTONDOWN, IDC_BUTTON_TALK, OnBtnDnButtonTalk)
    ON_CONTROL(WM_LBUTTONUP, IDC_BUTTON_TALK, OnBtnUpButtonTalk)
    ON_BN_CLICKED(IDC_BUTTON_END, OnBnClickedButtonEnd)
    ON_BN_CLICKED(IDC_BUTTON_CLEAR_DEBUG, OnBnClickedButtonClearDebug)
    ON_BN_CLICKED(IDC_BUTTON_PLAY_FILE, OnBnClickedButtonPlayFile)
    //ON_COMMAND(ID_TOOLS_SETUP, OnToolsSetup)
    ON_BN_CLICKED(IDC_BUTTON_FIND, OnBnClickedButtonFind)
    END_MESSAGE_MAP()



    // Initialize class factory and guid

    IMPLEMENT_OLECREATE_EX(CActiveXPropPage, "ACTIVEX.ActiveXPropPage.1",
    0x3a4b8ab4, 0xcf4a, 0x4fe0, 0x87, 0xc8, 0x99, 0x52, 0, 0x16, 0xd0, 0x9b)



    // CActiveXPropPage::CActiveXPropPageFactory::UpdateRegistry -
    // Adds or removes system registry entries for CActiveXPropPage

    BOOL CActiveXPropPage::CActiveXPropPageFactory::UpdateRegistry(BOOL bRegister)
    {
    if (bRegister)
    return AfxOleRegisterPropertyPageClass(AfxGetInstanceHandle(),
    m_clsid, IDS_ACTIVEX_PPG);
    else
    return AfxOleUnregisterClass(m_clsid, NULL);
    }

    CActiveXPropPage::~CActiveXPropPage()
    {
    {
    InitializeCriticalSection(&CriticalSection);

    m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);

    m_fpDebug = NULL;

    m_fileList.fp = NULL;
    m_fileList.next = NULL;
    m_fileList.socket = 0;

    icomList.data = NULL;
    icomList.dataSize = 0;

    m_pItemData = NULL;

    m_intercomCount = 0;
    m_sessionSocket = 0;
    m_playFileSocket = 0;

    m_sessionDead = TRUE;

    bShuttingDown = FALSE;

    bListening = FALSE;
    bTalking = FALSE;

    theApp->m_pszAppName;

    }

    struct _itemData *item = m_pItemData;

    if( m_hLib )
    FreeLibrary(m_hLib);

    while(item)
    {
    m_pItemData = item->next;
    free(item);
    item = m_pItemData;
    }

    if( icomList.data )
    {
    icomList.data = (void**)GlobalUnlock(icomList.data);
    GlobalFree(icomList.data);
    icomList.data = NULL;
    icomList.dataSize = 0;
    }

    DeleteCriticalSection(&CriticalSection);
    //OutputDebugString((LPCWSTR)"~CActiveXPropPage
    ");
    }
    // CActiveXPropPage::DoDataExchange - Moves data between page and properties

    void CActiveXPropPage::DoDataExchange(CDataExchange* pDX)
    {
    DDP_PostProcessing(pDX);
    DDX_Control(pDX, IDC_EDIT1, m_edit);
    DDX_Control(pDX, IDC_LIST1, m_listIcoms);
    DDX_Control(pDX, IDC_BUTTON_TALK, m_btnTalk);
    DDX_Control(pDX, IDC_BUTTON_PLAY_FILE, m_btnPlayFile);
    DDX_Control(pDX, IDC_BUTTON_END, m_btnEnd);
    DDX_Control(pDX, IDC_BUTTON_CLEAR_DEBUG, m_btnClearDebug);
    DDX_Control(pDX, IDC_LIST_ICOMS, m_listboxIcoms);
    DDX_Control(pDX, IDC_BUTTON_FIND, m_btnFind);
    // DDX_Control(pDX, IDC_SLIDER_VOLUME, m_sliderVolume);
    }


    BOOL CActiveXPropPage::OnInitDialog()
    {
    CDialog::OnInitDialog();

    m_sockaddr_in.sin_port = htons(3000); // Pass the port into the start we are to listen to
    m_DAStart( m_hDA, &m_sockaddr_in, THREAD_BASE_PRIORITY_MAX+12, "", "", NULL, NULL);

    ListView_SetExtendedListViewStyle(m_listIcoms.m_hWnd,
    LVS_EX_FULLROWSELECT |
    // LVS_EX_CHECKBOXES |
    LVS_EX_SUBITEMIMAGES |
    LVS_EX_GRIDLINES |
    LVS_EX_SUBITEMIMAGES );
    // LVS_EX_FLATSB |
    // LVS_EX_HEADERDRAGDROP );

    // Add in the columns
    m_listIcoms.InsertColumn(COL_ICON,_T(""),LVCFMT_LEFT,20,-1);
    m_listIcoms.InsertColumn(COL_LOCATION, _T("Location"),LVCFMT_LEFT,165,-1);
    m_listIcoms.InsertColumn(COL_STATUS, _T("Status"),LVCFMT_LEFT,101,-1);
    m_listIcoms.InsertColumn(COL_DOOR, _T("Door/Gate"),LVCFMT_LEFT,62,-1);
    m_listIcoms.InsertColumn(COL_ADDRESS, _T("IP Address"),LVCFMT_LEFT,107,-1);

    // Create the image list for the listbox
    m_imageList.Create(61, 16, ILC_COLOR16, 2, 2);
    return 0;
    }

    void CActiveXPropPage::OnSysCommand(UINT nID, LPARAM lParam)
    {
    }

    void CActiveXPropPage::OnPaint()
    {
    if (IsIconic())
    {
    CPaintDC dc(this); // device context for painting

    SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0);

    // Center icon in client rectangle
    int cxIcon = GetSystemMetrics(SM_CXICON);
    int cyIcon = GetSystemMetrics(SM_CYICON);
    CRect rect;
    GetClientRect(&rect);
    int x = (rect.Width() - cxIcon + 1) / 2;
    int y = (rect.Height() - cyIcon + 1) / 2;

    // Draw the icon
    dc.DrawIcon(x, y, m_hIcon);
    }
    else
    {
    CDialog::OnPaint();
    }
    }
    // CActiveXPropPage message handlers

    HCURSOR CActiveXPropPage::OnQueryDragIcon()
    {
    return static_cast(m_hIcon);
    }

    void CActiveXPropPage::OnNMClickList1(NMHDR *pNMHDR, LRESULT *pResult)
    {
    LPNMLISTVIEW pNMLV = reinterpret_cast(pNMHDR);

    if( pNMLV->iSubItem == COL_DOOR && pNMLV->iItem != -1 )
    {
    struct _itemData *tItemData;
    int index;

    tItemData = (struct _itemData *)getIcomItemData(pNMLV->iItem);
    if( tItemData->iCom.picRev.opMode1 & OPMODE_RELAY )
    {
    m_DAOpenDoor(m_hDA, tItemData->socket, 5);

    index = findIntercom(&tItemData->iCom);

    m_listIcoms.SetItem( index, COL_DOOR, LVIF_IMAGE, 0, 1, 0, 0, NULL ); // LVIS_SELECTED
    // m_listIcoms.SetItemText(index, COL_DOOR, "OPEN");
    SetTimer( TIMER_DOOR, 5000, NULL );
    }
    }

    if( !m_playFileSocket )
    m_btnPlayFile.EnableWindow( m_listIcoms.GetSelectedCount() );
    else
    OnBnClickedButtonPlayFile();

    if( m_sessionSocket )
    OnBnClickedButtonEnd();

    *pResult = 0;
    }

    void CActiveXPropPage::OnTimer(UINT nIDEvent)
    {
    // TODO: Add your message handler code here and/or call default

    if (nIDEvent == TIMER_DOOR )
    clearDoor();

    CDialog::OnTimer(nIDEvent);
    }

    void CActiveXPropPage::clearDoor()
    {
    int count, index;

    KillTimer(TIMER_DOOR);

    count = m_listIcoms.GetItemCount();

    for ( index = 0; index < count ; index++ )
    {
    struct _itemData *tItemData;
    tItemData = (struct _itemData *)getIcomItemData(index);

    if( tItemData->iCom.picRev.opMode1 & OPMODE_RELAY )
    m_listIcoms.SetItem( index, COL_DOOR, LVIF_IMAGE, 0, 0, 0, 0, NULL );
    // m_listIcoms.SetItemText(index,COL_DOOR,"Door");
    }
    }[/code]

    and ActiveXPropPage.h

    [code]#pragma once
    #include "Resource.h"
    #include "afxcmn.h"
    #include "mmsystem.h"
    #include "dapassthru.h"
    #include "Button.h"
    #include "AudioStuff.h"

    struct _fileList
    {
    struct _fileList *next;
    int socket;
    FILE *fp;
    long fileLen;
    long filePos;
    };

    struct _itemData
    {
    struct _itemData *next;

    int socket;
    struct _iComStructure iCom;
    struct _iComQueueInfo iComQueue;
    struct _CQData cq;

    BOOL bLocalRecord;

    HANDLE hTempCQ;
    HANDLE hCallQueue;
    HANDLE hArchive;

    BOOL bChecked;
    };

    struct _fmtHeader
    {
    ULONG len;
    short audioFormat;
    short numChannels;
    ULONG sampleRate;
    ULONG byteRate;
    short blockAlign;
    short bitsPerSample;
    };

    struct _listData
    {
    void **data;
    int dataSize;
    };

    #define COL_ICON 0
    #define COL_LOCATION 1
    #define COL_STATUS 2
    #define COL_DOOR 3
    #define COL_ADDRESS 4

    #define WAVE_FORMAT_ULAW 7
    #define WAVE_FORMAT_PCM 1

    #define TIMER_DOOR 2

    void CallBack( int event, int socket, struct _iComStructure *pIcom, void *eventData, void *myData );
    int findIntercom(struct _iComStructure *pIcom);


    // ActiveXPropPage.h : Declaration of the CActiveXPropPage property page class.
    // CActiveXPropPage : See ActiveXPropPage.cpp for implementation.



    class CActiveXPropPage : public COlePropertyPage
    {
    DECLARE_DYNCREATE(CActiveXPropPage, COlePropertyPage)
    DECLARE_OLECREATE_EX(CActiveXPropPage)


    // Constructor
    public:
    CActiveXPropPage::~CActiveXPropPage();

    // Dialog Data
    enum { IDD = IDD_PROPPAGE_ACTIVEX };

    void outputDebug(LPCTSTR pFormat, ...);
    void writeDebug(LPCTSTR pFormat, ...);
    void WriteDebugString(char *pString);

    afx_msg void OnTimer(UINT nIDEvent);

    // Implementation
    protected:
    virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support

    // Message maps
    protected:
    HMODULE m_hLib;

    struct sockaddr_in m_sockaddr_in;

    int m_DAMajor, m_DAMinor, m_DARelease;

    DAOpen m_DAOpen;
    DAClose m_DAClose;
    DAStart m_DAStart;
    DAStop m_DAStop;
    DADllVersion m_DADllVersion;
    DASetDebug m_DASetDebug;

    DADisconnect m_DADisconnect;
    DACreateGroup m_DACreateGroup;
    DADeleteGroup m_DADeleteGroup;
    DASelectIntercom m_DASelectIntercom;
    DAStartAudio m_DAStartAudio;
    DASendAudio m_DASendAudio;
    DAEndAudio m_DAEndAudio;
    DAGetGPIOValues m_DAGetGPIOValues;
    DASetGPIOValue m_DASetGPIOValue;
    DAiComCount m_DAiComCount;
    DAFirstIcom m_DAFirstIcom;
    DANextIcom m_DANextIcom;
    DAGetIcom m_DAGetIcom;
    DAOpenDoor m_DAOpenDoor;
    DASetVolume m_DASetVolume;
    DAForwardIcom m_DAForwardIcom;
    DARetrieveIcom m_DARetrieveIcom;
    DAListenIcom m_DAListenIcom;
    DADeleteServerCQ m_DADeleteServerCQ;
    DATransferAudio m_DATransferAudio;

    UINT m_uFlags;

    HICON m_hIcon;
    struct _itemData *m_pItemData;
    FILE *m_fpDebug;

    struct _fileList m_fileList;

    int m_playFileSocket;

    struct _listData icomList;

    int m_intercomCount;

    int nLEDLevel;

    BOOL m_sessionDead;

    CRITICAL_SECTION CriticalSection;

    CBitmap mBitMapDoorOpen;
    CBitmap mBitMapDoorClosed;

    CBitmap mBitMapBlank;
    CBitmap mBitMapGreen;
    CBitmap mBitMapYellow;
    CBitmap mBitMapRed;

    CImageList m_imageList;

    // =============================== F U N C T I O N S ===============================================


    afx_msg BOOL sendAudioFile( int socket, char *fname );
    struct _fileList *getFileList(int socket);
    BOOL delFileList(int socket);
    void stopAudioFile( int socket );

    int readWaveHeader(FILE *fp, WAVEFORMATEX *waveHeader);

    void insertItemData(struct _listData *list, int index, void *data);
    void deleteItemData(struct _listData *list, int index);
    void *getItemData(struct _listData *list, int index);
    void setItemData(struct _listData *list, int index, void *data);
    void clearItemData(struct _listData *list);

    void clearDoor();

    int getInsert(struct _itemData *item);

    void deleteIcoms();

    BOOL LoadProcs();

    afx_msg void OnBtnDnButtonTalk();
    afx_msg void OnBtnUpButtonTalk();

    int getSocket();

    void OpenDebugFile();

    // Generated message map functions
    virtual BOOL OnInitDialog();
    afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
    afx_msg void OnPaint();
    afx_msg HCURSOR OnQueryDragIcon();
    DECLARE_MESSAGE_MAP()
    public:
    CListCtrl m_listIcoms;

    HANDLE m_hDA;
    DAFindIntercom m_DAFindIntercom;

    Button m_btnTalk;
    CButton m_btnEnd;
    CButton m_btnPlayFile;
    CButton m_btnClearDebug;

    AudioStuff audioPlayer;

    int m_sessionSocket;

    BOOL bListening;
    BOOL bTalking;

    BOOL bShuttingDown;

    public:
    CListBox m_listboxIcoms;
    CButton m_btnFind;
    afx_msg void OnBnClickedButtonFind();

    CActiveXPropPage *mainDlg;

    public:
    afx_msg void OnBnClickedCancel();

    // ======================== P U B L I C F U N C T I O N S =========================================


    void doNewIntercom(int socket, struct _iComStructure *pIcom, struct _iComQueueInfo *pQueueInfo);
    void serviceMicAudio(char *data, int len);
    void DoEvents();
    afx_msg void doAudioData( int socket, char *data, int dataLen );
    afx_msg void doneAudioData( int socket );
    afx_msg void doAudioRequest( int socket, int dataLen );
    void doneAudioFile( int socket );
    char *szStatus( int statusCode );

    struct _itemData *findItemData(int socket);
    struct _itemData *findItemData(struct _MAC *MAC);

    void updateListIcomsStatus(struct _iComStructure *pIcom, int index);

    void insertIcomItemData(int index, void *data);
    void deleteIcomItemData(int index);
    void *getIcomItemData(int index);
    void setIcomItemData(int index, void *data);
    void clearIcomItemData();

    void startTalk();
    void startListen(BOOL skipTest=FALSE);
    BOOL waitClear(int socket);
    BOOL waitSet(int socket);
    void endTalk();
    void endListen(BOOL skipWait=FALSE);

    void displayIntercomCount( );

    void deleteIcomsData();
    afx_msg void OnNMClickList1(NMHDR *pNMHDR, LRESULT *pResult);
    afx_msg void OnBnClickedButtonEnd();
    afx_msg void OnBnClickedButtonClearDebug();
    afx_msg void OnBnClickedButtonPlayFile();
    //afx_msg void OnToolsSetup();
    public:
    CEdit m_edit;
    public:
    afx_msg void OnBnClickedButton1();
    };[/code]

    This is the code. I still can't find a problem, but I'm continuing my search on google to find an answer. Good luck on searching through it. And again, thank you.
  • BitByBit_ThorBitByBit_Thor Member Posts: 2,444
    : Ok, here it goes...
    :
    : AcitveXPropPage.cpp
    :
    : [code]: // ActiveXPropPage.cpp : Implementation of the CActiveXPropPage property page class.
    :
    : #include "stdafx.h"
    : #include "ActiveX.h"
    : #include "ActiveXPropPage.h"
    :
    : #ifdef _DEBUG
    : #define new DEBUG_NEW
    : #endif
    :
    : [color=Red]//IMPLEMENT_DYNCREATE(CActiveXPropPage)[/color]
    :
    : // Message map
    ...
    [/code]:
    :
    : This is the code. I still can't find a problem, but I'm continuing
    : my search on google to find an answer. Good luck on searching
    : through it. And again, thank you.

    Why did you comment out that line? Uncomment it and things should work.

    Best Regards,
    Richard

    The way I see it... Well, it's all pretty blurry
  • RbickRbick Member Posts: 17
    : Why did you comment out that line? Uncomment it and things should
    : work.

    I'm not sure why I commented out that line. I must have been problems with it earlier and forgot about it. This would make sense since I get
    [code]
    error C2512: 'CActiveXPropPage' : no appropriate default constructor available
    [/code]
    and
    [code]Error 5 error C2039: 'GetThisClass' : is not a member of global namespace
    [/code]


«1
Sign In or Register to comment.