|
You could manage yourself the drawing of the image when mouse moves if drag&drop occurs in the same application, and after having determinate the image to draw when dragging begins.
One small village of indomitable geeks still holds out against the invaders. And life is not easy for the managers legionaries who garrison the fortified camps of Microsoftum, Javum, Ceplumplum and Vebasum
|
|
|
|
|
Hi.
I want to display YV12 format frames by building a FilterGraph in DirectShow. Those frames are captured from a file. So, I create a source filter inherited from CSource and a output pin inherited from CDynamicOutputPin. Then, I connect this source filter with the Video Renderer filter which is supported by DirectX 8.0 (The CLSID of that filter is CLSID_VideoRenderer).
In DirectX 8.0 SDK, it emphasizes that the Video Renderer, when it is initially connected to the upstream filter, will always insist on a RGB format, so I should let the Video Renderer negotiate a dynamic format change to the appropriate YUV color space after the graph goes into a run state.
But, it only works in the RGB exchange (ex: RGB32 to RGB24). If I attempt to change the output formats into YV12, the return value of the function IPinConnection::DynamicQueryAccept running in CDynamicOutputPin::ChangeMediaType fails. Why??
I think that it could be the argument's problem. Before the output pin of my source filter calls the ChangeMediaType function, we should prepare a CMediaType argument for it. The CMediaType argument is filled with the new media type we want.
The following is my settings of the CMediaType:
majortype = MEDIATYPE_Video;
subtype = MEDIASUBTYPE_YV12;
formattype = FORMAT_VideoInfo;
pbFormat = (BYTE *)pVideoInfo;
cbFormat = sizeof(VIDEOINFOHEADER);
How to setting up the data of VIDEOINFOHEADER will be fine for YV12 type??
And, the format type (FORMAT_VideoInfo) is correct??
Thanks.
Bert Chen
|
|
|
|
|
Hi everyone
I'm developing an application, and in that application i added a dialog on his right, this dialog have a tab control on it. The problem is that i can not see the tabs on the dialog when i add more tabs, only appear the tab control with no tabs.
thanks
|
|
|
|
|
Hi there,
When ever ive used tab control, ive used something similar to the following code:
CTabCtrl m_MainTabCtrl;<br />
TC_ITEM TabCtrlItem;<br />
TabCtrlItem.mask = TCIF_TEXT;<br />
TabCtrlItem.pszText = "Tab1";<br />
m_MainTabCtrl.InsertItem( FILE_RESULTS_VIEW, &TabCtrlItem );<br />
TabCtrlItem.pszText = "Tab2";<br />
m_MainTabCtrl.InsertItem(FILE_SCAN_VIEW , &TabCtrlItem);
This will show the Tabs only, I then insert a CDialog and show and hide the dialog as needed by the tabs. Hope this helps.
|
|
|
|
|
Hi´
Look all the above code i've done it before i post my message, but it just doesn't work. when i try to put a tab in a dialog app it work. An example of my app is the msdn , with a tab in the left.
|
|
|
|
|
All i know is that i created a dialog box, then put a tab control in that. You have to make sure that you create and show the dialog that holds the tab. I don't know what else to say sorry. The only way i can help you further is to see your code.
Dor
|
|
|
|
|
Use the CTabCtrl::InsertItem to create the tabs...
regards
M$
|
|
|
|
|
fwrite, fread and friends are easily many times faster than WriteFile, ReadFile and friends, when doing lots of small reads and writes. this means my program is many times slower than it used to be.
are there any ways to improve the performance of the Win32 I/O operations when doing lots of little reads/writes? (no, rewriting the code that does these reads/writes is not an option (LibTiff, LibPNG, JpegLib, etc).
fyi, here's my open-for-read:
fileHandle = CreateFile(pFileName, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
-c
I'm not the droid you're looking for.
|
|
|
|
|
I'm a bit surprised you are seeing a big difference. Are you opening and closing the file each time? If so that would have a big hit. What about doing a big dummy read to get the entire file cached.
If you *could* rewrite the code then I'd suggest trying memory mapped files.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Neville Franks wrote:
I'm a bit surprised you are seeing a big difference
in some cases, the difference is over 12x. CreateFile etc is essentially unusable, but it has the feature that you can pass a HANDLE out of a DLL, while you can't pass a FILE* out.
Neville Franks wrote:
Are you opening and closing the file each time?
no. it just the fact that i'm lots of little reads/writes (parsing images, etc).
-c
I'm not the droid you're looking for.
|
|
|
|
|
Chris Losinger wrote:
while you can't pass a FILE* out.
why not?
So the DLL code isn't yours and thus can't be changed or it is yours and you don't want to change it because ...
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Neville Franks wrote:
why not?
because the DLL and the EXE will be using different copies of the CRT.
-c
I'm not the droid you're looking for.
|
|
|
|
|
Chris Losinger wrote:
because the DLL and the EXE will be using different copies of the CRT.
So? I assume the DLL opens the file with fopen, the returned FILE* points to memory in the .EXEs heap, in which case it can happilly use it. Or am I missing something fundamental here.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Neville Franks wrote:
Or am I missing something fundamental here
each CRT copy has its own table of file handles, these are not shared between modules. so if you fopen a file in a DLL and get a FILE * of "53", that will probably not correspond to anything meaningful in your EXEs file handle table.
the HANDLE that comes from a CreateFile, however, is maintained by the OS, not the CRT, so you can share that between modules without problems.
-c
I'm not the droid you're looking for.
|
|
|
|
|
I've looked in the VC++ fopen docs and can't see anything about each CRT instance getting it's own table. Looking at the CRT code it uses _malloc_crt() to allocate a stream object.
I don't understand why you would be using the file handle anyway. Surely you just pass the FILE* back to some DLL function to read/write. And if the CRT is in a DLL why is their another "handle table" in the .EXE.
Have you actually proved there is a problem with fopen et.all.?
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Neville Franks wrote:
Have you actually proved there is a problem with fopen et.all.?
yes, a 2 minute DLL project can prove this:
in a DLL:
typedef struct strct_t
{
FILE *fp;
} strct;
void __stdcall OpenAFile(strct * theStruct)
{
theStruct->fp = fopen("c:\\autoexec.bat", "r");
}
in the EXE:
strct s;
OpenAFile(&s);
fclose(s.fp);
it crashes in the fclose.
Neville Franks wrote:
Looking at the CRT code it uses _malloc_crt() to allocate a stream object.
and then it associates one of the entries in the __piob array to the stream. this array is global to the CRT instance (look in crt\src\_file.c).
a quick skip through Google will show dozens of instances of this problem. and the answer is always "use CreateFile" or "link to a shared CRT". unfortunately, the second is not an option for me, either.
the problem is really: how to make ReadFile/WriteFile behave in a manner worthy of being the low-level file operation on a modern OS?
-c
I'm not the droid you're looking for.
|
|
|
|
|
Chris Losinger wrote:
"link to a shared CRT". unfortunately, the second is not an option for me, either.
I missed the shared CRT bit. Guess I lead you down the wrong track. Sorry about that.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Have you tried using the FILE_FLAG_SEQUENTIAL_SCAN flag?
fileHandle = CreateFile(pFileName, GENERIC_READ,
FILE_SHARE_READ, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
|
|
|
|
|
i tried it. but there was no real difference (i stopped it at the 10x point, instead of letting it get to the 12x mark).
-c
I'm not the droid you're looking for.
|
|
|
|
|
I took a one-minute glance through fwrite() and it does its own buffering, thus explaining the speed difference. If you can pre-calculate the amount of data you'll be writing, and that amount isn't huge, put it all into a memory-mapped file. That way you can use the same APIs but everything will be in memory.
--Mike--
If it doesn't move and it should: WD-40. If it moves and it shouldn't: duct tape.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
but i would also have to duplicate the buffering for seek, tell, read, eof, etc.. it'd be far far far too much work (which means more chances for bugs).
too bad.
-c
I'm not the droid you're looking for.
|
|
|
|
|
Chris Losinger wrote:
fwrite, fread and friends are easily many times faster than WriteFile, ReadFile and friends, when doing lots of small reads and writes.
Expected. The Win32 functions need to (among other things) do user->kernel->user mode transitions, which is horribly slow in IA32. The stdio functions perform buffering all in user-mode (no context switch until the buffer is full), and you can even increase the buffer with setvbuf (disregard any Micros~1 documentation lying to you that you can only use 32KB buffers - the buffer can be all the memory you can give it. Probably they haven't bothered to update the documentation from the ~1990 MS-DOS CRT limits).
If you are only given a file HANDLE (from e.g. a DLL) and want faster stdio functions, you should have a look at _open_osfhandle. That should put you on the right track.
|
|
|
|
|
Mike Nordell wrote:
_open_osfhandle
thanks for the tip.
open_osfhandle gives me a low-level, non-buffered, I/O handle. so, that doesn't buy me anything. i can use fdopen on that handle to get a stream I/O handle, but i haven't figured out how to detach the stream handle from the I/O handle when i'm done.
it's a nightmare
-c
I'm not the droid you're looking for.
|
|
|
|
|
I created a NON doc/view MDI application using the MFC ClassWizard (or whatever it's called in .NET) and I don't know where to place the code for some edit fields I want to put in the MDI Child Windows. I put it in the OnCreate() function but it didn't work. Help!
-- Steve
|
|
|
|
|
Is it possible to generate a lib file from a DLL? I downloaded a DLL and it only comes with a def file. I would like to use the DLL the easy by including the lib for the DLL at compile time?
I could recompile the DLL source, but would prefer to use some tool to generate a lib file from the existing DLL
Thanks!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|