|
What is the best way to detect if a user presses the L button down and releases it within a specified region on a dialog? The way I'm considering doing it is to use the OnLButtonDown and OnLButtonUp methods and set a bool flag when the user presses down whilst within this region and when they release the mouse to check this flag and then check if they are still in the region. Is this the best/recommended way of doing it or is there better more effient ways?
TIA,
|
|
|
|
|
AFAIK, this is the one... But you have to use the SetCapture also.
- NS -
|
|
|
|
|
cheers, I implemented it as I described but also used SetCapture and ReleaseCapture and it worked a treat
|
|
|
|
|
Detect a LButtonDown over the region, capture the mouse when this happens, and then wait for the LButtonUp message. If the LBU is over the region, react.
Watch out for things like (De)activate and/or kill focus messages - if the user switches apps while holding down the mouse button, you will need to release the capture.
The reason you do not want to just react to LBU is that the user could click and hold the mouse button down, and then drag it over to your app and release. This happens a lot by accident and you would not want to react to that accident. Try that with a standard button control and you will see what I mean.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
hi, i got an I/O Completion Port question , one of socket called WSARecv(...) and waiting in GetQueuedCompletionStatus( ... ) .
While waiting, can i call WSASend(...) to send data to the socket ? Can buffer conflict if both WSARecv , WSASend return by GetQueuedCompletionStatus( ... ) at the same time by different thread ? If so , how can i prevent that? Thank you.
|
|
|
|
|
unknown101 wrote: Can buffer conflict if both WSARecv , WSASend
We cannot no the answer for any memory your code is managing. The kernel buffers should not be a problem.
unknown101 wrote: If so , how can i prevent that?
Using synchronization.
|
|
|
|
|
Hi,
My project has a Modal dialog box(first dialog box)
1)First dialog box consist of a button, on clicking that button another modal dialog box(second dialog box) opens.
2)First dialog box also consist of tab control which consist of two tabs.Each tab has modelless dialog box.
My question is when i open the second dialog box(opens on pressing the button) the control will be with second dialog box as it is a modal dialog box but when i place it on one of the tab dialog box(the dialog size of the second dialog box is smaller than the dialog box on the tab) and a mouse click on the tab dialog box the control goes to tab dialog box,.Why?? How to avoid this. The second dialog box should have the control until i close it.
I hope you people got my quesion.
Thanks in advance
|
|
|
|
|
What is the parent/owner relationship between the first and second modal dialog boxes?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks for reply.
First dialog box is a main application(User interface for the user).second dialog box is, if the user wants to change the COM port settings like baud rate or parity he has to open second dialog box which can be opened by pressing the button on the main application.
|
|
|
|
|
It matters not what they are used for. What is the parent/owner relationship between the first and second modal dialog boxes? Just because dialog A opens dialog B, that does not also imply that dialog A is the parent of dialog B, or that dialog B is owned by dialog A.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
You are asking style of the window. Both are popup window style.
I hope i have answered your question if not let me know in detail.Am not getting what does parent/owner relationship means.Even tab windows are popup style.
|
|
|
|
|
We should not have popup window style for dialog box??
This is the settings for main application
STYLE DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE |
WS_CAPTION | WS_SYSMENU
Second modal dialog box
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
|
|
|
|
Ok.
Are you using resource editor? or coding all by yourself?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Am using resource editor(MFC SDI project)
|
|
|
|
|
Then in the button to do the call, try it like:
void CMyButton::OnClick ()
{
CMySecondDlg newDlg;
if (IDCANCEL == newDlg.DoModal ())
return;
}
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Hypothetically, is there a way to create a DLL that will only work at runtime? Any attempt to use the DLL from a development environment would fail?
I am investigating some ways to protect intellectual property.
Any input would be greatly appreciated.
|
|
|
|
|
And what is the problem when loading your dll if the project is executed from the IDE ?
Did you think about distributing the release version of your dll ?
|
|
|
|
|
Here is a hypothetical example...
Fred spends years developing a DLL to do intense mathematical computations. Bob buys a license to develop against and distribute Fred’s DLL with Bob’s application. Fred is worried other people will use his DLL in their own applications.
Just compiling the DLL in release mode will not stop people from using the DLL in Visual Studio, and releasing an application that uses it.
Is there any way to do this?
|
|
|
|
|
electronica808 wrote: Is there any way to do this?
how can anyone, even licensed customers, use your DLL if they can't use it inside an IDE ? do all your users have to develop via command line ? i, for one, would hate hate hate hate hate using a DLL that tried to enforce such a restriction - even though i think it's probably not possible to do.
what about just making the user 'initialize' the DLL with a license key that you issue?
|
|
|
|
|
Thanks for the reply.
Since Bob has paid, he should be able to use the DLL from the development environment and release his applications.
I am thinking this probably is a pretty common scenario. I was wanting to see what developers are doing currently to protect their intellectual property.
I had thought of the initialization key as a rudimentary way to pull this off. I wondered if there were any more solutions to this.
|
|
|
|
|
I think this is the biggest problem with "portability" of DLLs. Are very comfortable but, on the other side...
I guess the only thing you can do to protect the use of some functions and allow them only in an application... is to do it inside the application. As a new module/class, and asking for license or password before executing. But in a dll...
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
electronica808 wrote: Since Bob has paid, he should be able to use the DLL from the development environment and release his applications.
but there will be no way to evaluate the DLL in an IDE ? if not, that will certainly turn off potential customers.
we use init keys, it works fine.
we've also done separate trial and licensed builds. that's a bit more secure but it doubles the number of binaries you have to build, test and distribute, as well as requiring a scheme to restrict access to the licensed builds (ex. a password-protected web folder).
i've seen DLLs that require you to get a license key for the individual machine , and the DLL will then only run on that particular hardware. that's fine if your app is running on a web server (one machine, many users), but unworkable for distributed apps.
-c
|
|
|
|
|
If Bob doesn't pay, he uses this DLL in his product and he's making lots of $$$.
Sue him.
People who are going to make money from their products, often want their software to be legal. I know that we read the licensing documents with every bit of software we use.
That's protection enough for me.
If he's not making any (or much) money, don't worry about it.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</A>
|
|
|
|
|
Thanks for everyone's help.
This application is going to be distributed to the user's machine.
I am Bob giving suggestions to Fred. I will suggest using an init key.
|
|
|
|
|
electronica808 wrote: I will suggest using an init key.
Would you mind giving a little more information about an "init key". I don't know anything about this.
On your original subject, you could make your dll freely available, but make it callable only thru an API that you license and sell. One way to do this would be to have your API scramble the function calls in such a way that the functions within the dll understand the call, but the call interface is not meaningful to anyone trying to use the naked dll. You protect the API with copyright.
Another way would be to have an init function within the dll that had to be called (to set some static data) before any of the functions would work correctly. The only (legal) way to call that init function would be via the API you provide. The init function takes some monstrously complex string that your API passes into it. Unless the passed string is correct, the dll functions just won't work correctly. Actually, to prevent rumors that your dll doesn't work (because people are trying to hack it), the init function should raise an exception if the string is incorrect.
Neither of these will circumvent a criminal programmer from distributing your API, but it would at least make your intellectual property "copyrighted".
David
|
|
|
|