|
Hi there,
I have a CScrollView based view window. Whenever the scrollbar is clicked, it seems windows automatically copies a portion of the window towards the appropriate direction, to "help" in scrolling. Then my OnDraw() is done on top.
Anyone know a way to disable this?
Thanks,
swine
[b]yte your digital photos with [ae]phid [p]hotokeeper - www.aephid.com.
|
|
|
|
|
The behavior you are describing is what CScrollView was designed to do.
Why would you want to disable this behavior?
May be the following will help you figure out what the problem is:
When you click the scrollbar in a CSrollView based window it is scrolled automaticaly for you and DC origin is changed to the new possition. You then receive a WM_PAINT message (OnDraw()) to update (draw) the invalid portion of the window.
Before scroll:
origin of DC and Window -> (0,0) +-------------------+
| |
| |
| |
| |
(0, 100) +-------------------+
After scroll:
origin of DC -> (0,-N) +-------------------+
| |
origin of window -> (0, 0) +-------------------+ <- DC (0, N)
| |
| |
DC -> (0, 100) |-------------------|
| Invalid rect. | <- needs redrawing
window -> (0, 100) +-------------------+ <- DC (0, 100 + N)
If you do any drawing to the window outside of OnDraw() then you will need get the origin of the drawing DC so that you know where to draw. I usualy just use the scroll positions:
Origin.x = -GetScrollPos(SB_HORZ);
Origin.y = -GetScrollPos(SB_VERT);
I hope this helps!
INTP
|
|
|
|
|
Thanks John for the in-depth explanation...
...but the data in my view doesn't scroll in the way that CScrollView is implemented, and I need to disable this automatic scrolling.
Any idea how this can be done?
Thanks,
swine
[b]yte your digital photos with [ae]phid [p]hotokeeper - www.aephid.com.
|
|
|
|
|
Below you will find a partial copy of the trace output from the code I am currently
working on. The "|" indicate the depth (scope) of th call, "->" indicate of function call, "<-" indicates a return from the function call, and "=" at the right indicate the value returned by the call or the result of a library function call.
Note: If you have a copy of Jeffrey Richters' Book "Programming Applications of Microsoft
Winodows'" then you might have some understanding of my problem here.
According to the book this should not be causing an EXCEPTION_ACCESS_VIOLATION.
But I would like to note that if I ignore the violation then the next allocation made with new (or malloc()) causes the EXCEPTION_ACCESS_VIOLATION "Attempt to WRITE data at address 00555555" instead of "Attempt to WRITE data at address 00414141". Therefore, I tend to beleive the address may be bogus (Windows internal thing). If I allocate using GlobalAllocate() or LocalAllocate() the the assess violation occurs at the next allocation made with new.
I would also like to point out that this only occurs on the second time the high level funtion (not shown) is called.
Questions:
Has any body seen this behavior before?
Has any body any idea what could be causing this to happen.
| |->CExBitmap::CExBitmap()
| |<- CExBitmap::CExBitmap()
| | CreateCompatibleBitmap(dcDest, 220, 240) = TRUE
| |-> CDibData::CDibData()
| |<- CDibData::CDibData()
| |-> CreateDIB(pBitmap, FALSE)
| | |-> CreateBitmapInfo(pBitmap, 0012EFFC)
| | |<- CreateBitmapInfo() = 020F0198
| | | new BYTE[53864] : EXCEPTION_ACCESS_VIOLATION
| | | ExceptionCode = 0xC0000005
| | | ExceptionFlags = 0x00000000
| | | ExceptionAddress = 0x77F596CF
| | | NumberParameters = 0x00000002
| | | ExceptionInformation[0] = 0x00000001
| | | ExceptionInformation[1] = 0x00414141
| | | Attempt to WRITE data at address 00414141
| | | BaseAddress = 00414000
| | | AllocationBase = 00400000
| | | AllocationProtect = PAGE_EXECUTE_WRITECOPY
First-chance exception in SPaint.exe (NTDLL.DLL): 0xC0000005: Access Violation.
First-chance exception in SPaint.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
| | | "There is nothing you can do to this region to raise an
| | | access violation. Attempt to write to memory in this
| | | page cause the system to give the process its own
| | | private copy of the page (backed by the paging file)."
| | | RegionSize = 188416
| | | State = MEM_COMMIT
| | | Protect = 32
| | | Type = MEM_IMAGE
INTP
|
|
|
|
|
hi.... could anyone tell me links/place to find tutorial that explain how to build opengl application in SDI/MDI (single/multiple document interface)
thanks...
|
|
|
|
|
try MSDN though i don't think they'll have alot of info on it.
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
LOL hell ya go to http://www.msdn.microsoft.com/library/default.asp[^] and then you see the tree control?, go to graphics and multimedia and expand that then find Open GL. OMG I didn't know microsoft had this much ... stuff ... about Open GL!!!!! ;)
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
Yes I want to go back but there is a reason. I need a website dedicated to old c++
not like alot of other things can anyone suggest any websites?
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
What do you need to know ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I need to know how to use c++ file i/o very well especially the file input to the program.
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
Then read my articles on iostreams and ask any questions you like.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
how would i be able to open a file and see what the first variable or character is and if so then do this otherwise do that??
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
A char is one character, so read in a char.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
lol I guess you have something like msn messenger cause you reply so fast. back again, though, im totally new to file reading and would like to maybe get some more help, sry, maybe an example or how to do it?
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
*sigh& Thats why I said to read my articles.....
#include <iostream>
#include <fstream>
using std:ifstream
ifstream myStream("c:\\stream.txt");
char c;
myStream >> c;
if (c == ' ')
std::cout << "You typed a space";
else
std::cout << "You didn't type a space, sucka";
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
ill email you back because i think i need to do this in a different way but thanks for your time.;P;);P;);P;);P;);P;);P;);P;)
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
*sigh& Thats why I said to read my articles.....
#include <iostream>
#include <fstream>
using std:ifstream
ifstream myStream("c:\\stream.txt");
char c;
myStream >> c;
if (c == ' ')
std::cout << "You typed a space";
else
std::cout << "You didn't type a space, sucka";
Christian
lol!
todo....
:: insert inspirational text here ::
|
|
|
|
|
DAMN!
#include <string>
using namespace std;
#include <windows.h>
#include "ou_thread.h"
using namespace openutils;
I'm using the ou_thread class, or trying to and I keep getting the error that there is an unexpected end of file while looking for a precompiled header directive. Bah..
|
|
|
|
|
If you're using precompiled headers, every file has to begin with:
#include "stdafx.h"
That assumes you didn't change your precompiled header file in your project options. If you don't want precompiled headers, disable that in your project.
Also, why do you have #include lines with no file after them?
|
|
|
|
|
Note that you can disable precompiled header use on an individual file basis.
Joel
VssConnect - Remote SourceSafe(r) Access http://www.voxcode.com[^]
|
|
|
|
|
Kentamanos wrote:
Also, why do you have #include lines with no file after them?
The CP parser strips them out thinking they are HTML because they start with the <
|
|
|
|
|
#include <string> is there, it's just not being displayed!
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
using namespace std AND namespace openutils is asking for trouble. Can you guarentee that neither of these namespaces will be extended to include something already named in the other ?
You should only #include the bits of a namespace that you are using.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I changed the settings in my project. Blarg. Let's see what other roadblocks I can encounter. This project is due tomorrow by midnight and I am SO TOAST on it.
Thanks dudes!
|
|
|
|
|
This racing game, the worst racing games I have ever played. If you want to make a racing game you should make it good. I meen come on, you blow up when you barely touch the edge of the track. You must be thinking like this guy.
KAI_YPO/PUNA
|
|
|
|