|
Try listening for WM_NCLBUTTONUP, but this would trigger also when the user simply clicks somewhere in the non-client area of the window.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
If the mouse is over the window, it will receive WM_LBUTTONUP, if the mouse is outside - it will not. To overcome this situation, you need to 'SetCapture' on WM_LBUTTONDOWN and 'ReleaseCapture' on WM_LBUTTONUP...
|
|
|
|
|
TThank u 4 ur quick responses.. i tried both of them but the problem still exists.. I commented SendMessage(WM_NCLBUTTONDOWN,HTCATION); and put some variable assigning code there and both LBUTTONDOWN and LBUTTONUP triggers..
when put back SendMessage(WM_NCLBUTTONDOWN,HTCATION);, LBUTTONUP does not trigger..
i dont know wat to do..
|
|
|
|
|
The mouse up message does happen - you can check this with Spy++.
But the window moving stuff happens in response to the WM_NCLBUTTONDOWN message you've manually sent. That starts a message loop looking for mouse messages that is not the MFC message loops. It moves the window until you let go of the mouse, or press escape.
If you want your window to be movable with the mouse, a far more elegant way of doing it is responding to the WM_NCHITTEST message.
class CMyMovableDialog : public CDialog
{
...
afx_msg LRESULT OnNcHitTest(CPoint point);
...
};
...
ON_WM_NCHITTEST()
...
LRESULT CMyMovableDialog::OnNcHitTest(CPoint point)
{
return HTCAPTION;
}
I hope that helps,
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
well, this still does not solve my problem, when i catch OnNcHitTest, i cannot even trigger the LBUTTONDOWN event.. anyway i learnt something out of your reply, thanx mate!
|
|
|
|
|
Isuru_Perera wrote: well, this still does not solve my problem
Well, I'm not sure what the problem actually is. You had a mystery of a "missing" WM_LBUTTONUP, which is now explained.
So, what's the actual problem that you're trying to solve?
Iain,
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
I get it,too.But when i process wm_syscommand in winproc , it run away,hope help.
if(message==WM_SYSCOMMAND)
{
return 0;
}
return ViewItem::WindowProc(message, wParam, lParam);
|
|
|
|
|
hi,
i got 1 propertysheet which contain 3 propertypage. I want to make it when program start,it will auto visually click on the radio button for the 1st page.
I had set the OnRadioDirection1() function in my dialog OnInitDialog() and also onSetActive() .But still cannot work.Am i miss up something?
modified on Thursday, September 17, 2009 9:43 PM
|
|
|
|
|
If you have one int member variable for the radio button group, set it's value in the page's OnInitDialog() method. Otherwise, if you have a CButton object for each radio button in the group, call the SetCheck(BST_CHECKED) method.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
yes. i had set it into
<pre>
static_cast<cbutton*>(GetDlgItem(IDC_TEST))->SetCheck(BST_CHECKED);
OnClick(IDC_TEST);
but still nothing happen. i also had set it for onSetActive().
But when the user "click" to radio button. It will perform well.
|
|
|
|
|
first, declare as CButton type member variable in your .h file.
ex : CButton m_RadioBtn1;
after that, in InitDialog, call SetCheck() function and pass TRUE or 1
as argument.
m_RadioBtn1.SetCheck(1);
it should work.
Regards,
Srinivas
|
|
|
|
|
and one line is missing,
you should declare in DoDataExchange(CDataExchange* pDX) like :
void CFirstPage::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
DDX_Control(pDX, IDC_RADIO_AUTOMODE, m_RadioBtn1);
......
......
}
thats it
Regards,
Srinivas
|
|
|
|
|
http://www.microsoft.com/technet/security/bulletin/MS09-035.mspx[^]
We are struggling with how we advise our customers about this issue as we have active-x components in our product.
Here’s a Washington Post article giving some back ground from an independent source:
http://voices.washingtonpost.com/securityfix/2009/07/microsofts_emergency_patch_mes.html?wprss=securityfix[^]
The corrective solution is apply the emergency security patches that Microsoft release for Visual Studio and recompile/re-distribute code to our customers. This also involves installation of new runtime support for Visual Studio code.
It looks like none of the components we produced are vulnerable, however one component in a third party library that we use looks like it might be. We have source to the third party library and can recompile it.
These components are not typically used with a browser so we think it would take some form social engineering attack to use them as a attack vector. But given an exploitable flaw we are holding up a release to get this update into it.
Questions?
1. Do you think the C++ runtimes are vulnerable. I.E. All old applications should be updated so the old C++ run time redistributables can be removed from the environment?
2. How big of an emergency notice should we send out to our customers? Is this potentially a mini Y2K?
3. Does this problem potentionally affect customers of code developed with Visual Studio 97?
|
|
|
|
|
Hi Fred,
I can give you some feedback but you should not consider this as security advice.
fredsparkle wrote: 1. Do you think the C++ runtimes are vulnerable. I.E. All old applications should be updated so the old C++ run time redistributables can be removed from the environment?
No, my understanding is that MS09-035 only effects components built with ATL. You can use this graph to determine if your component is effected.
Active Template Library Security Update for Developers[^]
fredsparkle wrote: 2. How big of an emergency notice should we send out to our customers? Is this potentially a mini Y2K?
If your customers are using your ActiveX components in an internet browser and/or your components are marked as safe for scripting then I would consider this a critical situation.
fredsparkle wrote: 3. Does this problem potentionally affect customers of code developed with Visual Studio 97?
My understanding is that this flaw was introduced in Visual Studio 2003 SP1. The flaw exists in the ATL source code distributed with this update. I do not believe Visual Studio 97 is effected.
More information:
Security Bulletin Webcast Q&A - OOB July 2009[^]
I would recommend calling Microsoft customer support services at 1-866-PCSAFETY. Microsoft does not charge for security related issues.
Best Wishes,
-David Delaune
|
|
|
|
|
Like many well publicized vulnerabilities, this one is actually rather narrow in the risk. Your application may not even be affected. The following blog clarifies this a little:
http://blogs.msdn.com/sdl/archive/2009/07/28/atl-ms09-035-and-the-sdl.aspx[^]
This isn't remotely close to a mini Y2K (which was also overhyped) and anyone keeping their systems up-to-date have little to fear. Those who don't have FAR worse vulnerabilities to worry about.
|
|
|
|
|
I was playing around with a small piece of code that queries port 37 on host 129.6.15.28 to get the date and time. It consistently gives me back 3435973836. Doing the conversion, that's roughly 108.8 years after January 1, 1900 (the epoch). For today, I would have expected a number close to 3461794781. Questions: 1) why would I keep getting the same number, and 2) why is it not the right number?
SOCKET rSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
unsigned long ul = 1;
ioctlsocket(rSocket, FIONBIO, &ul);
SOCKADDR_IN rSocketAddr;
rSocketAddr.sin_family = AF_INET;
rSocketAddr.sin_addr.s_addr = inet_addr("129.6.15.28");
rSocketAddr.sin_port = htons(37);
connect(rSocket, (LPSOCKADDR) &rSocketAddr, sizeof(rSocketAddr));
unsigned int nData = 0;
recv(rSocket, (char *) &nData, sizeof(nData), 0);
TRACE("%u\n", nData); Update: initializing nData to 0 answers the questions as to why recv() was consistently assigning 3435973836 to nData . After a few more rounds of testing, the culprit looks to be the call to ioctlsocket() which made the socket non-blocking.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Uhm....Have you seen the hex representation of the number 3435973836 (0xCCCCCCCC )?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Yes. I realize it's likely a special value, but without knowing what, it's currently just another number.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
I suppose the address of operator will remove the special value.
recv(rSocket, &nData, sizeof(nData), 0);
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
My bad. What I had would have actually resulted in a compiler error (which I obviously don't have).
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Hey David, if my understanding is correct, you keep receiving 0xCCCCCCCC . If it is so, you probably are plainly receiving nothing and should check recv return value.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I am checking the return value, I just didn't bother putting in my code snippet. It's always 4.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Should
recv(rSocket, nData, sizeof(nData), 0);
be
recv(rSocket, (void*)&nData, sizeof(nData), 0);
You need to give recv a pointer to put the data into...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
PS - you also need to convert the received data (nData) to host byte-ordering from network byte-ordering using ntohl:
unsigned int nData;
recv(rSocket, &nData, sizeof(nData), 0);
nData = ntohl(nData);
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
No matter how you swap 0xcccccccc, it always comes out the same.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|