I got your program to work with a few minor changes. For some reason this for loop wasnt working properly.
Code:
for( i = PaintBeg; i <= PaintEnd; i++ )
{
x=0;
y=cyChar*(i-iVertPos);
TextOut(hdc,x,y,szBuffer,wsprintf(szBuffer,TEXT("%i. ThisWorks!"),y));
}
I ran this code though my debugger and put i and PaintBeg and PaintEnd it the watch window. Seems when the program runs though the first paint msg, i and PaintBeg both = 0. Which is what they should be, but after the first iteration of the loop, all of a sudden i was = 8564. Now this was bugging me cause there is nothing in your code that is changing the value of i so I rewrote the code like this
Code:
for( i = PaintBeg; i <= PaintEnd; i++ )
{
x=0;
y=cyChar*(i-iVertPos);
wsprintf(szBuffer,TEXT("%i. ThisWorks!"),i)
TextOut(hdc,x,y,szBuffer,lstrlen(szBuffer);
}
That is when I noticed wsprintf() was changing the value of i for some reason. so I did this...
Code:
for (i=iPaintBeg; i<= iPaintEnd; i++)
{
x=0;
y=cyChar*(i-iVertPos);
int q = i;
TextOut(hdc,x,y,szBuffer,
wsprintf(szBuffer,TEXT("i.ThisWorks!"),i));
i = q;
}
and now it works fine. If anyone else can figure out why wsprintf() is changing the value of i, I sure would like to know. But the code works the way it should now.
Hope this helps ya.