|
Google for N-ary or M-ary tries.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
hi, everyone, I am wondering that how can Macromedia FlashPlayer draw more
than 300thousands lines, polygons and texts so fast? At first I thought that
it uses cached map that are generated when the swf file be opened. but I
check the disk space and find out that it only occupies 4MB disk space for
cache. If it draws all visible shapes in real time, the question comes , how
can it do that so quickly? does anybody has any ideas on this question??
|
|
|
|
|
Can any one help me how to add tooltips for combo boxes in vc++
thanx
|
|
|
|
|
LOOK HERE ,YOU'LL FIND THE ANSWER!
http://www.codeproject.com/miscctrl/pptooltip/cpptooltip_src.zip
http://www.codeproject.com/miscctrl/pptooltip/cpptooltip_demo.zip
|
|
|
|
|
i'm doing a install for my program,but don't know it need some other files.how to find all the files (such as .dll) that the program depending on?Thanks !
|
|
|
|
|
Are you trying to create your own installer? There are available installer creaters that can do the job for you!
If you want to find out depending dlls, you can check this using depends tool
ARSALAN MALIK
|
|
|
|
|
thanks Arsalan ,
i am too looking out for Depends tool.
thanks Again
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
This issue is really a serious Issue ..
I have made simple Dialog based application which contains a web Browser Control .. Every thing is working fine, navigation , downloading pages is just kool .. now I want to fill the Form the fields with the help of this code
void CMyDlg::OnDocumentComplete(LPDISPATCH pDisp, VARIANT FAR* URL)
{
// TODO: Add your control notification handler code here
// Fill the Input field and Submit the Form
LPDISPATCH lpDispatch =NULL;
HRESULT hr;
lpDispatch = m_WebBrowser.GetDocument();
hr = lpDispatch->QueryInterface(IID_IHTMLDocument2,(LPVOID*)&m_pHTMLDocument2);
lpDispatch->Release();
lpDispatch = NULL;
int Index[5];
Name.Add(_T("INPARAM1"));
Value.Add(_T("4321"));
Name.Add(_T("INPARAM2"));
Value.Add(_T("4321"));
Name.Add(_T("INPARAM3"));
Value.Add(_T("4321"));
Index[0] = 2 ;
Index[1] = 3 ;
Index[2] = 4 ;
AddData(Index,&Name,&Value);
}
} Every thing is fine , but there is performance issue as I starts filling the Form Fields with the help of this Interfce it takes almost 85% of memory usage .. and it is not good any Solutions to this .. I would be very grate ful to you guys .. Thanx
Why Only this opertaion Takes so much of the CPU time ... ?
- Nabil
|
|
|
|
|
Hi,
Think you are having a memory problem. Release the memory allocated 4 variants by using VariantClear
This may help you
Sujan
|
|
|
|
|
I am writing a "C" application (not C++, not MFC) running on Win98SE which captures audio from line-in into a wrap-around ring of 40mSec buffers. When the user stops capture, the last audio which was captured is combined with PAL video frames (25Hz) from a frame grabber into an AVI file.
The capture works fine with a small numbers of buffers (125 buffers for 5 seconds), but when I try 1 minute (1500 buffers), the program gets to about buffer 300 during the waveInPrepareHeader() stage, which then returns an error value of 7 (MMSYSERR_NOMEM, explained in the mmsystem.h file as "memory allocation error".) About this time, Win98 becomes unstable! Once, Windows gave the error "System is dangerously low on resources . . .".
I ran resource meter, and when MMSYSERR_NOMEM is reported by my program, resource meter reports 92% system resources, 92% user resources, 95% GDI resources. System monitor reports 550 Meg of free physical memory.
Does anyone know what waveInPrepareHeader() is actually doing, what the system is running out of, and how I can fix it?
I can work around the problem by grabbing the audio in half-second chunks instead, but that complicates the code.
The test program runs fine on Windows XP, so I could also try to migrate to XP, but I want to understand what is happening!
Any ideas?
Here is a console application which demonstrates the problem (on my PC, it fails at header 301 or so)
<br />
#include "stdafx.h"<br />
#include <windows.h><br />
#include <vfw.h><br />
#include <mmsystem.h><br />
<br />
#define DEF_BlocksPerSecond 25<br />
#define DEF_NumAudioBlocks 1500<br />
<br />
int main(int argc, char* argv[])<br />
{<br />
unsigned int uiNumWaveInDevices;<br />
unsigned int uiCounter;<br />
unsigned int uiReturn;<br />
char szTempString[100];<br />
WAVEINCAPS WaveInCaps;<br />
BOOL bSoundModeValid;<br />
HWAVEIN hWaveInDevice;<br />
WAVEFORMATEX WaveFormat;<br />
unsigned int uiAudioBufferNumBytes;<br />
<br />
WAVEHDR WaveHeaders[DEF_NumAudioBlocks];<br />
<br />
uiAudioBufferNumBytes = 11025 * 2 / DEF_BlocksPerSecond;<br />
<br />
uiNumWaveInDevices = waveInGetNumDevs();<br />
<br />
for (uiCounter=0; uiCounter < uiNumWaveInDevices; uiCounter++)<br />
{<br />
waveInGetDevCaps(uiCounter, &WaveInCaps, sizeof(WaveInCaps));<br />
bSoundModeValid = WaveInCaps.dwFormats & WAVE_FORMAT_1M16;<br />
if (bSoundModeValid)<br />
break;
}<br />
<br />
if (!bSoundModeValid)<br />
return(1);
<br />
WaveFormat.wFormatTag = WAVE_FORMAT_PCM;<br />
WaveFormat.nChannels = 1;
WaveFormat.nSamplesPerSec = 11025;
WaveFormat.nBlockAlign = 2;
WaveFormat.wBitsPerSample = 16;
WaveFormat.nAvgBytesPerSec = 11025 * 2;
WaveFormat.cbSize = 0;
<br />
hWaveInDevice = NULL;<br />
<br />
uiReturn = waveInOpen(&hWaveInDevice,uiCounter-1,&WaveFormat,0,0,CALLBACK_NULL);<br />
if (uiReturn != MMSYSERR_NOERROR)<br />
{<br />
MessageBox(0, "Error opening wave in device", "WaveInOpen Error",<br />
MB_OK);<br />
return (2);
}<br />
<br />
for(uiCounter = 0; uiCounter<DEF_NumAudioBlocks; uiCounter++)<br />
{<br />
WaveHeaders[uiCounter].lpData = <br />
GlobalLock(GlobalAlloc(GMEM_FIXED, uiAudioBufferNumBytes));<br />
if (WaveHeaders[uiCounter].lpData == NULL)<br />
{<br />
MessageBox(0, "Error allocating wave data", "Wave Data Error",<br />
MB_OK);<br />
return (3);
}<br />
<br />
WaveHeaders[uiCounter].dwBufferLength = uiAudioBufferNumBytes;<br />
WaveHeaders[uiCounter].dwBytesRecorded = 0;<br />
WaveHeaders[uiCounter].dwUser = 0;<br />
WaveHeaders[uiCounter].dwFlags = 0;<br />
WaveHeaders[uiCounter].dwLoops = 0;<br />
uiReturn = waveInPrepareHeader(hWaveInDevice, &(WaveHeaders[uiCounter]),<br />
sizeof(WAVEHDR));<br />
if (uiReturn != MMSYSERR_NOERROR )<br />
{<br />
sprintf(szTempString, "Error %d preparing header %d.",<br />
uiReturn, uiCounter);<br />
MessageBox(0, szTempString, "Wave Data Error", MB_OK);<br />
return(4);<br />
}<br />
}<br />
<br />
MessageBox(0, "Allocated and prepared all buffers - cleaning up!",<br />
"All successful!", MB_OK);<br />
<br />
return 0;<br />
}
|
|
|
|
|
You should only have one or two buffers prepared at any given time.
Then when you respond to the callbacks, you give the MM system the next buffer, calling waveInUnprepareHeader on the buffer it just finished using. So by double or triple buffering the data, you are allowing the multimedia to fill one while you are preparing another, and you unprepare the one it just finished filling. I think you are overflowing some internal buffer that can only handle up to 300 prepared headers at a time.
something like this:
prepare 3 headers and feed the MM system the first buffer
when it calls back and says it has filled it, give it second, and COPY the data from your first buffer to your own local storage
when it has filled second buffer, give it your thrid, etc.
repeat cycle until your waveform sampling is complete
I found this all works best from a thread that can handle the events from the mm system instead of doing it frojw ith the same thread, then I can copy the data out of a buffer and 'reprepare' that buffer while the MM system is busy sampling, instead of being blocked waiting for a sample buffer to fill.
|
|
|
|
|
(At home and can't remember my password so not logged in!)
Thanks - your suggestion sounds good but it means I have to handle the buffers in real time, and I'm lazy! I guess it's either do it your way or change to Windows XP, which I was considering anyway.
By the way, I tried my application on 2 other Windows 98SE PCs, and their behaviour was not the same as the original PC.
My original PC gave me a message when preparing buffer number 301, then gave the error code 7 - NOMEM - dialog box. The other two would prepare 1000 buffers, but when I tried 10000 buffers, they terminated with no message.
I guess it's just poor Win98 audio drivers!
NormanS
|
|
|
|
|
The event driven, ring buffering technique is the 'preferred' method. It worked for me back in 1993 on Windows 95 and Windows NT 4.0 machines (slow 66 MHz 80486 systems) with no problem. Yours should be fine if you adopt the same technique, given the speed of today's processors.
|
|
|
|
|
Hi Oliv - thanks for your comments.
The application I posted was just one I put together to investigate the problem, not my "real" project (which is about 9000 lines of code.) Since I found the problem in audio header preparation in my real project, that is where I stopped in the test application. It's a console application because I did not want anything to distract me from the real problem with the audio.
The actual project is an SDK-level Windows program, mainly because (1) I based my project on a sample project which was written in SDK-level C, and (2) I learned programming long ago, and I haven't bothered to learn this "modern" C++ / MFC stuff! (Also, I program in other environments using ANSI C, so I don't want to pick up C++ habits.)
The GlobalAlloc is not the problem. To test this, I changed the program slightly, so it allocates memory in one loop, and once all the data blocks are allocated, it starts to prepare the headers. The error occurs at about the same header (number 301 on my main development PC.) I have allocated 10000 blocks with no problems.
Unfortunately, I do need to capture 1 minute of audio. My main application is a video capture and processing program, which displays processed video in real-time. The user can stop at any stage, and step back and forward through the LAST minute of video, which I keep in memory in a ring of video buffers. He might have been playing the video for an hour, but I just keep the last minute of video frames. Once he stops, he can also save the 1 minute of video as an AVI file. That bit works, but I thought it would be a good idea to add audio to the AVI file, which is when I hit the problems.
I think the solution will probably be to use a smaller number of audio buffers (5 or 10), and transfer these into my own array of buffers whenever they are full.
|
|
|
|
|
|
Sometimes (actually, a lot of the time...) the application does not properly call the shell notification routines from within itself. It uses lower level IO routines which do not report activity to the shell. You might not be able to catch these types of events.
If you REALLY need to monitor for a file or directory change to a specific location, use FindFirstChangeNotification.
|
|
|
|
|
Hi!
Could anyone help me with my problem?
I have a VC++.Net project. Project specific defines and include paths are saved in an external file (response file) as compiler options. I use the file during compilation giving it by means of the @ compiler option that is provided through project properties: C/C++ -> Command Line -> Additional Options.
Now is the problem. After complete project build if I change the response file, the compiler does not note this and does not perform a new build. (In case of a make file this were simply
Is it possible to include this file in the dependencies chain so that the compiler makes a complete build?
Perhaps there are other ideas how to get desired behaviour?
Thanks
Alexander Zauzolkov
|
|
|
|
|
I've followed the MSDN sample codes to read samples from a wmv file. But what's different is that I need to call SetRange() each time when I enter a while loop to grab only sample in a specific range (Ex: every 1 second). But even if I called INSSBuffer::Release() to release the buffer interface after calling IWMSyncReader::GetNextSample(), the memory seemd not release at once. I used the taskmgr.exe to peek my memory usage. Codes are as follows:
QWORD qwRange = 0;
int nIndex = 0;
while( qwRange < m_qwFileDuration )
{
QWORD cnsSampleTime = 0;
QWORD cnsDuration = 0;
DWORD dwFlags = 0;
DWORD dwOutputNum = 0;
DWORD dwLength = 0;
LPBYTE pBuf = NULL;
INSSBuffer* pMyBuffer = NULL;
HRESULT hr = S_OK;
UINT nIndex = 0;
hr |= m_pSyncReader->SetRange( qwRange,0 );
if( FAILED(hr))
return;
hr |= m_pSyncReader->GetNextSample( m_wStreamNumber,
&pMyBuffer,
&cnsSampleTime,
&cnsDuration,
&dwFlags,
&dwOutputNum,
NULL );
if( FAILED(hr))
return;
hr |= pMyBuffer->GetBufferAndLength( &pBuf, &dwLength );
if( FAILED(hr))
return;
memcpy( m_ppBuf[nIndex], pBuf, dwLength );
pMyBuffer->Release();
pMyBuffer = NULL;
qwRange += 10000000;
nIndex++;
}
First loop: SetRange() would increase the memory usage, GetNextSample() would further increase the memory usage.
After First loop: SetRange() would decrease the memory usage, but more than that of the previous loop, and GetNextSample() would increase the memory usage again.
After using taskmgr.exe and run my code in debug mode to examine the memory usage, I found the memory usage only changed after these 2 lines. If I tried to delete the local buffer pBuf after Realese() would result in a memory exception... Why and how to prevent memory leak? Can somebody help me? Thanks!
|
|
|
|
|
Instead of using Range Values, Try to get samples until the hresult from the GetNextSample method becomes NS_E_NO_MORE_SAMPLES.
Don't release the INSSBuffer until reading process will complete..
Thank u..
|
|
|
|
|
Hello,
Have you used CPreviewWnd in CPropertySheet component? If so please explain abit, as the onpaint draw an elipse with little other documentation.
NNP
"Naked we come and bruised we go."
- James Douglas Morrison
Best Wishes,
ez_way
|
|
|
|
|
I need to sending data to keyboard through the keyb controller, because a device are connected to ps/2 port (emulating enchanced keyb). I need TO SEND data from PC to that device.
There is any way to do it in windows xp without using device drivers? has windows xp a generic device driver that could help me in this task? Direcx?, VC++.NET? any idea?
Any help will be welcome!
|
|
|
|
|
Hello, I was wondering if anyone has tried to put a button on a tab control? Basically I have a MDI application and I'm using a MDI tab control that was made by Dundas Software (I think) anyway I would like to put a "x" close button on the tab, that would allow a user to close that document if the button was clicked instead of going to the default windows spot to close the document. I have never tried to do anything like this before and was wondering if anyone has had experience doing something similar? Or if someone maybe saw how to do it somewhere on the net and could provide a link?
Thanks,
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
I’ve got a problem. That is, when we use those Windows APIs,such as SetupDiGetClassDevs() and SetupDiEnumDeviceInterfaces(),
to enumerate all the instances of the usb device class, what I wanna make sure are the answers to these questions:Is there a certain
rule which determines the order of all the instances which are enumerated? In other words,If we can depend on a certain rule to
foreknow which device instance will be enumerated first,which will be the next and which will be the last? If there is,then what
it is? If not,how can we let the first attached one be first enumerated,the next will be next,and the last will be last?
|
|
|
|
|
momer wrote:
Is there a certain rule which determines the order of all the instances which are enumerated?
No. It may be the order in which they were found/attached, but may not be. Don't depend on it.
momer wrote:
If not,how can we let the first attached one be first enumerated,the next will be next,and the last will be last?
No idea. Sorry
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I'm using Visual Studio .Net to create an application that uses HTML help. In general, I am having a really hard time finding good documentation on how this works. The MSDN library is a nightmare to navigate through and is not helping me much at all.
Here is my current problem. I can't seem to find a good description for or get a good feel for how all of the files work together. There is an HTMLdefines.h file. Then there are the .hhc, .hhk, .hhp files. Then the .chm file is the compiled output file. I have no problem with the basic editing of the help files and compiling them.
In my main application, pressing f1 over almost every menu item works and brings up a help window. I have no idea how because I never did anything specific for this to happen. I didn't even write a function handler to do this. Somehow this was all taken care of by the app wizard. There are two menu items; file-open and help-topics where when I press F1, I get an error message: "can't open help". I don't even know where to begin troubleshooting this since it is not even being done in my code. Somehow there must be some broken links in my help files in the hlp directory but I don't see them. At first glance all seems to be well. When I press help-topics, the .chm window is displayed fine and I have navigated through my help with no broken links. So what gives? Where can I find a book or some good documentation or research papers on how all of the files fit together so that I can solve this problem?
Thank you!
|
|
|
|
|