|
This is an MFC example, but if you're using straight APIs you can do the same.
::MessageBeep() should get called on the left button up message according
to your requirements (unless I need more caffeine)...
void CMyWindow::OnLButtonDown(UINT nFlags, CPoint point)
{
CWnd::OnLButtonDown(nFlags, point);
SetCapture();
fInCapture = true;
}
void CMyWindow::OnLButtonUp(UINT nFlags, CPoint point)
{
if (fInCapture)
{
ReleaseCapture();
fInCapture = false;
CRect clirect;
GetClientRect(&clirect);
if (PtInRect(&clirect, point))
{
::MessageBeep(-1);
}
}
CWnd::OnLButtonUp(nFlags, point);
} Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
cheers Mark, worked a treat
|
|
|
|
|
Hello,
I have a class derived from CMDIChildWnd .In one of the functions I have written
CMenu p;
GetParentFrame()->SetMenu(&p);
But the menu doesn't change.
What else I need to do to change the menu?
Regards
Prithaa
|
|
|
|
|
You're missing DrawMenuBar .
Iain.
|
|
|
|
|
hot to assign a tooltip to a push button in c++
plz help
dghdfghdfghdfghdgh
|
|
|
|
|
|
LMAO
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
|
I create subclass that derive from CEdit and on my dialog have 2 Edit control that including two DDX variable of this class.
I need to use OnEraseBkgnd funtion for change the color of each edit control.
Can I separate the code for change different color in this function.
|
|
|
|
|
It would be better to handle the WM_CTLCOLOR message each edit send the dialog box. There;s an explanation of this method most days on here, so I'm not going to give you detail.
But one of the parameters will identify the ID of the edit control, or the HWND - and you can get the ID from that.
Then simply return different colours.
Iain.
|
|
|
|
|
I use Visual studio C++.NET 2005.
Now I can execute the facedetect.c.
But I need to cut the photo which I detected.
Does anybody know how to write this function's code?
Please give me some example code to reference.
Thank you very much.
|
|
|
|
|
Hi,
I am developing a SDI app. I have disabled the System menu (Windows menu) and I display my own popup menu when the user clicks on the Icon on the title bar.
But when the App is minimizid, when the user clicks on the App in the taskbar, my custom menu doesn't show up.
Is there any way of popping up my own menu when the user clicks on the minimized app?
Thanks in advance,
Narahari Upadhya
|
|
|
|
|
How are you getting your menu to pop up? It sounds as if you're using WM_NCLBUTTONxxx, and I guess when it's in the task bar you don't get this kind of message - am I close?
If this is correct, consider using GetSystemMenu(FALSE) and *modifying* that menu to be what you want. I would suggest that it's 'controversial' to meddle with the standard user interface if you can find other ways to achieve your goal. It may be a simple case of disabling all standard items and adding your items to the end...
|
|
|
|
|
Thats right. I am handling WM_NCLBUTTONXXX to popup my menu.
The reason I don't want to use system menu at all is that I want to remove the default close, minimize and maximize buttons and add my own custom buttons there and hence I have to remove the system menu and show my own menu rather than modifying the system menu.
|
|
|
|
|
I tried manipulating the system menu to add my own menu items.. it works perfectly fine except that eventhough I have Removed the system minimize, maximize and close buttons and drawing my own buttons on top of them, Whenever I click on the title bar, the system close box appears everytime.
I heard its a XP related issue.
Is there any way of getting rid of the close button?
Thanks,
Narahari Upadhya
|
|
|
|
|
Hello everybody,
after resolving a strange error ( error during message queue by setting a pointer )
i put the char *BufferString from a lower place more higher :
from
class MyCEdit
{
public:
MyCEdit(.....);
ccc vvv;
bbb nnn;
protectec:
MessageLoop(.....)
public:
char *Bufferstring; <<<<<<<<
hhhh jjjj;
protected:
oooo pppp;
rrrrr tttt;
};
to
class MyCEdit
{
public:
MyCEdit(.....);
char *Bufferstring; <<<<<<<<<
ccc vvv;
bbb nnn;
protectec:
MessageLoop(.....)
public:
hhhh jjjj;
protected:
oooo pppp;
rrrrr tttt;
};
Now it works
Is it possible that more than one declaration of public or protected blocks makes
internal errors?
I'm really confused, because 6-7 months ago i had a similar problem and i "resolved" it the same way...
|
|
|
|
|
MessageLoop(.....) needs a ; .
Maxwell Chen
|
|
|
|
|
Yeah, and ..... as parameter is also false
|
|
|
|
|
baerten wrote: Is it possible that more than one declaration of public or protected blocks makes
internal errors?
No, it makes no difference. But, by simply moving member variables around, it's highly possible that you simply moved the problem, too.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks for help
Do you think there is a memory fault between the start of the class and my char*-variable?
At the time where i had a similar problem, i moved also the declared (and corrupt) variable line by
line higher, to find at which place the error occurs.
But there was no special pointer which could be allocated with a buggy class which could provoque
f.ex. a buffer overrun
|
|
|
|
|
baerten wrote: Do you think there is a memory fault between the start of the class and my char*-variable?
There's nothing wrong with the class declaration. You may be using it incorrectly, however.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Nice Macro LOL
I'll test if i move the variable before and after macros
Thanks for the suggestion
|
|
|
|
|
baerten wrote: Nice Macro LOL
Yes! When I found this problem some years ago, as the cause of the bug in my project I was too happy: I closed my PC and went to the beach!
baerten wrote: Thanks for the suggestion
You are wellcome
Russell
|
|
|
|
|
I always make my own sections to separate from Wizard generated code. Such as:
class CBeeDlg : public CDialog
{
public:
CBeeDlg(CWnd* pParent = NULL);
enum { IDD = IDD_BEE_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX);
protected:
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
protected:
void InitFont_();
bool RefreshReaders_();
void FreeResource_();
void SetExitFlag_() { m_bExit = true; }
void InitFrameParam_();
public:
void LogMsg(CString sTxt, bool bDbgOnly = false);
void LogErrorMsg();
};
Maxwell Chen
|
|
|
|