|
If I have an CScrollView with few lines , rectangles and other , can I move scrollbar with mouse due the mouse is within client area ? Something like acrobat reader sheets , when the mouse cursor is hand , on OnLButtonDown mouse pointer change to 'MoveHand' cursor and OnMouseMove move scrollbars ?
|
|
|
|
|
Yes, you could, but you have to write all the required code: provide an "hand" mode and change the cursor when that mode is active, then handle the WM_LBUTTONDOWN , WM_MOUSEMOVE and WM_LBUTTONUP to do it.
Basically, in the WM_LBUTTONDOWN message handler you have to set a flag that mean dragging and save the cursor location and the scrollbars position; in the WM_LBUTTONUP you have to reset the dragging flag. Finally, in the WM_MOUSEMOVE you have to test the dragging flag, and if it is set, set the scrollbars position to obtain a shift of your view that correspond to one that the mouse has been moved.
|
|
|
|
|
Thank you Viti . I develop this [^] project , that have implement all things that you said ... but I don't know how effectively move scrollbars considering mouse position on client area ... do you know some sample code ?
|
|
|
|
|
Try this article[^] from Microsoft, and refer to the IntelliMouse panning implementation.
|
|
|
|
|
Thanks again Viti , is not like what I want but from this sample I learn very much !!!!
|
|
|
|
|
I did it :
void CDragSheetView::OnLButtonDown(UINT nFlags, CPoint point)
{
m_point = point;
m_bMouseCapture = TRUE;
SetCursor(AfxGetApp()->LoadCursor(IDC_CURSOR_HANDMOVE));
SetCapture();
CScrollView::OnLButtonDown(nFlags, point);
}
void CDragSheetView::OnMouseMove(UINT nFlags, CPoint point)
{
if(m_bMouseCapture)
{
CPoint ptScroll = GetScrollPosition();
if(m_point.x < point.x)ptScroll.x -= (point.x - m_point.x);
if(m_point.x > point.x)ptScroll.x += (m_point.x - point.x);
if(m_point.y < point.y)ptScroll.y -= (point.y - m_point.y);
if(m_point.y > point.y)ptScroll.y += (m_point.y - point.y);
ScrollToPosition(ptScroll);
m_point = point;
}
CScrollView::OnMouseMove(nFlags, point);
}
|
|
|
|
|
I am trying to migrate our application to VS 2010, but ran into a roadblock concerning CodeJock's TookitPro libraries:
it appears the newest purchasable versions do not work with VS 2010! I've downloaded the trial from the newest build which does support 2010, but I found the trial libs/dlls have been compiled with compiler options that are incompatible with our application. Thus I would need to change the ToolkitPro project settings and manually rebuild it.
Only - there are no ToolkitPro project files!?
I contacted CodeJock Support, tried the forums, and the phone, but no responses in 3 days time - for all I know the company might not exist anymore.
Since CodeJock can not or will not help, is anyone here who has an idea what to do, i. e. how to get or maybe even create a project file that I could adapt to compatible settings and create a lib/dll that work with our application?
|
|
|
|
|
What version of Codejock ToolKitPro are you running?
We had issues with 9.7 (yeah I know its as old as the hills) under VS2010 as it docking windows wouldn't work as there has been a change in MFC.
To make it work you can change the VC toolkit your project is compiled against (this is found in the C++ section of your project), however this will mean it builds as a VS2008 project in real terms...
Alternatively take a look at this post I got back from the forum that will help (and it took over 6 months to get this reply)...
Forum Post[^]
|
|
|
|
|
Thank you for your suggestions.
Regarding version I am not sure where to look that up. The lib is named ToolkitPro1113vc71U.lib, so maybe it's version 11.13 (?), compiled with VC 7.1 (VS 2003.NET). The 'U' indicates unicode character coding. The header files are dated from march 2007 and contain a 2007 copyright notice, but I didn't spot a version number there.
The trial version is ToolkitProEval1341vc100UD.lib, so that would mean version 13.41 ?
Our VS 2010 application does use the newer version (I deleted the libs and dlls of the older version to make sure it does) and it does compile, but not link.
What I need is a version that works with VS 2010 and is compiled with /Zc:wchar_t- . The trial version is compiled with /Zc:wchar_t+ .
|
|
|
|
|
We did play around with 13.xx trail versions back in January and haven't gotten any further than you and management have deemed it unimportant for the time being, we also found Codejock somewhat unhelpful when asking for assistance.
However the earlier versions do work and if you apply the fix suggested at the bottom of the forum post I included and you'll have the same functionality as you had previously.
Obviously if you have a need for more advance functionality then I'm affraid I can't help further...
|
|
|
|
|
Thanks, I might give it a try. Unfortunately this may not be a good solution though, since our main reason for switching to VS 2010 is taking advantage of the various parallel programming libraries, and I'm not at all sure which of these are being supported with VC9
|
|
|
|
|
If you use the solution in the last post from this[^] you don't have to use the VC9 toolset. The fix addresses the non-docking issue that has crept in since MS updated MFC in vs2010.
So you'll still have the parallel bits you need and still use Codejock......
|
|
|
|
|
1. our current version does not compile
2. the trial version does not link
As long as I cannot resolve 1. or 2. any issues relating to whether or not controls function properly are moot.
Until then, thanks for trying to help, maybe I will be able to take advantage of your advice later.
|
|
|
|
|
When stopped in the debugger (Visual C++ 2005, native Win32/MFC code), you can mouse over variables and the debugger shows a nice tooltip. For some classes it also shows the member variables and values in that tooltip. For our MFC CObject-derived classes, all we get is the class name; it refuses to show the variables. We can use the + button to expand it and see the variables, but it would be nice to get them right in the tooltip.
Any idea what controls this?
===
For example:
class BaseClass
{
protected:
double i;
double j;
double k;
public:
BaseClass() { i = j = k = 0.57722; }
virtual ~BaseClass() {}
};
class MyClass : public BaseClass
{
protected:
double x;
double y;
double z;
public:
MyClass() { x = y = z = 3.14159; }
virtual ~MyClass() {}
};
void SomeFunction()
{
MyClass someVar;
int x = 0;
}
For the above example, when you're stopped in the debugger and you mouse-over someVar, you can see the below in the tool-tip.
someVar = {x=3.1415899999999999 y=3.1415899999999999 z=3.1415899999999999 }
Now, if you modify the code slightly by deriving from CObject, it seems to break this. If you change it to the below:
class MyClass : public CObject
{
protected:
double x;
double y;
double z;
public:
MyClass() { x = y = z = 3.14159; }
virtual ~MyClass() {}
};
void SomeFunction()
{
MyClass someVar;
int x = 0;
}
Now when you stop in the debugger and mouse-over someVar, you instead see the below.
someVar = {MyClass}
So for some reason, when deriving from CObject, we've now lost the mouse-over tooltip info!
Does anyone know what's going on? How can we get that back?
|
|
|
|
|
I found a solution to this. I discovered the name of the feature described is the DataTip. Once I had this a modified google search yielded the below article.
http://www.zanshu.com/ebook/149_debugging_applications/html/ch05d.htm
The summary is that there's a config file in the VC++ install directory which controls the auto-expansion in the DataTip.
For Visual C++ 2005, the file is at the below path.
C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\Packages\Debugger\autoexp.dat
The comments in the file explain how to add your own types. For the above example, I added the below line and it then worked.
MyClass =x=<x> y=<y> z=<z>
So its a matter of customizing this file with your types and then keeping track of the customizations for new machines or re-installs of VS.
I'm still not sure why it does it automatically when you don't derive from CObject but fails when you derive from CObject. One guess is that the base class adds in too many variables? The problem with that guess is that in my example I included a base class with variables (i,j,k) and those didn't show up in the tip, so I don't understand why the base class matters.
|
|
|
|
|
Got a good tip from the MSDN forums on this.
Just comment out the below line in that file (insert a ; at the beginning of the line, or just delete the line).
CObject =<,t>
If you do this, it immediately shows the vars for your CObject-derived classes.
|
|
|
|
|
Thanks for sharing your solution with us.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
hi all, i've aproblem with this function, i hope you don't minde to help me
CreateFileA(m_pstrAllUsersPath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 128, NULL);
the m_pstrAllUsersPath value is "C:\Documents and Settings\All Users\Application Data\Avg9\update\download\avginfoavi.ctf".
It always return INVALID_HANDLE_VALUE although this file exist.
regards
|
|
|
|
|
Have you the rights required to open that file?
|
|
|
|
|
You should properly escape the path string, use:
"C:\\Documents and Settings\\All Users\\Application Data\\Avg9\\update\\download\\avginfoavi.ctf"
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]
|
|
|
|
|
The file you are trying to open might be held by some other process with "no share" attribute. Or you might be passing a wrong file name. I suspect the first case.
|
|
|
|
|
When in trouble, read the manual. Better yet, read it before you get into trouble.
If the function fails, the return value is INVALID_HANDLE_VALUE. To get extended error information, call GetLastError.
There is no need for guessing, just call GetLastError() and you will know what gives.
|
|
|
|
|
Hello,
I have a dialog box that contains an ownerdraw listbox with imaghes and text I give the option to resizes the dialog box(by SetWindowPos),
such that not all of the listbox is appear ,
I changhed the vertical and the horizontal scrollbar properties to be true and they are appearing on dialog but I can't scroll them although the list box is not appear completely,
how can I cause the scroll bar to work appropriate ?
thanks
|
|
|
|
|
I just had what might be a similar problem, though it was just the horizontal scrollbar giving me trouble. I had to call SetHorizontalExtent, giving it the widest thing in the list in pixels.
Try calling that and see if it helps at least with the horizontal scrollbar.
|
|
|
|
|
Hi all,
please could i get some help on how to restrict writing to USB.
This is a complicated requirement i have, however this is what i need to achieve.
i need to restrict writing to USB. however writing can be done specifically to a folder and that too a specific file type.
i can use registry to block writing to USB, however this does not suit to the requirement.
hence i need some help on how to block writing to USB and allow only specific files to be written to one specific folder.
ThankYou.
|
|
|
|