Click here to Skip to main content
15,850,103 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Program keeps looping Pin
Richard Andrew x6411-Apr-14 17:26
professionalRichard Andrew x6411-Apr-14 17:26 
GeneralRe: Program keeps looping Pin
CounterClockWise11-Apr-14 17:41
CounterClockWise11-Apr-14 17:41 
QuestionDraw two monitors syncron Pin
_Flaviu10-Apr-14 23:11
_Flaviu10-Apr-14 23:11 
AnswerRe: Draw two monitors syncron Pin
Richard MacCutchan10-Apr-14 23:41
mveRichard MacCutchan10-Apr-14 23:41 
AnswerRe: Draw two monitors syncron Pin
pasztorpisti11-Apr-14 7:17
pasztorpisti11-Apr-14 7:17 
GeneralRe: Draw two monitors syncron Pin
_Flaviu13-Apr-14 23:23
_Flaviu13-Apr-14 23:23 
Question[MFC Desktop Application for enumerating Virtual customized folder and files] Windows 8 Address Bar icon problem Pin
Nirmal K P10-Apr-14 20:39
Nirmal K P10-Apr-14 20:39 
QuestionUse PlaySound api caused memory loading? Pin
cedricvictor10-Apr-14 17:02
cedricvictor10-Apr-14 17:02 
Dear all:

I implement a application, when I get a touch data from WM_INPUT and touch count more than previous, it will play sound, My code show as below:

C++
void CTouchSoundTrayDlg::OnRawInput(UINT nInputCode, HRAWINPUT hRawInput)
{
    UINT data_size = 0;
    BOOL bGot = FALSE;
    GetRawInputData(hRawInput, RID_INPUT, NULL, &data_size, sizeof(RAWINPUTHEADER));
    vector<BYTE> data;
    data.resize (data_size);

    if(GetRawInputData (hRawInput, RID_INPUT, &data [0], &data_size, sizeof(RAWINPUTHEADER))!=data_size)
    {
		
    }
    RAWINPUT* raw = (RAWINPUT*)(&data [0]);
	
    if (raw->header.dwType == RIM_TYPEHID) 
    {
        RID_DEVICE_INFO device_info;
        UINT info_size = sizeof(RIDI_DEVICEINFO);
        GetRawInputDeviceInfo ( raw->header.hDevice, RIDI_DEVICEINFO, (LPVOID)&device_info,&info_size);
        
        if(device_info.hid.dwVendorId = VENDER_ID)
        {
            g_CurFrameTime = GetTickCount64();
	   if(g_CurFrameTime - g_PreFrameTime > 30)
	   {
		g_PreUsedSize = 0;
		g_CurUsedSize = 0;				  
	   }
			
	   g_PreFrameTime = g_CurFrameTime;
	   DigitizerData* result = (DigitizerData*)(raw->data.hid.bRawData);
	   g_CurUsedSize = result->active_touch_count;

				  
            if(g_CurUsedSize <= 5)
            {
	       if(g_PreUsedSize <  g_CurUsedSize)
	       {
	           PlaySound(m_WavPath, NULL, SND_FILENAME|SND_ASYNC );
	       }
	       bGot = TRUE;
	   }
					
	   if(bGot)
	   {
	       g_PreUsedSize =  g_CurUsedSize;
	   }
         }		
    }	
	Default();
}



My question is

when I touch, it will play sound, and the using memory in task manager will be add, When play music is finish, the using memory is still, will not free
,why?

I try to disable the playSound api in my code, and the using memory is stable.


Thank your help, Victor
AnswerRe: Use PlaySound api caused memory loading? Pin
Richard Andrew x6410-Apr-14 18:19
professionalRichard Andrew x6410-Apr-14 18:19 
QuestionMS Word Automation - I get so far - now what? Pin
Bryan Anslow10-Apr-14 10:43
Bryan Anslow10-Apr-14 10:43 
AnswerRe: MS Word Automation - I get so far - now what? Pin
Richard MacCutchan10-Apr-14 23:39
mveRichard MacCutchan10-Apr-14 23:39 
SuggestionRe: MS Word Automation - I get so far - now what? Pin
David Crow11-Apr-14 5:40
David Crow11-Apr-14 5:40 
QuestionList And iterator Pin
Hamza Bin Amin10-Apr-14 3:49
Hamza Bin Amin10-Apr-14 3:49 
AnswerRe: List And iterator Pin
Maximilien10-Apr-14 11:21
Maximilien10-Apr-14 11:21 
SuggestionRe: List And iterator Pin
David Crow10-Apr-14 16:49
David Crow10-Apr-14 16:49 
Questionavoiding or skipping Divide by zero showing junk values Pin
manoharbalu10-Apr-14 1:50
manoharbalu10-Apr-14 1:50 
AnswerRe: avoiding or skipping Divide by zero crashes Pin
Heng Xiangzhong10-Apr-14 2:00
Heng Xiangzhong10-Apr-14 2:00 
AnswerRe: avoiding or skipping Divide by zero crashes Pin
Heng Xiangzhong10-Apr-14 2:01
Heng Xiangzhong10-Apr-14 2:01 
GeneralRe: avoiding or skipping Divide by zero crashes Pin
manoharbalu10-Apr-14 2:51
manoharbalu10-Apr-14 2:51 
GeneralRe: e: avoiding or skipping Divide by zero crashes Pin
Richard MacCutchan10-Apr-14 3:22
mveRichard MacCutchan10-Apr-14 3:22 
AnswerRe: avoiding or skipping Divide by zero showing junk values Pin
Munchies_Matt10-Apr-14 6:53
Munchies_Matt10-Apr-14 6:53 
AnswerRe: avoiding or skipping Divide by zero showing junk values Pin
User 5924111-Apr-14 20:07
User 5924111-Apr-14 20:07 
QuestionCDHtmlDialog: Changing HTML File Dynamically Pin
Don Guy9-Apr-14 12:31
Don Guy9-Apr-14 12:31 
QuestionSetWindowText() style question Pin
econy9-Apr-14 5:24
econy9-Apr-14 5:24 
AnswerRe: SetWindowText() style question Pin
jeron19-Apr-14 6:06
jeron19-Apr-14 6:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.