I have a UI application and I need to display context menu according to whether user clicks inside a polygon or not. So, I think I need to use some algorithms which can check whether a point is inside a polygon.
Does anyone have any ideas or reference materials?
// Fill the collection.
If you talk about STL library, then the sorting can be done with sort function defined in algorithm. You have to devine a "binary predicate", wich compares objects according to your needs. Solution depends on how you store objects in vector -- as values or as pointers. The bellow sample shows both cases:
MyObject(int x, int y)
mX = x; mY = y;
// binary predicate for the case of storing valuesstaticbool ComparatorByX_values(const MyObject & obj1, const MyObject & obj2)
return obj1.mX < obj2.mY;
// binary predicate for the case of storing pointersstaticbool ComparatorByX_pointers(const MyObject * obj1, const MyObject * obj2)
return obj1->mX < obj2->mY;
int mX, mY;
// case 1: storing values.
std::vector< MyObject > vector;
// sort by X
std::sort(vector.begin(), vector.end(), MyObject::ComparatorByX_values);
// print Xfor(size_t i = 0; i < vector.size(); ++i)
// case 2: storing pointers.
std::vector< MyObject * > vector;
vector.push_back(new MyObject(3, 20));
vector.push_back(new MyObject(2, 10));
vector.push_back(new MyObject(1, 30));
// sort by X
std::sort(vector.begin(), vector.end(), MyObject::ComparatorByX_pointers);
for(size_t i = 0; i < vector.size(); ++i)
// (TODO: delete the objects using "delete" in a loop)
I want to draw line graph without using MsExcel. I found many application on codeguru to plot the graph using Excel feature. But want to plot the line graph without using Excel. Can anybody help me out?
I have dowloaded a code from codeproject that adds a icon in systemtray and also a popup menu appears when a right click is made on the icon, but the if I do not select any option fron popup menu and click on some where else this popup menu do not disappear, why it is happening.
How it can disappear if i do not select any option and click some else where it should disappear.
void CTrayMinDlg::OnTrayLButtonDown(CPoint pt)
MessageBox("You have clicked Left mouse Button ");
void CTrayMinDlg::OnTrayRButtonDown(CPoint pt)
//m_menu is the member of CTrayMinDlg as CMenu m_menu;
Yes I used the same one. the popup menu apeared on clicking the tray icon do not disappear if i click on some other window. It remains there, and to make it disappear I have to select something from menu.
I want to hide the popup menu when I click on some other menu or in some other area
MSDN library mentions this problem in the description of ::TrackPopupMenu function. In order to solve it, there is a recomendation to make the window foreground before TrackPopupMenu, and then to post a benign message immediately after TrackPopupMenu:
Giving it just a try....
Its not clear from your posts what context are you working in.
Try and check the settings for the project . May be the path of the exe is not mapping currently. Go to project>settings>Debug>(set the path of the exe manually).
Does this help you?
Somethings seem HARD to do, until we know how to do them.
I am able to load(AfxLoadLibrary) the libavcodec dll in a VC7 Dialog based application. However I dont know how to call the functions within this DLL to encode/decode video. Has anybody done anything of this sort?