|
I am sorry, I did not realise, WM_ENTRIDLE does not work in CDialog, and you cannot use. Instead of that, you can use WM_KICKIDLE:
1. Include #include <afxpriv.h> to your dialog cpp file.
2. add ON_MESSAGE(WM_KICKIDLE, OnKickIdle) to your message map
3. add function LRESULT OnKickIdle(WPARAM, LPARAM lCount); to your dialog.
It will work in the same way as WM_ENTRIDLE.
Martin
|
|
|
|
|
PostMessage(WM_USER+1) from OnInitDialog()
Now in the handler for WM_USER+1, you can do your stuff.
You'll have to add the message macros manually.
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
I Need to get the file size of a file,
Anyone ho now???
\GoLa
|
|
|
|
|
|
Thanks but I need to use FindNextFile do you now how???
\GoLa
|
|
|
|
|
Like this?
int Size;
CFileFind finder;
CString FileType("*.TYP");
while (BOOL Found = finder.FindFile(FileType)) {
Found = finder.FindNextFile();
if (Found) Size = finder.GetLength();
}
>>>-----> MikeO
|
|
|
|
|
Is better in that mode:
int Size;
CFileFind finder;
CString FileType("*.TYP");
finder.FindFile(FileType)
while(Found)
{
Found = finder.FindNextFile();
Size = finder.GetLength();
}
Olways when you need to know any propiertie of a file that you found, you need to do FindNextFind
Best Regrds
Carlos Antollini.
www.wanakostudios.com
Sonork ID 100.10529 cantollini
|
|
|
|
|
Carlos Antollini wrote:
int Size;
CFileFind finder;
CString FileType("*.TYP");
finder.FindFile(FileType)
while(Found)
{
Found = finder.FindNextFile();
Size = finder.GetLength();
}
Hi Carlos,
Looking things over I think we both left some issues dangling. Let me try one more time:
BOOL Found;
CFileFind finder;
CString FileType("*.TYP");
Found = finder.FindFile(FileType)
while(Found)
{
Found = finder.FindNextFile();
Size = finder.GetLength();
}
When Found changes to false is finder still valid? I can never remember exactly how that works.
>>>-----> MikeO
|
|
|
|
|
Mike Osbahr wrote:
When Found changes to false is finder still valid? I can never remember exactly how that works.
Yes is true...
When you need to ask about any property of the file that you found, like name, size, extension, attributes, you before must to do FindNextFile. You dont must worry about the result of FindNextFile...
For example in the MSDN read the Remarks section of CFileFind::GetFilePath,
Regards
Carlos Antollini.
www.wanakostudios.com
Sonork ID 100.10529 cantollini
|
|
|
|
|
from http://www.codeproject.com/file/sadirread.asp
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
if ((hFind = FindFirstFile(fullPath, &FindFileData))!=INVALID_HANDLE_VALUE)
{
if ((FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)!=FILE_ATTRIBUTE_DIRECTORY)
{
size = ((unsigned __int64)FindFileData.nFileSizeHigh * ((unsigned __int64)MAXDWORD+1)) + (unsigned __int64)FindFileData.nFileSizeLow;
}
}
and, of course the FindNextFile loop comes right below this.
-c
Cheap oil. It's worth it!
|
|
|
|
|
Is the Following better?
int nSize;
CFileFind finder;
CString FileType("*.TYP");
finder.FindFile(FileType)
while(Found)
{
Found = finder.FindNextFile();
if(finder.IsDots() || finder.IsDirectory())
continue;
nSize = finder.GetLength();
}
Cheers
Carlos Antollini.
www.wanakostudios.com
Sonork ID 100.10529 cantollini
|
|
|
|
|
not if the original poster wants to use FindNextFile, not CFileFinder.
-c
Cheap oil. It's worth it!
|
|
|
|
|
Chris.
Yes is true...
The original message doesn't specify if he wants to use CFindFile::FindNextFile or ::FindNextFile...
You have the true, I don't why but always I think in MFC...
Regards....
Carlos Antollini.
www.wanakostudios.com
Sonork ID 100.10529 cantollini
|
|
|
|
|
and i always think in standard C. i originally did this with _findfirst, _findnext. i didn't even know there was a CFindFile class.
-c
Cheap oil. It's worth it!
|
|
|
|
|
Hi all ,
outside of OnPaint()I call in other function CDc* pDc = GetDc().
Sometimes its returns NULL.
Why?????????
Aizik Yair
Software Engineer
|
|
|
|
|
I found the reason.
I need call ReleaseDc() each time i use GetDC()
Aizik Yair
Software Engineer
|
|
|
|
|
I have changed some the default menu settings in my app, but now the Exit button does not work. I did remap it but thats because I wanted to do some cleaning up before it exited.
I thought the default behaviour was to map to WinApp::ExitInstance but that doesn't work.
does anyone know the default Exit function which VisC++ automatically maps the Exit button to.
cheers
Asim.
.........
I'd rather be rich than stupid.
|
|
|
|
|
The default exit process is triggered by sending WM_CLOSE to the main frame window (this is what CWinApp:OnExitApp does.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
AfxGetMainWnd()->PostMessage(WM_CLOSE);
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Hi All
As a newbie in C++, particularly in MFC, i'm strggling about how to pass the 2 dimensional array as parameter by reference and manipulate it through a void method. I want to pass a 4x4 two dimensional array to a method which the implementation looks like this:
void Group::GetResults(int& res[4][4])
{
for(int i = 0 ; i < 4; i++)
{
res[i][i] = result[i][i];
}
}
as you can see i want to change the values of the 2 dimensional array passed in to a local 2 dimensional array in the local class which is the result
And this is how i use it in the view class:
int tempArray[4][4]
GetResult(tempArray)
thanks for reading this.
Regard
|
|
|
|
|
You can pass int** like this
void Group::GetResults (int** a, int n )
{
for (int i = 0; i < n; i++)
{
res[i][i] = result[i][i];
}
}
and then use it like this:
int a[4][4];
GetResult (a);
Best regards,
Alexandru Savescu
|
|
|
|
|
hi alex
i did the way that u guided me but this is the error that i got
E:\Documents and Settings\Administrator\My Documents\ST2\Assignment3\ass3_q1\ass3_q1View.cpp(319) : error C2664: 'GetResults' : cannot convert parameter 1 from 'int (*)[4][4]' to 'int ** '
any idea??
Cheers
|
|
|
|
|
It compiles fine on my computer, send me a sample and I'll tell you what is wrong.
Best regards,
Alexandru Savescu
|
|
|
|
|
Actually it doesn't
Take Joaquin advice!
Best regards,
Alexandru Savescu
|
|
|
|
|
void Group::GetResults(int res[][4])
{
...
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|