|
Well, i'm a beginner and, I want to execute the following piece of code just after OnActivateView. I am not sure about OnDraw(). I tried placing the code in OnDraw() but I got a flickering screen.
CRect myRect;
CSize mySize;
GetClientRect(&myRect);
if (myRect.bottom<=y) //y is the vertical position of my last object
{
myRect.bottom+=200;
MoveWindow(&myRect, TRUE);
mySize=myRect.Size();
SetScrollSizes(MM_TEXT, mySize);
GetParentFrame()->RecalcLayout();
}
What am I doing wrong?
Thanks for your trouble.
|
|
|
|
|
u are flickering i guess cos
MoveWindow( LPCRECT lpRect, BOOL bRepaint = TRUE );
This means that ur sending a WM_PAINT message froom within the OnDraw, try changing it to FALSE
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I tried that, with and without GetParentFrame()->RecalcLayout();
And in none of those ways i got satisfactory results.
I'm doing like :
void CStocks::OnDraw(CDC* /*pDC*/)
{
CRect myRect;
CSize mySize;
GetClientRect(&myRect);
if (myRect.bottom<=m_iLastY)
{
myRect.bottom+=500;
MoveWindow(&myRect, FALSE);
mySize=myRect.Size();
SetScrollSizes(MM_TEXT, mySize);
//GetParentFrame()->RecalcLayout();
}
}
After OnActivateView is finished, i have the final value for m_iLastY, and then iwant to use it to resize, is there an alternative to OnDraw?
Am i doing something wrong?
Thank again
|
|
|
|
|
Check void ResizeParentToFit( BOOL bShrinkOnly = TRUE ); guess it could help u
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Thanks again Papa!
But i don't think i must use OnDraw, i just want to find a way of calling some code after OnActivateView is finished.
Is that possivel?...I even thougth on using timers...
Thanks
|
|
|
|
|
First I dont see a flag or anything telling CFile::Read that its reading binary data, and not text. I read a binary file into a char*a: I need to know, knowing the length of the cFile object thats been opened, what size to make a:
say nSize (from GetLength) is n. Then do I say
a = new char[n+1];
or
a = new char[n];
When I read text data in, I have to put a[n] = 0 ; to null terminate it. DO i do the same in case of a binary file?
Thanks,
ns
|
|
|
|
|
ur binary file already contains NULL chars in it, so why add one??
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
From the SDK: 'FILECORE.CPP'
BOOL CFile::Open(LPCTSTR lpszFileName, UINT nOpenFlags,
CFileException* pException)
{
ASSERT_VALID(this);
ASSERT(AfxIsValidString(lpszFileName));
ASSERT(pException == NULL ||
AfxIsValidAddress(pException, sizeof(CFileException)));
ASSERT((nOpenFlags & typeText) == 0); // text mode not supported
// CFile objects are always binary and CreateFile does not need flag
nOpenFlags &= ~(UINT)typeBinary;
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Okay. That helps a lot.
Thanks,
ns
|
|
|
|
|
Does anyone have any info on the Excel file format? I have large datasets Ineed to output to Excel, but when using ODBC or the CSpreadSheet class (I think this uses ODBC also), my sql statements get too big for a CString... Anyway, is there a better/faster way for Excel IO? Any input is appreciated (as always).
Nitron
_________________________________________--
message sent on 100% recycled electrons.
|
|
|
|
|
Searched CP before posting ?
Excel generator[^]
sometimes it helps to look at the IL generated code
a MS guy on develop.com "answering" .NET issues
|
|
|
|
|
StephaneRodriguez wrote:
Searched CP before posting ?
Um...
Thanks Stephane
Nitron
_________________________________________--
message sent on 100% recycled electrons.
|
|
|
|
|
Have you looked at DTS at all? It can output to Excel without you having to write a bunch of code. You can load DTS packages in your EXE and run them from there, since DTS is really just a collection of COM objects.
If that is too much of a burden, or your data doesn't already exist in some other database for easy export, then take a look at the MSDN sample COMEXCEL. It shows how to use the Excel.Application.8 COM object, which gives you direct access to Excel and all its glory. Okay, maybe not all, but a bunch of stuff. You can create new workbooks, spreadsheets, data ranges, etc. and you can write out all of your data. Just note in this case, you'd need to have Excel installed on the same machine where your code will run.
Ty
"The significant problems we face cannot be solved at the same level of thinking we were at when we created them." -Albert Einstein
|
|
|
|
|
According to MSDN for CString GetPAthNAme() :
If m_ofn.Flags has the OFN_ALLOWMULTISELECT flag set, this string contains a sequence of null-teminated strings, with the first string being the directory path of the file group selected, followed by the names of all files selected by the user.
Now if I assign the result of calling GetPathName(), the CString I assign it to only reads in upto the first null. So how to I get a hold of the complete list of files returned by getPAthNAme()?
CString a = dlg1.GetPAthName(); and its multiselect....
Thanks,
ns
|
|
|
|
|
Use GetStartPosition() and GetNextPathName() to iterate thru the list of names.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Read about:
GetStartPosition and GetNextPathName
hint: u get a position from the first, u put it into the other!
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
You have to use GetStartPosition() and GetNextPathName() to iterate through the list of files.
If a train station is where the train stops, what's a workstation...?
|
|
|
|
|
I got misled by MSDN (my fault)....thanks for pointing me in the right direction...
Thanks,
ns
|
|
|
|
|
i need to show text in my status bar to show a process working and what is happening.
the problem is i have no idle time to update the status bar.
how can i update the status bar without stopping my code?. (or can i?)
|
|
|
|
|
If you have no time to update your status bar, you have a more underlying problem with cpu usage. your app is going to be totally unresponsive. If someone obscures it with another window, and then hides that window, your app is not going to redraw.
This creates a poor user experience and they'll think your app has crashed.
Consider putting your intensive code in a worker thread, and leave the main thread free to pump messages, and update the UI.
Signature space for rent. Apply by email to....
|
|
|
|
|
my program imports or scans images and preforms icr on the image and archives that image to a drive or cd.
i can also do all this in less that 1 sec.
my program does lots in little time. some scan session will scan over 5000 documents without crashes.
all i need to know if a statusbar can be forced to update.
|
|
|
|
|
In short, no, you can't update the status bar. To update the status bar, at the end of the day, involves sending a message to the status bar itself. There will be no cpu timeslice for that to happen if your one and only thread is blocked.
That is the perfect case for a worker thread. If your user was doing a batch of 5,000 documents each taking 1s, he's going to be waiting a long time. you need to give him a cancel button- and you can't handle the click of the button if your main thread is busy doing scanning.
someone else please back me up on this! or point me out if i'm wrong.
Signature space for rent. Apply by email to....
|
|
|
|
|
actually i have 2 threads. one for scanning or importing and the other for icr and saving.
as thread 1 scans the other processes the prev image (if still in the buffer).
i have a window for the scanner that pops up and there is a cancel button. it all works great the scanner will usally have to process the log that is ready to scan before it stops but i do not have any idle time to have the status bar update when ever.
|
|
|
|
|
Cant u do it from the working thread??
(but be sure to synchronize)
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
if ( MFC )
if ( u have a CStatusBar object )
CStatusBar::SetPaneText
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|