|
You are correct. After posting my response I weighed revising it, but I'd already shut down my computer.
The problem arises that if you create an object, assign it to the DC and don't delete it, the next time around, you create a new object, assign it to the DC and throw away the return value, you can easily create a resource leak.
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 want to develope some software which must use sdk,exactly the tapi in sdk.i just find find the online setup on microsoft.com,but my net speed is slow,it wouldn't complete!so,is there other place that i can get it??
who can give me some address? thanks very much!
|
|
|
|
|
|
for some reason this call crashes my app on some machines.
When I set a breakpoint at the point where this function is called and attempt to step into it I end up in CEnumArray::XEnumVOID::Skip(ULONG celt) which I cant explane. First line of this function is the COM method prolog macro which causes an access violation.
Can anyone explain why this is happening?
Thanks
Josh
|
|
|
|
|
Hi,
My code in OnInitialUpdate is
sizeTotal.cx = 1000;
sizeTotal.cy = 300;
// TODO: calculate the total size of this view
SetScrollSizes(MM_TEXT,sizeTotal);
Instead of passing the hardcoded values 1000,300 i want them to change them dynamically. eg:
sizeTotal.cx = m_nHeight;
sizeTotal.cy = m_nWidth;
This gives me an assertion error.
How can this be achieved.
Thanks and regards,
Salil.
|
|
|
|
|
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
|
|
|
|