|
Luc Pattyn wrote: shouldn't that be if(!hMutex) { ?
Nope, my original code snippet as the below is correct.
HANDLE hMutex = CreateMutex(NULL, FALSE, MUTEX_NAME);
if(hMutex) {
if(ERROR_ALREADY_EXISTS == GetLastError()) {
return FALSE;
}
}
Maxwell Chen
|
|
|
|
|
My mistake. This is one of the exceptional cases where calling GetLastError makes sense even when the function succeeded.
|
|
|
|
|
Maxwell Chen
|
|
|
|
|
What happens after you return FALSE ?
Otherwise, I think you just leaked a system object handle.
Your program should technically close the mutex handle if you are not going to use it.
|
|
|
|
|
Current, I have a parent CWnd, which is displaying many other child CWnds. All my message handling job are being done in parent CWnd, as I do not have access to child CWnds' code.
I wish to know which child CWnds is being clicked.
I can detect the right click
afx_msg void OnContextMenu(
CWnd* pWnd,
CPoint pos
);
pWnd will be the clicked child window.
However, how about left click? I know I can get the mouse coordinate, and perform some calculation accordingly to iterate through see which child CWnds falll into the point. However, I just don't want to go through all this. I which I can have something like.
CWnd* childWind = mouseEvent.getParent();
|
|
|
|
|
for simple child controls, override parent CWnd's PreTranslateMessage().
BOOL CMyWnd::PreTranslateMessage(MSG* pMsg)
{
BOOL b = CDialog::PreTranslateMessage(pMsg);
if(pMsg->message == WM_LBUTTONDOWN)
{
if(pMsg->hwnd == m_edit.GetSafeHwnd())
MessageBox("Edit control);
}
return b;
}
if you need to get mouse click on edit field of combo box, or scroll bar of list box, i think you have to to subclass them.
|
|
|
|
|
Please try it :
BOOL CYourParentWnd::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
*pResult = 0;
NMHDR* pHeader = (NMHDR*) lParam;
switch (pHeader->code) {
case NM_CLICK:
{
CWnd* pcChild = CWnd::FromHandle(pHeader->hwndFrom);
}
break;
}
return FALSE;
}
They sought it with thimbles, they sought it with care;
They pursued it with forks and hope;
They threatened its life with a railway-share;
They charmed it with smiles and soap.
|
|
|
|
|
are you sure that WM_NOTIFY will be sent to parent window by all controls on mouse click?
|
|
|
|
|
No, I am not sure for "all" controls...
...but I would test it in the author's context
They sought it with thimbles, they sought it with care;
They pursued it with forks and hope;
They threatened its life with a railway-share;
They charmed it with smiles and soap.
|
|
|
|
|
|
If you can, please leave a contact。
I want to be a hacker, how should I do?
I do not want to engage in sabotage, just interested in the Trojan Programming.
|
|
|
|
|
???
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Mr_Leon wrote: I want to be a hacker
Well you will not be very popular here.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Have you studied this[^]? I think they managed rather well.
|
|
|
|
|
Mr_Leon wrote: If you can, please leave a contact。
I want to be a hacker, how should I do?
I do not want to engage in sabotage, just interested in the Trojan Programming.
For starters, not beg. Hackers do it on their own.
...byte till it megahertz...
|
|
|
|
|
Hide your process, and then search user's info such as bank account to your mail inbox.
|
|
|
|
|
I'm from China。
Email:7841559@qq.com
|
|
|
|
|
Hook 去看雪论坛 一堆堆搞Hook的
学英语 去新东方
|
|
|
|
|
ignor d dwn votes brohter
|
|
|
|
|
Hi,
I have read your article about "Rendering GIF, JPEG, Icon, or Bitmap Files with OleLoadPicture".It's very interesting. But I have some problems about it.If the Windows are maximized,the picture showed in the STATIC would be erased.
Could you provide the code?My email address is nalang@163.com.
Thanks.
|
|
|
|
|
[1]Make the picture storing object, might be instance of CBitmap, accessible all the time by making it as data member of class.
[2]Do the painting operation in ::OnDraw(SDI\MDI Application) or ::OnPaint(Dialog based Application)
Sameer();
|
|
|
|
|
post this in the discussion area under the article you read.
|
|
|
|
|
Hi,
I have a CPropertysheet containing a number of property pages and I would like to initialize all of the porpertypages at the same time (e.g. in the CPropertySheet::OnInitDialog()) rather than initialize each one as the user selects the tab. I am sure there used to be a way to do this 'early' initializing but I cant find anything about it.
Does anyone have any suggestions? I thought about making the OnInitDialog() methods in my propertypages public but that seems a bit naughty.
Thanks
Tony
|
|
|
|
|
Check out the PSP_PREMATURE style.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hey thanks David, I'm not going mad after all. I was beginning to think I had imagined it
Tony
|
|
|
|