|
Your error will be heavily dependent on the fine detail of your application.
But you need to handle the WM_SIZE message to change the details of your scroll bars.
Have a look at the SCROLLINFO structure, and also the nPage member.
Then you'll want to call GetScrollInfo in your painting routine, so you know to offset your painting by a certain amount.
If you *can* use CScrollView, it does all this work for you. And set's up the DC you draw on to with SetViewportOrg etc so it's invisible for you.
I don't use it, and I do all this scroll bar myself - and there's quite a few things to trip you up.
Reading your message again... I'm not sure where this CEdit is coming in. Maybe you should be using a CFormView, put your controls on a dialog, and letting MFC do all this work instead?
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
Iain,
Thanks for the response. I have a field of type CEdit defined in the main window class of the application. I will definitely take a look at the class CFormView.
Is there a reason why I might not be able use CScrollView?
Thanks
Bob
|
|
|
|
|
/* IM TRYING TO WRITE IT SO THAT I CAN SEE EACH LETTER AS IT IS BEING WRITTEN BY THE COMPUTER*/
/* Thanks in advance*/
#include <stdio.h>
main()
{
printf("\n\nH");
sleep(2);
printf("e");
sleep(2);
printf("y");
sleep(2);
return 0;
}
/* Im trying to run it one letter at a time*/
modified on Monday, March 9, 2009 8:30 PM
|
|
|
|
|
I think this is what you want:
#include <stdio.h><br />
main()<br />
{<br />
printf("\n\nH");<br />
printf("e"); ;<br />
printf("y");<br />
<br />
printf( "\n" );<br />
return 0;<br />
}
Bob
|
|
|
|
|
Yes thats good but i want two second delay between each letter written, and going horizontally
|
|
|
|
|
Now, if our goal is to write this in portable C, then there is no way to write the sleep function. However, if you use Windows Specific functions, then I believe you can do it. Here is how:
#include <windows.h><br />
<br />
#include <stdio.h><br />
<br />
main()<br />
{<br />
printf("\n\nH");<br />
Sleep( 2000 );<br />
printf("e");<br />
Sleep( 2000 );<br />
printf("y");<br />
<br />
printf( "\n" );<br />
return 0;<br />
}
The argument to Sleep is the time in milliseconds. I hope this helps. Feel free to ask a follow up question.
Bob
|
|
|
|
|
Assuming you want a 2ms delay (which is not discernable by the human eye) in between each letter, what you have is fine.
"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
|
|
|
|
|
Hello,
I need to translate some header file for function calls from Basic to C++ .... I am clueless when it comes to VBasic syntax...could someone provide me with some help on something like the following:
Declare Function Draw Lib "PDF_In_The_Box.dll" (ByVal hBox As Long, ByVal aX As Long, ByVal aY As Long, ByVal hBitmap As Long) As Long
Sub CallBox(ByVal aFunctionCall As Long)
Dim Msg As String * 255
Dim n As Long
If aFunctionCall = -1 Then
n = GetErrorMsg(Msg)
MsgBox Msg, 16, "PDF In-The-Box"
Stop
End If
End Sub
Function GetStr(ByVal aBoxHandle As Long, ByVal aPropID As Long) As String
Dim Result As String * 255
CallBox GetStrProp(aBoxHandle, aPropID, Result)
GetStr = Result
End Function
sft
|
|
|
|
|
For a start, the Draw function should come with a header file. If it doesn't, then load "PDF_In_The_Box.dll" using LoadLibrary(), use GetProcAddress() to get the address of the Draw() function, and call the function pointer (I think you may need to do an explicit cast here)
As for the rest:
String * 255 is a pointer to a fixed length char array of length 255 (I think it's a pointer, not sure here)
MsgBox just shows a box, it's easily ignorable
Long seems to be either a 32 or 64 bit integer - use int or long here
Stop is just a break statement
So overall the code looks a little like this
void CallBox(int aFunctionCall)
{
char[255] *msg;
if(aFunctionCall == -1)
{
GetErrorMessage(msg);
break;
}
}
char[255] *GetStr(long aBoxHandle, long aPropId)
{
char[255] *result;
CallBox(GetStrProp(aBoxHandle, aPropId, result));
return result;
}
|
|
|
|
|
Good starting point.
Thanks
sft
|
|
|
|
|
Hello all,
After installing the Visual C++ Express Edition, I've noticed that the Win32 Application Wizard does not allow you to create a DLL as the Application Type. Is there any way around this?
Thanks
|
|
|
|
|
Just so anyone doesn't think I've posted a Yes or No question: How can I get around this?
|
|
|
|
|
http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvc/thread/6d37e2d1-7491-450f-a341-a81e7892dce1/
Found it!
|
|
|
|
|
Glad you've found the solution. My answer was going to be "spend money"!
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
I would be very grateful for any constructive comments to the snippet of code below:
time_t lTime
struct tm *tm
time(&lTime)
tm = localtime(&lTime)
It is found that tm->tm_hour agrees with my PC time except between the following dates when it is 1 hour behind:
8 Mar, 2009 2:00 am
15 Mar, 2009 2:00 am
I believe the issue is in TZSET.c and only manifests itself when the day of the 1st of the month of DST is a Sunday (like 2009).
I am using VS6 and have applied KB932509 with no results
Thanks
Peter
|
|
|
|
|
Member 3848094 wrote: KB932509
I can't get this on MS site? what is the KB about.
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Sorry, my mistake
KB932590
Thanks
|
|
|
|
|
well, did you check your file version against what is listed on that KB?
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Yes.
Do you believe that this download should have fixed the issue?
|
|
|
|
|
I don't know. What else do you think it would do then?
Another thing you can check is, run dependency walker (or whatever it is called) and check the dll version you application using. I doubt this will turn anything, but you got nothing to loose.
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Hello Peter
I am supporting some VC 6.0 code with localtime and am facing similiar results. I downloaded MSVCRT.DLL version 7.0.2600.3085 and it did not fix the problem.
Setting my time a week ahead fixes the problem.
Even stranger on several of my colleagues systems some VC6.0 applications work correctly and some don't (all call a shared DLL used internally calling localtime).
Very annoying but not a major issue for us as the application is currently only being used interanlly and we can live a week with it.
First Sunday of the month of DST sounds like an old problem resurfacing:
http://seclists.org/bugtraq/2001/Mar/0475.html
Good Luck
Don
|
|
|
|
|
Hi,
I'm looking for some inbuilt function that can provide me to get the Root Directory and the path of the Virtual directory - "Default Web site properties" contents. I have to fetch the Home Directory - Local Path.
Does ISAPI filter provide any help?
Regards,
Mayur M
|
|
|
|
|
what the each and every function in the code below is doing?
I need crystal clear answer for this.
POSITION pos=GetFirstDocTemplatePosition();
if(pos!=NULL)
{
CSingleDocTemplate * pSingeDocTemplate;
pSingeDocTemplate= (CSingleDocTemplate *)GetNextDocTemplate(pos);
pSingeDocTemplate->GetFirstDocPosition();
CDocViewCommunicationDoc *pDoc=(CDocViewCommunicationDoc *)pSingeDocTemplate->GetNextDoc(pos);
AfxMessageBox (pDoc->m_strDoc);
|
|
|
|
|
sarathbabununna wrote: POSITION pos=GetFirstDocTemplatePosition();
See here.
"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
|
|
|
|
|
In addition to David's reply (which is good - read the documentation for the functions!), you should also look at the documentation page for CDocTemplate.
Your application could handle different kinds of document - for example .bmp, and .jpg. So each document type would have its own CDocument (ie, CMyJpgDocument), and its own CView class (ie, CMyBmpView). This information is called a template, and stored in a CMultiDocTemplate, or CSingleDocTemplate. Each of these is stored in the App object.
So your code is going through all templates, then iterating through all documents created from each template.
You have missed off a few brackets I think!
Try single stepping through the code, and reading the document pages for more information. It is all there.
Iain.
ps, I've never created an app with more than one kind of template, but the possibility exists!
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|