|
is there any example of it .
plz tell...
Thanx
manu
|
|
|
|
|
Here[^] you can find a part from the series of how to do it.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
manu_2205 wrote: is there any example of it
what book are you refering
|
|
|
|
|
Dear All,
I have a thread. Once my program started running it has 3 MB memory. And I have a thread withih that program. After that thread is started the memory usage is 6 MB.
now my problem is that my thread has exited with code -1.
After thread returns, my program still uses the same memory (6 MB).
It has to be 3 MB .. Right ?
Why this hell is happening ?
Thanks....
|
|
|
|
|
may be due to Mempry leak. Your application not freeing the memory after use.
If u can Dream... U can do it
|
|
|
|
|
I cannot imagine what is the problem, if a problem there is, since you posted no code...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Sakthiu wrote: It has to be 3 MB .. Right ?
No, not at all. Just because your thread freed 3MB of memory does not necessarily mean that Task Manager is going to reflect that. See here.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
How to connect more than 1 client to a single sever Please tell.......
|
|
|
|
|
Connections are done the same no matter how many clients connect to a server.
It's up to you to manage the connections on the server.
What are you having trouble with?
|
|
|
|
|
Hi iam trying to implement Music player is there any sample projects to implemaent that .Plz help me
#sanroop#
|
|
|
|
|
MSDN and PSDK samples. Look for MCI API (MCICreateWindow, if I remember well).
|
|
|
|
|
Could you please help us on how to make a program that will trace & block IP Address of a website.
Problem scenario:
On a local network the server will monitor all the sites that is being visited by a client computer.... The application must automatically blocks any unlawful sites and scan the content. At the same time it will be updated with the new sites. The administrator can also use keywords to block a website such as download & electronic chat.
Thanks ,
email add: lady_weng18@yahoo.com, ronessa_2004@yahoo.com
|
|
|
|
|
go for proxy server
never say die
|
|
|
|
|
i need codes, i mean i need help on how to create an ip tracer and blocker...
i have to program it.
|
|
|
|
|
if u dont mind using open source code...
Search more on iptables...
Shouvik
|
|
|
|
|
this is what i want it:
screen shoot
how can i adding image/icon on command bar on that place
thanks before ^ ^
|
|
|
|
|
Hey Guys,
Does anyone know if anyone has done an svg file viewer in MFC? I have a MFC doc/view application, and it would be extremely useful for me to be able to display svg file images in my application.
If anyone knows of anything that's kicking about that would be great.
Best Regards
Danny
|
|
|
|
|
Based on articles from this site:
http://www.codeproject.com/system/UsingWMI.asp
http://www.codeproject.com/system/Using_WMI_in_Visual_C__.asp
I've learned how to get information from a Win32_* class.
First step:
Service->ExecQuery(L"WQL", L"SELECT * FROM Win32_BaseBoard",WBEM_FLAG_FORWARD_ONLY,NULL, &enumerator);
And later second step:
obj->Get(L"SerialNumber", 0, &var, 0, 0);
However, I don't know how to do it from class Win32_DiskDrivePhysicalMedia. The first step works of course, but I'm not sure how to specify the Antecedent or Dependent.
I tried this:
hf = obj->Get(L"Antecedent.SerialNumber", 0, &var, 0, 0);
But it doesn't work.
|
|
|
|
|
Hello,
it took me a while to figure it out how this class works. Here is a sample in Managed C++:
ManagementObjectCollection ^c = query("Win32_DiskDrivePhysicalMedia");
for each(ManagementObject ^o in c)
{
DeviceInfo ^device = gcnew DeviceInfo();
ManagementObject ^media = gcnew ManagementObject(o["Antecedent"]->ToString());
ManagementObject ^disk = gcnew ManagementObject(o["Dependent"]->ToString());
Object ^temp = disk["Manufacturer"];
if(temp) device->manufacturer = temp->ToString();
temp = disk["Model"];
if(temp) device->model = temp->ToString();
temp = media["SerialNumber"];
if(temp) device->serial = temp->ToString();
list_->Add(device);
}
The class Win32_DiskDrivePhysicalMedia only contains references to the Physical Media and Disk Drive objects. You must, then, instatiate both objects to access their properties individually.
Regards,
Paulo
|
|
|
|
|
Are there any caveats in using ::WaitForSingleObject(…) with CMutex? MSDN article for ::WaitForSingleObject(…) says that it’s possible to use it with a mutex. However, the program hangs, when I try to Lock() the mutex.
Mutex is constructed together with a resource that it guards. The constructor for CResource is called in the main thread. Interestingly, the call to Lock() in the constructor succeeds.
CResource::CResource()
: m_mtxParse(FALSE)
{
m_iData = 0;
}
Then the pointer to the resource object is passed to two (2) worker threads that manipulate and read the guarded data through two (2) methods.
called only by the 1st thread
void CResource::IncrementData()
{
m_mtxParse.Lock();
for (int i = 0; i < 10; ++i)
{
++m_iData;
::Sleep(100);
}
m_mtxParse.Unlock();
}
called only by the 2nd thread:
int CResource::GetData()
{
::WaitForSingleObject(m_mtxParse.m_hObject, INFINITE);
return m_iData;
}
So, what are the limitation for ::WaitForSingleObject(…) with CMutex?
1. The purpose of mutex is to allow only one thread at a time to execute a certain code and to block all othre threads. I positively can make the mutex work this way, if I don't call ::WaitForSingleObject(...) on my mutex. Why does ::WaitForSingleObject(...) screw up the call to CMutex::Lock()? That's what's bugging me!
2. If I understand the ::WaitForSingleObject(...) correctly, it should be able to wait for a mutex. So I can make another thread (which never even tries to execute the code protected by the mutex) to wait until the other thread is done. I had acheived this functionality with CEvent, and I can, probably use a combination of CEvent and CMutex. But, I think, I should be able to wait for a CMutex and I don't need CEvent.
Do I have a wrong understanding of CMutex and ::WaitForSingleObject(...)?
If I have the right understanding, what's wrong with my code?
Cheers,
Nick
P.S. If you want to post an alternative solution (e.g. use CEvent instead of CMutex), please be so kind and do so only after you explain why the present approach will not work. I’m asking you to do this, because primarily I want a direct answer to my direct question. I’m learning multithreading, so my interest is academic (not commercial). I also know about some of the alternative solutions already. Thanks!
|
|
|
|
|
Your second thread isn't releasing the mutex which it has taken ownership of by calling
WaitForSingleObject()...
int CResource::GetData()
{
::WaitForSingleObject(m_mtxParse.m_hObject, INFINITE);
int RetData = m_iData;
::ReleaseMutex(m_mtxParse.m_hObject);
return RetData;
}
*EDIT* Modified to actually protect the object you are protecting
|
|
|
|
|
Thanks for the explanation! I see: I didn’t realize that ::WaitForSingleObject(…) not only waits for the mutex, but also acquires the mutex. However, this also means that only one thread at a time will be able to read the variable. I want multiple threads to be able to read the variable simultaneously, if it’s not being written, and to block, if the variable is being written. I guess, I should use both CMutex to protect the variable from simutaneous writes and CEvent to protect from simutaneous write+reads.
|
|
|
|
|
You can look for some good examples of reader-writer locks, using mutexes and semaphores.
I think there are some code articles posted here to CP for them too.
|
|
|
|
|
hello friends . i wrote a game with TC++ v3.0 and i want to develop it in linux . if is possible describe that how and with what kind of programming LANGUAGE i can work ?
a day without learning is a lost day
|
|
|
|
|
active66 wrote: . if is possible describe that how and with what kind of programming LANGUAGE i can work ?
i believe you are on Wrong forum.... you can find only Windows addicts here!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|