|
This "// Generated message map functions " (VC 6.0) is misbehaving.
After adding right mouse button function I found out that last three functions in this "//{{AFX_MSG " block are missing. The function definitions are still in .cpp file.
Are there any limits to how many functions MFC will generate?
Thanks for reading
|
|
|
|
|
I dont know the limit but u may generate many functions in vc++ . there is not as such limit ....sometimes there might be problem that we dont see msg mapping code but definition is still there .....
u may restart ur computer and then debug ur code and than u see is there all msg map code is display on screen
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
Shilpi Boosar wrote: u may restart ur computer and then debug ur code
In what grounds do you think this is necessary. What has a restart to do with this?
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
I dont know ...but sometimes it happens with me also and when i restart computer and than everything will goes perfect ,....that is fact....
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
Shilpi Boosar wrote: I dont know ...
Oh!
Shilpi Boosar wrote: when i restart computer and than everything will goes perfect
But what has this got to do with writing code? Will the code be changed to get out of errors by restarting? Come on.
Shilpi Boosar wrote: that is fact....
You call it that way?
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
many times when v write something on wizard than we dont see message map and somedeclaration ....but next time v use that application than everyting display on screen ....if u dont beleive me ....than its ok ....i face that problem thats y i m asking him ....and if u have solution of his problem than give it to him ....plz ....dont comment on others forum
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
Shilpi Boosar wrote: dont comment on others forum
Whose forum is this?
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
If you are manually adding items to the message map, you should add them outside of the //{{AFX_MSG block:
BEGIN_MESSAGE_MAP(CMyView, CFormView)<br />
ON_BN_CLICKED(IDC_START, OnStart)<br />
ON_BN_CLICKED(IDC_CANCEL, OnCancel)<br />
ON_COMMAND(IDHELP, OnHelp)<br />
ON_COMMAND(ID_HELP, OnHelp)<br />
<br />
END_MESSAGE_MAP()
because inside the block is updated by the wizard and it will remove functions it didn't add (or at least most of them).
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
<kmedcalf@ev1.net>
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
The problem is it removed OnTimer ( and two others after that ) which I added using wizard.
73 AA7EJ
|
|
|
|
|
Hi,
I have a list view with LVS_EDITLABEL set for it, editing labels was ok until I modified the style to have LVS_OWNERDATA, when I added this style to the control it stopped me from having a success editing labels. when I remove LVS_OWNERDATA style it works, when I add it no label editing is permitted!!!
This is wiered and I really spent much time searching for the problem...
Any help guys?
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
Are you handling the LVN_GETDISPINFO notification from the control?
When you use LVS_OWNERDATA you are respnsible for storing the text somewhere
and providing it to the control when requested.
Mark
|
|
|
|
|
Yes, I am handling the LVN_GETDISPINFO from the control itself, not the parent. I do store text and all data in some datastructures and I do provide it to the control when it asks for it..
but how does this affect editing labels? and how to solve the issue?
Note: I am handling the LVN_GETDISPINFO from the control becuase I have a dynamically created control derieved from CListView, and I dont know how to map its events to the parent (except WM_NOTIFY).
would you provide any help regarding this plz?
Thanks
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
>>but how does this affect editing labels?
It effects almost everything. When you use LVS_OWNERDATA the control only maintains information
about what item is selected and the control's focus. It's up to you to provide the rest.
When it needs text you provide the text. When it needs the image (icon) you provide it, etc.
LVN_GETDISPINFO is sent to the parent of the control.
In the parent window class, add a OnNotify() function (handler for WM_NOTIFY).
In this example I've used the item's lParam to store an index into some array of structures
which hold the info for each item in the list. I've shown a way to handle LVN_GETDISPINFO for
LVIF_TEXT and LVIF_IMAGE. This would be the bare minimum you'd need to provide to the control.
(Actually I don't think items HAVE to have an image )
All the other notifications are dispatched to functions I've added to my CMyCWndDerivedClass
class...
BOOL CMyCWndDerivedClass::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
NMHDR *pHdr = (NMHDR *)lParam;
if (wParam == IDC_MYLISTVIEWCTRL)
{
if (pHdr->code == LVN_GETDISPINFO)
{
NMLVDISPINFO *pLVDispInfo = (NMLVDISPINFO *)pHdr;
if (pLVDispInfo->item.mask | LVIF_TEXT)
{
LVITEM LVItem;
LVItem.mask = LVIF_PARAM;
LVItem.iItem = pLVDispInfo->item.iItem;
LVItem.iSubItem = 0;
pListCtrl->GetItem(&LVItem);
int nItemIndex = (int)LVItem.lParam;
if (nItemIndex >= 0)
{
pLVDispInfo->item.pszText = <--(point this to the row's text)
}
else
{
pLVDispInfo->item.pszText = _T("ERROR");
}
}
if (pLVDispInfo->item.mask | LVIF_IMAGE)
{
LVITEM LVItem;
LVItem.mask = LVIF_PARAM;
LVItem.iItem = pLVDispInfo->item.iItem;
LVItem.iSubItem = 0;
pListCtrl->GetItem(&LVItem);
int nItemIndex = (int)LVItem.lParam;
pLVDispInfo->item.iImage = <--(provide index into image list here)
}
return TRUE;
}
else if (pHdr->code == LVN_BEGINDRAG)
{
LvnBeginDrag((NMLISTVIEW *)lParam);
return TRUE;
}
else if (pHdr->code == LVN_ITEMCHANGED)
{
LvnItemChanged((NMLISTVIEW *)¬ifyInfo);
return TRUE;
}
else if (pHdr->code == LVN_ITEMACTIVATE)
{
LvnItemActivate((NMITEMACTIVATE *)¬ifyInfo);
return TRUE;
}
else if (pHdr->code == NM_RCLICK)
{
ListRClick((NMLISTVIEW *)lParam);
return TRUE;
}
else if (pHdr->code == NM_DBLCLK)
{
ListDblClick((NMLISTVIEW *)lParam);
return TRUE;
}
else if (pHdr->code == LVN_BEGINLABELEDIT)
{
return LvnBeginLabelEdit((NMLVDISPINFO *)lParam);
}
else if (pHdr->code == LVN_ENDLABELEDIT)
{
return LvnEndLabelEdit((NMLVDISPINFO *)lParam);
}
else if (pHdr->code == LVN_COLUMNCLICK)
{
LvnColumnClick((NMLISTVIEW *)lParam);
return TRUE;
}
} //if (wParam == IDC_MYLISTVIEWCTRL)
return CWnd::OnNotify(wParam, lParam, pResult);
}
|
|
|
|
|
By the way, it's rare that you need to override control classes in MFC. Except for special needs,
controls and their notifications can nearly always be handled in the control's owner window.
That's by design in MFC
Mark
|
|
|
|
|
How do I do image comparison for 2 live video feed?
I am suppose to compare 2 live video feed of vehicular flow. So how do i track the vehicles from the first video to the second video?
pls help. Thanks
|
|
|
|
|
You need to match the items exactly - not just track movement, but work out which vehicle is which ? Will you have any idea what part of teh screen they will be on ? They are two different videos, right ? I'm guessing from different angles ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
yup.. i will get 2 videos, one at from the start of the roaad and the other one at about 250m away. i will need to match the vehicle shown in the first video to the one shown in the second video. the angle is about the same
|
|
|
|
|
i would position the cameras so i can capture the license plates on the vehicles, then use a library to convert the license plate number in to text and match for the two vehicles.
I can only please one person a day... today is not your day
|
|
|
|
|
I'm getting fed up of calling LoadString() every other line, so I decided to make a wrapper class. The class works, but I always need to use the '&' address of operator when calling a function.
class CStr
{
public:
TCHAR str[2048];
CStr(){};
CStr(UINT id){ LoadString(GetModuleHandle(NULL),id,str,2048); }
LPTSTR operator&(){ return str; }
};
Its currently called like this:
LPCTSTR foo = &CStr(101);
but I want it to be like this:
LPCTSTR foo = CStr(101);
Is there any way I can hide the '&'?
|
|
|
|
|
Add a casting operator instead of the & operator.
class CStr
{
public:
TCHAR str[2048];
CStr(){};
CStr(UINT id)
{
LoadString(GetModuleHandle(NULL),id,str,2048);
}
operator LPTSTR() { return str; }
};
Steve
|
|
|
|
|
What about a conversion operator?
class CStr<br />
{<br />
public: <br />
TCHAR str[2048]; <br />
CStr(){}; <br />
CStr(UINT id){ LoadString(GetModuleHandle(NULL),id,str,2048); } <br />
operator LPTSTR() {return str;}<br />
};<br />
By the way, in this line:
LPCTSTR foo = CStr(101);<br />
Only a temp object is created for the assignment. foo will be undefined after that!
Try:
CStr fooCStr(101);<br />
LPCTSTR foo = fooCStr;<br />
Mark
|
|
|
|
|
The casting operator works, thanks guys.
Mark Salsbery wrote: Only a temp object is created for the assignment. foo will be undefined after that!
I realise this. This example I gave was very simple, there is infact a base class which stores the loaded string (hoping it will increase the performance a little). The purpose of this wrapper is to make it easier to pass strings into functions, so really I only need a temp assignment.
|
|
|
|
|
>>The purpose of this wrapper is to make it easier to pass strings into functions, so really I only need a temp assignment.
Ok good You won't want to try to persist that returned LPCTSTR from an implicitely created object!!
Mark
|
|
|
|
|
waldermort wrote: I'm getting fed up of calling LoadString() every other line, so I decided to make a wrapper class. The class works, but I always need to use the '&' address of operator when calling a function.
You can use LoadString function of CString .
#define IDS_FILENOTFOUND 1
CString s;
if (! s.LoadString( IDS_FILENOTFOUND ))
{
AfxMessageBox("Error Loading String: IDS_FILENOTFOUND");
...
}
LPCTSTR lpctszOooohBlahBlah = s;
|
|
|
|
|
If I were using MFC I wouldn't need to create a wrapper now would I
Even if that were the case, you would still need to create a CString object, call it's LoadString() member, then pass the object to a function. Thats 3 lines of code. My class allows me to it in a single line, Ie. A wrapper.
|
|
|
|