Howdy, Stranger!

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


Displaying Information in a MFC ActiveX

RbickRbick Member Posts: 17
Hi everyone!

I'm having some trouble displaying information in a selected edit control in an MFC ActiveX. The information should automatically display the information of an IP based intercom. The program connects the intercom with port 3000 and the information is displayed in the edit box. The connection between the network and my program does in fact work as I checked it in netstat, but the information can not be seen. I actually used the same code in an MFC App and it works fine. The following is code for creating the columns in the edit box.
m_listIcoms.InsertColumn(COL_ICON, "",LVCFMT_LEFT,20,-1);
m_listIcoms.InsertColumn(COL_STATUS, "Status",LVCFMT_LEFT,101,-1);
m_listIcoms.InsertColumn(COL_DOOR, "Door/Gate",LVCFMT_LEFT,62,-1);
m_listIcoms.InsertColumn(COL_ADDRESS, "IP Address",LVCFMT_LEFT,107,-1);[/code]

This is for adding the information to the columns:

[code]void CInputPage::doNewIntercom(int socket, struct _iComStructure *pIcom, struct _iComQueueInfo *pIcomQueue)
struct _itemData *tItemData;
int index;
char buffer[128];

tItemData = (struct _itemData *)findItemData(&pIcom->MAC);

if( !tItemData )
tItemData = (struct _itemData *)calloc(1, sizeof(struct _itemData));
tItemData->next = m_pItemData;
m_pItemData = tItemData;


memcpy(&tItemData->iCom, pIcom, sizeof(struct _iComStructure));


index = getInsert(tItemData);

#if 0
LVITEM item;
item.iItem = index;
item.iSubItem = 0;
item.pszText = (LPTSTR)"";
item.state = 0;
item.stateMask = 0;
item.iImage = 2;
item.lParam = NULL;
item.iIndent = 0;

m_listIcoms.InsertItem( &item );
m_listIcoms.InsertItem (LVIF_TEXT|LVIF_IMAGE, index, "", 0, 0, 2, NULL);

insertIcomItemData(index, (void *)tItemData);
m_listIcoms.SetItemData(index, (DWORD_PTR)tItemData);

tItemData->socket = socket;

if( pIcom-> != 84 )
sprintf(buffer, "*%s", pIcom->name);
strcpy(buffer, (char*)pIcom->name);

m_listIcoms.SetItemText(index,COL_LOCATION, (LPCTSTR)buffer);
m_listIcoms.SetItemText(index,COL_ADDRESS, inet_ntoa(pIcom->addr_in.sin_addr));
m_listIcoms.SetItemText(index,COL_STATUS, szStatus(pIcom->status));

if( pIcom->picRev.opMode1 & OPMODE_RELAY )
m_listIcoms.SetItem( index, COL_DOOR, LVIF_IMAGE, 0, 0, 0, 0, NULL ); // LVIS_SELECTED


if( !(m_uFlags & DA_REMOTE) ) // Only send if local
sendAudioFile(socket, "iAudio\i_activated_us.wav");


//m_listIcoms is the assigned variable for the edit control box displaying the info[/code]

Why does this code work with MFC applications where it won't work with ActiveX? This is my first ActiveX, and it seems to be really touchy! I'm open to any ideas or advice, as I have been working on this for quite a while. Thanks guys.
Sign In or Register to comment.