|
Hi and thanks alot!
It seems as if I have to say goodbye to my initial idea . The dialog is part of a DLL that's being loaded by a third-party application I cannot influence.
Then I guess I'll try to give my dialog a special window class I can use in a FindWindow() from the external application and not use HWND_BROADCAST.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Unfortunately, my other idea (setting the class name of the dialog) doesn't work either, because PreCreateWindow (where the class name can be modified) doesn't get called for CDialog derived classes.
Is there anything else I can try?
Regards,
mav
--
Black holes are the places where god divided by 0...
-- modified at 5:21 Friday 2nd June, 2006
Although I don't really like the solution, I think I'll go for FindWindow with a special window title. That way I can at least find the dialog...
Thanks für the help.
|
|
|
|
|
If you just need a dialog box for simple passive spying of your broadcasted messages, I think you can try to create a separate dialog-based application. In this case the dialog window is expected to be the top-level one. You will be able to start this debugging dialog only when you need it, even if the main receiver application is stopped.
|
|
|
|
|
Thanks for the suggestion, but (as always) it's not as simple as that.
I have the dialog in my DLL because I need to raise events to the hosting application from within the same thread that loaded my DLL.
Some events I get come in via remoting from a different thread, so I have to "marshal" (big word for sending a message ) them to the other thread by sending a message to the dialog and have the dialog raise the event.
Now I not only have to send messages to the dialog from within the DLL (where I have access to the dialog's HWND), but from other applications as well. That's the whole reason for my problems...
Well, the constant window title at least works, so I think I'll have to use it for now until I find a better way.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Hai to all of you
i am new in VC++ and i have make a simple application But
one of the form of that application contain some error..........
Like Whenever i click any button of that form then MessageBox Generate a Message Could not add new member
Note: I have also write the code of button ,yet its not responding accordingly . i don't know where i am lacking
Plz Tell me.....
mailing me
Yogi
|
|
|
|
|
can you show error message and you get this error only in this application or all projects
whitesky
|
|
|
|
|
how to change the background color of a custom color dialog
|
|
|
|
|
of course its not a good way but maybe its some helpful to you
<br />
class CMyDialog: public CColorDialog<br />
{<br />
public: <br />
DECLARE_DYNCREATE(CMyDialog)<br />
CMyDialog();<br />
~CMyDialog();<br />
DECLARE_MESSAGE_MAP()<br />
<br />
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);<br />
};<br />
<br />
<br />
<br />
<br />
IMPLEMENT_DYNCREATE(CMyDialog, CColorDialog)<br />
<br />
BEGIN_MESSAGE_MAP(CMyDialog, CColorDialog)<br />
ON_WM_CTLCOLOR()<br />
END_MESSAGE_MAP()<br />
<br />
CMyDialog::CMyDialog()<br />
{<br />
<br />
}<br />
<br />
CMyDialog::~CMyDialog()<br />
{<br />
}<br />
<br />
<br />
HBRUSH CMyDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)<br />
{<br />
HBRUSH hbr = CColorDialog::OnCtlColor(pDC, pWnd, nCtlColor);<br />
LOGBRUSH logBrush;<br />
logBrush.lbStyle = BS_HATCHED;<br />
logBrush.lbColor = RGB(100, 192, 192);<br />
logBrush.lbHatch = HS_CROSS;<br />
if(pWnd==this)<br />
SetWindowText("Test");<br />
return CreateBrushIndirect(&logBrush);<br />
}<br />
whitesky
|
|
|
|
|
is there any way to change the color of the buttons and the static texts??
|
|
|
|
|
See WM_CTLCOLORSTATIC
whitesky
|
|
|
|
|
Hello everyone,
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?
thanks in advance,
George
|
|
|
|
|
Using Win32 this can be done using regions. Create a region in the shape of the polygon then use the PtInRegion function.
Steve
|
|
|
|
|
Thank you Steve,
Seems that you like using system internal functions other than implement them by yourself.
Actually, I think I need to implement the algorithm by myself -- a portable algorithm works for both Win32 and Linux. Any ideas or reference materials?
regards,
George
-- modified at 3:51 Friday 2nd June, 2006
|
|
|
|
|
George_George wrote: Seems that you like using system internal functions other than implement them by yourself
Why reinventing wheel when it is not necessary ?
George_George wrote: Any ideas or reference materials?
Is this[^] helpfull ?
Anyway, google[^] is very helpfull also.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
Thank you Cedric,
The material is very helpful.
regards,
George
|
|
|
|
|
There are many methods. One popular one is the "Weiler-Atherton Algorithm".
Steve
|
|
|
|
|
Hi Steve,
I have searched this algorithm -- it is dealing with clipping. Does it have anything deal with my question?
regards,
George
|
|
|
|
|
hi all,
please help me how can i sort (based on a object member variable )
a vector that holds object.
Regards,
Prashanth.v
|
|
|
|
|
// Console.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
using namespace std;
// My object.
class MyObject
{
public:
MyObject(int Index) : m_Index(Index) {}
int m_Index;
};
// Output to stream.
ostream& operator<<(ostream &s, const MyObject &o)
{
s << o.m_Index;
return s;
}
// A functor to compare two 'MyObject's based on the member 'm_Index'.
struct MyObjectLess
{
bool operator()(const MyObject &l, const MyObject &r) const
{
return l.m_Index < r.m_Index;
}
};
int main(int argc, char* argv[])
{
// Our collection.
vector<MyObject> objects;
// Fill the collection.
objects.push_back(MyObject(3));
objects.push_back(MyObject(1));
objects.push_back(MyObject(4));
objects.push_back(MyObject(1));
objects.push_back(MyObject(5));
objects.push_back(MyObject(9));
// Print the collection.
cout << "Before sorting:" << endl;
copy(objects.begin(), objects.end(), ostream_iterator<MyObject>(cout, "\n"));
cout << endl;
// Sort them based on the 'm_Index' member variable.
sort(objects.begin(), objects.end(), MyObjectLess());
// Print the collection.
cout << "After sorting:" << endl;
copy(objects.begin(), objects.end(), ostream_iterator<MyObject>(cout, "\n"));
cout << endl;
return 0;
}
Steve
|
|
|
|
|
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:
struct MyObject
{
MyObject(int x, int y)
{
mX = x; mY = y;
}
static bool ComparatorByX_values(const MyObject & obj1, const MyObject & obj2)
{
return obj1.mX < obj2.mY;
}
static bool ComparatorByX_pointers(const MyObject * obj1, const MyObject * obj2)
{
return obj1->mX < obj2->mY;
}
int mX, mY;
};
int main()
{
{
std::vector< MyObject > vector;
vector.push_back(MyObject(3, 20));
vector.push_back(MyObject(2, 10));
vector.push_back(MyObject(1, 30));
std::sort(vector.begin(), vector.end(), MyObject::ComparatorByX_values);
for(size_t i = 0; i < vector.size(); ++i)
{
printf("%i\n", vector[i].mX);
}
}
{
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));
std::sort(vector.begin(), vector.end(), MyObject::ComparatorByX_pointers);
for(size_t i = 0; i < vector.size(); ++i)
{
printf("%i\n", vector[i]->mX);
}
}
}
Hope this will ispire you.
-- modified at 10:46 Friday 2nd June, 2006
|
|
|
|
|
the object class must overload the comparison operators ( < , > , <= , >= ) and then, simply call std::sort(vec.beging(), vec.end());
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
Hi,
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?
Thanks:-
Mike
|
|
|
|
|
I wrote an article about a chart control here[^]. Maybe it is helpfull for you ?
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
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.
Code snipts are here :
in header file
afx_msg void OnTrayNotify(WPARAM wParam, LPARAM lParam);
in message map
ON_MESSAGE(WM_TRAY_MESSAGE ,OnTrayNotify)
Notify function defenition
afx_msg void CTrayMinDlg::OnTrayNotify(WPARAM wParam, LPARAM lParam)
{
UINT uID;
UINT uMsg;
uID = (UINT) wParam;
uMsg = (UINT) lParam;
if (uID != 1)
return;
CPoint pt;
switch (uMsg )
{
case WM_LBUTTONDOWN:
GetCursorPos(&pt);
ClientToScreen(&pt);
OnTrayLButtonDown(pt);
break;
case WM_RBUTTONDOWN:
case WM_CONTEXTMENU:
GetCursorPos(&pt);
OnTrayRButtonDown(pt);
break;
}
return;
}
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;
m_menu.GetSubMenu(0)->TrackPopupMenu(TPM_BOTTOMALIGN|
TPM_LEFTBUTTON|TPM_RIGHTBUTTON,pt.x,pt.y,this);
}
Regards.
|
|
|
|
|