|
There are several solutions. One solution is COM in a local process would connect to the remote process. The remote process would update its status. A simpler solution is socket.
Kuphryn
|
|
|
|
|
Thanks, I was trying to stay away from COM. I'm not that familiar with it. I thought about using a socket but I wasn't sure if windows had something already for this purpose.
Tim
|
|
|
|
|
You could enumerate the processes on the other computer but that would require you have the proper [administrative] rights. It could also be unreliable if someone changed the name of the executable.
See http://www.sysinternals.com/[^] for code on enumerating processes and other things.
I think a simple socket idea is probably the best.
|
|
|
|
|
i have quite a good solution!
use the CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, NULL ) to get a complete list of the running processes on the local machine...
have a look at msdn under CreateToolhelp32Snapshot, you will find a useful code snippet there.
|
|
|
|
|
Hello all,
I thought when I call erase() method on an STL deque, it is supposed to call the corresponding destructor of the object. However, it does not when I do this. Here is some code to illustrate the problem.
std::deque<wave *=""> _wavePool;
std::deque<wave *="">::iterator it;
Wave *wav1 = new Wave("D:\\waves\\v1.wav", true);
Wave *wav2 = new Wave("D:\\waves\\think.wav", true);
_wavePool.push_back(wav1);
_wavePool.push_back(wav2);
it = _wavePool.begin()
Now, if I call...
_wavePool.erase(it);
The wave destructor never gets called. Am I not supposed to put heap pointers in a queue or do I have to do this manually.
Thanks for any help you might give me.
Pankaj
Without struggle, there is no progress
|
|
|
|
|
I think the rule is that anything you create on the heap you have to free yourself. Or you could use a deque of auto_ptr<>. I think the best advice is to grab the boost stl library[^] and use a scoped_array or something along htose lines.
|
|
|
|
|
Erik Juhl wrote:
I think the rule is that anything you create on the heap you have to free yourself.
Yes, anything you create on the heap you delete yourself. You could use some type reference counting pointer for this or call the delete yourself. I do the latter more often.
John
|
|
|
|
|
erase() calls destructor of contained objects, not delete. destructor of a pointer just destroys the pointer variable, not the underlying object. you have to delete allocated objects explicitly.
|
|
|
|
|
Use auto_ptr instead of the pointers directly:
std::deque< auto_ptr<Wave> > _wavePool;
std::deque< auto_ptr<Wave> >::iterator it;
auto_ptr<Wave> wav1(new Wave("D:\\waves\\v1.wav", true));
_wavePool.push_back(wav1);
wav1->Splash();
_wavePool.erase(it);
Regards,
Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
|
|
|
|
|
Hi:
i have an EditBox and i wanted to change the default style "Left To Right Reading Order" to "Right To Left..." at run-time so i used the
following code:
SetWindowLong(m_hWnd,GWL_EXSTYLE,WS_EX_RIGHT);
successfully,the style of editbox changed,But when i want to swith
between "RTL" To "LTR" ,the above function doesn't work!!! in the other hand i used this code:
SetWindowLong(m_hWnd,GWL_EXSTYLE,WS_EX_LEFT);
But function didn't work.is there another way to achieve this effect?
Please help me.
Regards.
|
|
|
|
|
Try it this way with ModifyStyleEx:
ModifyStyleEx(0, WS_EX_RIGHT);
ModifyStyleEx(WS_EX_RIGHT, 0);
Regards,
Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
|
|
|
|
|
Can I Set up a Spin ctrl to vary the number in a Edit box from 0.0 to 5.0 in Increments of 0.5 ?
|
|
|
|
|
|
Hi,
Set the Spinboxrange from 0 to 10
(0->0, 1->0.5, 2->1, 3->1.5, etc)
You can use the DialogMethod OnVScroll
The Message is WM_VSCROLL
put this Code in the OnVSrollMethod
void YourClassName::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar){
CString str;
if(pScrollBar==GetDlgItem(IDC_SPIN_..)){ //Insert here you SpinID
str.Format("%.1f",(double)(nPos/2.0));
GetDlgItem(IDC_EDIT_SPINVALUE...)->SetWindowText(str);
}
}
hope this helps
|
|
|
|
|
Hello:
I´m using CWorkQueue ( <ahref="">http://www.codeproject.com/useritems/Work_Queue.asp )in my project. I´m making a new class which is inherited from CWorkBaseItem. So OverWrite the doWork method where I create a socket and send a message. Everything work ok,
but I can see that the WorkQueue doesn´t destroy the terminated threads.
Anybody know how i can free all threas which had terminated????
el hombre arriesga su vida cada vez que elige y eso es lo que lo hace libre
|
|
|
|
|
Hi, do someone know how to get Systeminformations (like Memory Usage, Device Information, CPU, Totalmemory) in Win32 C++ under WindowsXP / Windows 98 / Linux ?
My Ideas:
CPU
With an Highresolutiontimer i can calculate the CPU Speed (MHz) but not the Facturer...
I have found some sources for older cpus, but i can't detect newer ones and neither special attributes like do they use mmx or sse2...
VGA
With OpenGL I can retrieve Informations about the graphic adapter like extentions, current videomode. But I need Informations of video buffers (do they supply quadbuffer for iGlasses?) or video memory (128MB DDR, 93.2 MB free)
Thanks alot for reading this, may be there is anyone who can help me...
Sendel
|
|
|
|
|
You can get most system information you want.
Here's a way of calculating CPU speed. It's not 100% accurate but close enough:
#pragma warning( disable: 4035 )
inline unsigned __int64 GetCycleCount()
{
_asm
{
_emit 0x0F
_emit 0x31
}
}
#pragma warning( default: 4035 )
int GetCPUSpeed()
{
Sleep( 0 );
const unsigned __int64 ui64StartCycle = GetCycleCount();
Sleep( 1000 );
return static_cast<int>( ( GetCycleCount() - ui64StartCycle ) / 1000000 );
}
|
|
|
|
|
That's what i have done already, so what i have is:
Have:
CPU Speed, Graphiccard Vendor, Driver Information, current Videomode, supported extentions
Need:
CPU Vendor, CPU Supported Chipsets (mmx, sse etc), Total Physical System memory, Free Physical System Memory, Graphiccard Total Video Memory, Graphiccard Free Video Memory, Graphiccard Memory Type (DDR, SGRAM, SDRAM...), Graphiccard supported Buffers (Quadbuffer, Front/Back Buffer, GBuffer, TBuffer,...), Graphiccard supported Videomodes
But thanks alot for your help !
Sendel
|
|
|
|
|
|
This is my solution: i don't know where I found this source, but its quite good: and with comments
<br />
#include <mmsystem.h><br />
#pragma comment(lib, "winmm.lib")<br />
<br />
DWORD GetCPUSpeed() <br />
{<br />
LARGE_INTEGER ulFreq, ulTicks, ulValue, ulStartCounter, ulEAX_EDX;<br />
<br />
if (QueryPerformanceFrequency(&ulFreq)) <br />
{<br />
QueryPerformanceCounter(&ulTicks);<br />
ulValue.QuadPart = ulTicks.QuadPart + ulFreq.QuadPart;<br />
__asm RDTSC<br />
__asm mov ulEAX_EDX.LowPart, EAX<br />
__asm mov ulEAX_EDX.HighPart, EDX<br />
ulStartCounter.QuadPart = ulEAX_EDX.QuadPart;<br />
do <br />
{<br />
QueryPerformanceCounter(&ulTicks);<br />
} while (ulTicks.QuadPart <= ulValue.QuadPart);<br />
__asm RDTSC<br />
__asm mov ulEAX_EDX.LowPart, EAX<br />
__asm mov ulEAX_EDX.HighPart, EDX<br />
<br />
DWORD tmp = (DWORD) ((ulEAX_EDX.QuadPart - ulStartCounter.QuadPart) / 1000000);<br />
timediff = tmp/10000000.0*0.001;<br />
return tmp;<br />
} else {<br />
return 0;<br />
}<br />
}
Thanks for all information,
=Sendel=
|
|
|
|
|
Hi,
I kind of finished my MFC 6 Dao application and decided to test it in another PC (in my Pc it works fine), and it crashes!
It gives me an error exactly in the CDaodatabase::Create statement. The error is: "Internal Error". All the PC's I tried produce the same error except mine
All these PC's have the same version of Access installed.
What could be the problem?
Any help would be greatly appreciated!
-- narada
|
|
|
|
|
You must to install the daosdk librarys....
Look into the CDs of VStudio. I believe that you can find it in the last cd....
Best Regards
Carlos Antollini.
Pi Five[^]Creator
Sonork ID 100.10529 cantollini
|
|
|
|
|
So in the target machines I have to install the dao libraries? Are they dll files?
Do you know which ones?
-- narada
|
|
|
|
|
You must to install de Jet Librarys.
The problem is VC++ doesn't use the same version of dao of Access, is for that you must to install the Dao librarys.
I saw into the last cd of VS 6.0. look into the cd number tree, you will find the daosdk folder, into it you will find the redist subfolder with tree more subfolder into it....
Install that Files....
Best Regards
Carlos Antollini.
Pi Five[^]Creator
Sonork ID 100.10529 cantollini
|
|
|
|
|
Crystal clear!
Thanks so much!
-- narada
|
|
|
|