|
KarstenK wrote: outside of the do{} loop
How am I supposed to change the strFileName and load different files inside the loop?
|
|
|
|
|
If you need to load a new file, the resources has to be properly released if it's anymore used. So please release the buffers and handles associated with
LoadFile operation. I think the other part of the code is just fine.
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
|
|
I have put this and now the Memory is not as bad but it keeps increasing.
HBITMAP test = m_bmpCtrl.hBitmap;
if (test)
{
DeleteObject(test);
}
Can someone please help
|
|
|
|
|
What's the type of m_bmpCtrl variable? There will be direct functions exposed in the class to clear the attached resources
also the way you released the resources is quite wrong. if you're explicity releasing the resource, it's your responsibility to assign it as NULL. Otherwise the next call this function may crash, as you've released the previously and the m_bmpCtrl.hBitmap still holds an junk(invalid) handle. also why it's necessary to create a temporary variable? the following way is straight forward no?
if (m_bmpCtrl.hBitmap)
{
DeleteObject(m_bmpCtrl.hBitmap);
m_bmpCtrl.hBitmap = NULL;
}
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
Thank you. That has partly solved it. Yes there was no point creating extra variable.
The m_bmpCtrl is of CBitmapCtrl class.
I am new at this and am learning. Thanks for all your help It's greatly appreciated.
|
|
|
|
|
I need logic for finding folders including subfolders within a selected path.
|
|
|
|
|
There are no less than a thousand examples of this on the Web. Search for FindFirstFile() , CFileFind , or _findfirst() .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I have an client application which as files i need to copy the a selected file into clipboard and paste it on the desktop or any where outside my client application
Within my client application i am able to copy and paste files but not outside my client application.
Here is the code
void SetClipBoardStringData(CString str, int format )
{
EmptyClipboard();
CString text = str;
HANDLE hGlobalMemory = GlobalAlloc(GHND, (DWORD)(text.GetLength()+1));
HANDLE lpGlobalMemory = GlobalLock(hGlobalMemory);
memcpy(lpGlobalMemory,(text),(text.GetLength())+1);
SetClipboardData(format,lpGlobalMemory);
GlobalUnlock(lpGlobalMemory);
GlobalFree(hGlobalMemory);
}
I am calling this function.
SetClipBoardStringData(sStrXML,CF_TEXT);
This copies the sStrXML to the clipboard.This sStrXml contains the file contents.
Now i want this clipboard contents to be availale outside the application so that i can paste it another application like notepad or a file in desktop.
How do i do it?
|
|
|
|
|
Try passing hGlobalMemory instead of lpGlobalMemory in SetClipboardData function.
|
|
|
|
|
Can we use SetLocaleInfo for non-union code to support unicode strings.
If, so please give me an example not declaration.
|
|
|
|
|
I am not able to create a "Test" shared Registry key under
"HKEY_LOCAL_MACHINE\Software\".
Description: I am looking to create a key that will be shared by 32bit as well as 64 bit process.Since I m looking to run a 32/64 bit process on Windows 7.
Could you some one assist me.
Monu_TCS
Pune
|
|
|
|
|
|
But I want to make it shared. Is it any way to make shared.
since "HKEY_LOCAL_MACHINE\software\Policies"
&
"HKEY_LOCAL_MACHINE\software\RegisteredApplications "
are shared for both. I want create in similar fashion
"HKEY_LOCAL_MACHINE\software\Test" How to do
Monu_TCS
Pune
|
|
|
|
|
Monu_TCS wrote: I am not able to create a "Test" shared Registry key under
"HKEY_LOCAL_MACHINE\Software\".
Why not?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Monu_TCS wrote: I am not able to create a "Test" shared Registry key under "HKEY_LOCAL_MACHINE\Software\".
Ummm - access permissions?
You know, most Windows functions return error codes and set the thread's error status (see GetLastError[^]), just so that you can tell why failure's occurred....
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Actually I want to make the Key as shared key, That will be accessible by 32 and 64 bit both application.
Monu_TCS
Pune
|
|
|
|
|
KarstenK told you that there are separate 32- and 64-bit registries. That says to me that your desire isn't going to be fulfilled. Get over it and use a file instead - I believe Microsoft kind of recommend using files for configuration information (rather than the registry) these days.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I think we can use symbolic link insted of shared link.
Monu_TCS
Pune
|
|
|
|
|
Hello
I am beginner in VOIP.I try to make simple calling and answering application.
Here i face this problem -I can hear only one side(calling).
Please check this following code.
//Calling-Ip Calling Function
gpAddress->CreateCall(bstr,LINEADDRESSTYPE_IPADDRESS,TAPIMEDIATYPE_AUDIO,&gpCall);
hr=SelectTerminalsOnCall(gpCall);
hr=gpCall->Connect(0);
//Answer -I add Answer method in event.
LRESULT CVOIPCallDlg::OnTAPIEvent(WPARAM wParam, LPARAM lParam)
{
CString csName;
switch(wParam)
{
case TE_CALLNOTIFICATION:
{
AddLog("call notification event has occured");
// Get the ITCallNotification interface.
IDispatch* pEvent=(IDispatch *)lParam;
Answer(pEvent);
}
break;
case TE_CALLSTATE:
ITCallStateEvent *a=(ITCallStateEvent *)lParam;
ITCallInfo *b;
if(a->get_Call(&b) != S_OK)
AddLog("get_Call()",hr);
CALL_STATE pCallState;
if(a->get_State(&pCallState)!= S_OK)
AddLog("get_State()",hr);
switch(pCallState)
{
case CS_INPROGRESS:
AddLog("dialing");
break;
case CS_CONNECTED:
AddLog("Connected");
break;
case CS_DISCONNECTED:
AddLog("Disconnected");
break;
case CS_OFFERING:
AddLog("A party wants to communicate with you!");
break;
case CS_IDLE:
AddLog("Call is created!");
break;
}
break;
}
pEvent->Release();
return 0;
}
LRESULT CVOIPCallDlg::Answer(IDispatch* pEvent)
{
HRESULT hr;
ITCallNotificationEvent * pNotify;
pEvent->QueryInterface( IID_ITCallNotificationEvent,(void **)&pNotify);
ITCallInfo * pCallInfo;
pNotify->get_Call(&pCallInfo);
ITBasicCallControl * pBasicCall;
hr = pCallInfo->QueryInterface(IID_ITBasicCallControl,(void**)&pBasicCall);
hr = pCallInfo->get_Address(&gpAddress);
ITStreamControl * pStreamControl;
pBasicCall->QueryInterface(IID_ITStreamControl,(void **) &pStreamControl);
IEnumStream * pEnumStreams;
ITStream * pStream;
hr = pStreamControl->EnumerateStreams(&pEnumStreams);
pEnumStreams->Next(1, &pStream, NULL);
long lMediaType;
TERMINAL_DIRECTION dir;
pStream->get_MediaType(&lMediaType);
hr = pStream->get_Direction( &dir );
ITTerminal * pTerminal;
ITTerminalSupport * pTerminalSupport;
gpAddress->QueryInterface(IID_ITTerminalSupport,(void **)&pTerminalSupport);
hr = pTerminalSupport->GetDefaultStaticTerminal(lMediaType,dir,&pTerminal);
hr = pStream->SelectTerminal(pTerminal);
hr = pBasicCall->Answer();
return hr;
}
Can you help me how it resolve.
Thanks
Mahendra
|
|
|
|
|
Hi ,
When i try to do as follows.
CString strString=_T("testing");
int nSize=sizeof(strString);
now nSize gets a value =4;
how the size is getting 4 strString is a pointer..? i guess it is an object...
Please clarify..
|
|
|
|
|
p_1960 wrote: i guess it is an object...
Yes...
If you look into the code of CString you will get the answer.
- ns ami -
|
|
|
|
|
then why the size of CString is 4..?
|
|
|
|
|
The size of a class object is the sum of size of all the non static members. If you check the CString class (as I told before) you can find only one member inside it. ie., LPTSTR m_pchData;
- ns ami -
|
|
|
|