|
I can only remember an assertion error occuring when some thing other than MM_TEXT is passed as the first argument. The following is from a small paint program I wrote:
void CSPaintView::UpdateScrollSizes()
{
CSize sizeTotal = m_Grid.GetDrawSize();
CSize sizePage(sizeTotal.cx >> 1, sizeTotal.cy >> 1);
sizeTotal.cx += sizeTotal.cx >> 1;
sizeTotal.cy += sizeTotal.cy >> 1;
CSize sizeLine(10 * m_Grid.GetMag(), 10 * m_Grid.GetMag());
SetScrollSizes(MM_TEXT, sizeTotal, sizeDefault, sizeLine);
}
This function is called from multiple locations in my view class functions and has always worked fine. Just single step into the SetScrollSizes function and look at the place where the assertion occurs (assuming CScrollView derive class).
INTP
|
|
|
|
|
I don't quite know how to communicate to a USB device. Can anyone help me please.
|
|
|
|
|
Anyone know how to get the creation date of a Directory? I need the information for backing up of files in a process.
For example a week backup, so after a week, the previous backup shall be erased off
Thanx
|
|
|
|
|
One possible solution is GetFileAttributes().
Kuphryn
|
|
|
|
|
This API only tells me if it is a directory or not. what i need is the date the directory is created etc...like File attributes.. is it possible on directory as well?
Thanx
|
|
|
|
|
Try GetFileAttributesEx()
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I import msdxm.ocx in my porject .it can play avi file in xp os.
but not play avi file in windows98 os
why ?
|
|
|
|
|
Hi
Just a question regarding the performance of CreateFile using Handler (APIs) Vs C Runtime function FILE *fp and fopen
Anyone know which is faster in reading and writing text files and whether any of them has limitations or problems in usage in WinCE environment?
Thank you
|
|
|
|
|
Reading/writing text files using asynchronous handlers is complex and problematic and likely to be slower than buffered i/o. fopen() eventually uses CreateFile, etc., and now offers [nonportable] access to many of the parameters of CreateFile. My only suggestion is to wrap the FILE* in a class, or use a simple Ptr<> template.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
A bit Deep for me..
Are you saying that fread, fwrite is asynchronous handling? or is it WriteFile, ReadFile??
Maybe you could quote an example
Thanx
|
|
|
|
|
You stated "CreateFile using Handler" which I interpreted as meaning using asynchronous i/o since CreateFile/ReadFile/WriteFile... is used by fopen/fread/fwrite.... The latter simply buffers the i/o, which for reading and writing strings will give you better performance.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
So u are saying using fread and fwrite is faster in performance as compared to WriteFile, ReadFile??
Sorry, i am evaluating which is better as i more used to fread and fwrite but now i exposed to another APIs WriteFile, ReadFile...The only gd thing about ReadFile is that the Handler obtained from CreateFile can be used for getting File Attributes..
Anyway, thanx for taking the time to answer my doubts
|
|
|
|
|
WriteFile is a low level call. It simply writes data to the disk. (The OS actually does some minor caching, but it's not significant.)
fwrite() writes data to an intermediate buffer (4k by default, I believe) when the buffer fills, the buffer is written to disk using a single call to WriteFile.
The same thing goes for reading data, only in reverse.
So, if you are reading/writing lots of smaller strings, you will get better performance with fread/fwrite unless you implement your own caching algorithm.
Note that you can get the original file handle by calling _fileno() with the proper FILE* and use that to call other functions directly (though doing any call that affects the file pointer (i.e. ReadFile, SetFilePointer, etc.) withough calling fflush first, will totally mess up the stream buffers.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
In a SDI program, when the user clicked the Open File Button and the standard File Open Dialog pops up I want to filter what type of file extensions the user can select.
J Guds
Masters Student
Kansas University
|
|
|
|
|
One solution is to instantiate a CFileDialog object and pass in a custom file-filter string.
Kuphryn
|
|
|
|
|
The following code opens files with .wav extension
Modify it as per ur need.
void CMyProjectView::OnFileOpen()
{
CFileDialog cfd(TRUE,".wav",NULL,OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST,"WAV File(*.wav)|*.wav||",this);
cfd.DoModal();
}
...Avenger
Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs
|
|
|
|
|
Where can I find information on how to program interfaces as one in Windows Media Player 9 or something like that?
|
|
|
|
|
You mean you want to design a skinnable GUI?
Kuphryn
|
|
|
|
|
Confused I am indeed...
I have an application that I'd like to use a dedicated display for some
specialized data/graphics..
I've installed an extra display adapter in the machine, and I can find it
using EnumDisplayDevices() and get an identifier string for the DeviceName,
such as {"\\.\DISPLAY2"} . . . .
However, when I attempt to do a CreateDC for this device, I get back a NULL
unless I have configured the system to include this display device as part
of the desktop, and obviously any attempt to write to it doesn't work...
I'd really like to just use the second display for my application specific
graphics without worrying about someone sliding a window over the top of it
and overwriting it...
Any suggestions as to what I should be doing? - and pointers to appropriate
documentation?
Thanks in advance
Carla
|
|
|
|
|
we've used getlastinputinfo API in vc++ but it is showing the error as undeclared identifier. so please explain in detail how to use it?
by example
|
|
|
|
|
Why start a new thread?
http://www.codeproject.com/script/comments/forums.asp?forumid=1647&select=784607&tid=784607#xx784607xx
Does this search provide any more help?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
|
|
Hi;
I am building an SDI application which requires a list control found on Tabs of a DialogBar. I managed to initialise the list control to some value. However, users of the tool are required to log-in and the list control is supposed to fill dynamically according to their log. I tried some piece of code to get it done but i got an ENORMOUS assertion error.
This is what i get when i move to debug mode:
_AFXCMN_INLINE int CListCtrl::InsertColumn(int nCol, const LVCOLUMN* pColumn)
{ ASSERT(::IsWindow(m_hWnd)); return (int) ::SendMessage(m_hWnd, LVM_INSERTCOLUMN, nCol, (LPARAM)pColumn); }
Can someone please help me to understand what this means and possibly how to overcome it. I badly need this.
Thank you;
Krugger
|
|
|
|
|
It simplely means that the listcontrol was not created.. are you trying to insert something out of the scopeof the listcontrol variable or out of the dialog ???
MSN Messenger.
prakashnadar@msn.com
"If history isn't good, just burn it." - Sidhuism.
|
|
|
|