|
Anonymous wrote:
The application have to listen (like sockets) if a some is calling me.
But who can I do this ?
Do a search on MSDN for "TAPI Samples". There are plenty that do this. Or do a google, and you'll find some too.
To start you off, http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dntapi/html/msdn_ctapic.asp[^]
The hardest part about TAPI is making sure your hardware supports it correctly.
Michael
But you know when the truth is told,
That you can get what you want or you can just get old,
Your're going to kick off before you even get halfway through.
When will you realise... Vienna waits for you? - "The Stranger," Billy Joel
|
|
|
|
|
I am involved in a network monitoring project where I have completed a multiple client chat application by establishing a connection between the client and server using sockets.I would like the server to know what application is being run on the client so that it can monitor the activities of the client.For eg,when I open VC++ to do some thing at the client,at the server I should be able to know this.Please can some one help me about how to proceed to do this.
|
|
|
|
|
Heres an approach
1.- Have your server app send a request to the client side app for the names of running procesess. do this via standard UDP sockets.
2.- On the client app, and when requested by the server, You need to ennumerate the procesess (or maybe active windows would do) on the client. Use EnumWindows() or EnumProcesess() functions to do it.
3.- the Client app builds an array of strings for the names of running procesess, and sends it to the server app. also do this via sockets, tho it might be trickier than it seems. You might need to design some sort of class or structure that contains the total data lenght and the data itself.
4.- (the easy part) the server gets the data from the client, and displays the list of procesess.
HTH.
|
|
|
|
|
The Process Status API (PSAPI) has some methods that will let you enumerate all processes and obtain specific module information. This API is part of the Platform SDK and is declared in <psapi.h> Is this what you're looking for?
|
|
|
|
|
Hi all,
I recently installed Visual Studio 6.0, followed by the January 2004 edition of MSDN. Unfortunately MSDN did not integrate itself with VC++ or VB. I'm assuming that MSDN is designed to be used with VStudio .Net, but is there any way I can hook it into 6.0? At the moment I just get a popup telling me "The MSDN collection does not exist. Please reinstall MSDN."
Thanks,
Gary
|
|
|
|
|
|
Thank you.
Tech.Support : Mam, is your pc running under windows?
Customer : No actually its close to the main door.
|
|
|
|
|
Are you referring to C++ being portable across various operating systems? If so, the answer is yes, as long as the libraries and compiler that you use are supported on the various operating systems that you want your program(s) to run on.
I hope this answers your question appropriately.
Happy Programming!
WWW::CodeProject::BNEACETP
|
|
|
|
|
I know many projects that are written under c(not c++) so that they can make it portable. but c loses the powerfull concept of OO. Does name mangaleing has any effect so that C++ code can not be make portable.
Thanx for your answer.
|
|
|
|
|
Name mangling doesnt make C++ any less portable - its the C++ code you compile, not the name-mangled output. People probably chose C for the reason that there were more C compilers in the past. Such a decision has no real bearing nowadays
|
|
|
|
|
Theorically, C/C++ are independant and run on many machines whatever the source.
Actually, if your program call some specific libraries as unistd.h (standard UNIX functions) this is not recognized by all the compilers (Visual C++ don't know unistd.h for example).
If you want to be as independant as you can, use the standard library of the language, use the native in capital lettres (as INT , UINT , BOOL )..., use TCHAR for unicode or ansi (depending on a #define ).
TOXCCT
|
|
|
|
|
I am working on a project which I am wanting to use the list class template in the C++ standard library. How would I retrieve an object from the list once it is added (in the most efficent way)?
For instance:
[...]<br />
<br />
typedef list<MyObject> ObjList;<br />
<br />
int main()<br />
{<br />
ObjList obList;<br />
MyObject* pObj = 0;<br />
<br />
for(int i = 0; i <= 5; ++i)<br />
{<br />
pObj = new MyObject();<br />
obList.push_back(*pObj);<br />
}<br />
<br />
<br />
[...]<br />
<br />
return 0;<br />
}<br />
<br />
Thanks in advance!
Happy Programming!
WWW::CodeProject::BNEACETP
|
|
|
|
|
With a list you can only move the iterator forward or backward one node at a time. So to get the 3rd node you would:
ObjList::iterator it = obList.begin();
for (int i = 0; i < 3; ++i)
++it;
MyObject *pMy3rdObject = (*it); If you need random access your objects consider using a vector instead.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
I have been thinking about the possibility of using the vector<T> class as you mentioned as well. I guess I will be doing some monitored testing with both to see which one will suite my program's needs the best the most efficently. Thanks for your response.
Happy Programming!
WWW::CodeProject::BNEACETP
|
|
|
|
|
PJ Arends wrote:
MyObject *pMy3rdObject = (*it);
The above will not compile. I don't know why at the moment. Any ideas?
Below is the error given:
error C2440: 'initializing' : cannot convert from 'std::allocator<_Ty>::value_type' to 'MyObject *'
Happy Programming!
WWW::CodeProject::BNEACETP
|
|
|
|
|
Sorry, I forgot the cast
MyObject *pMy3rdObject = (MyObject *)(*it);
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Hi all, here´s a "tricky" question.
let´s say i plan to use serveral threads on my app, so i write a class to wrap threads, its header could look something like this (in pseudo-code):
class CThread
{
public:
BOOL Start(); // called to create the thread
void End(); // called to terminate the thread
static DWORD WINAPI MyThreadProc(LPVOID pData); // the threadproc
};
and in my app i could create several of these at any given time, like:
void WhatEver()
{
CThread threads[5];
for(int i=0; i<5; i++)
threads[i].Start();
}
to my understanding, when a class has a static member function, one and ONLY ONE "instance" of that function´s code exsists in my application as soon as the app starts running, even if there are several instances of that class present, they all "share" the same Function code (right?)
so, there are (in the above code) 5 instances of the CThread class, but there is ONLY one instance of the MyThreadProc() function, so here´s what i dont understand, ¿what if the threads do some time consuming operation?, ¿how can threads[1] start "running" if threads[0] has´nt finished yet, and thread[2] do its stuff while thread[1] is busy and so on? or to put it in other words, if theres only one instance of MyThreadProc(), ¿how can it be used at the same time by all threads?
Thanks for reading!
|
|
|
|
|
static means different things when applied to a member function versus a member variable. static on a method means that the method does not receive a this pointer. There's no concept of "instances" for methods - the compiler generates the code for the method, and threads run that code whenever you call the method.
So you can have many threads calling the same method with no problems. (Of course, you have to protect any data from simultaneous access if necessary, but that's another topic altogether.)
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | 1ClickPicGrabber New v2.0.1! | RightClick-Encrypt
Kosh reminded me of some of the prima-donna programmers I've worked with. Knew everything but when you asked them a question; never gave you a straight answer.
-- Michael P. Butler in the Lounge
|
|
|
|
|
Hi Mike, and thanks for your answer, what i ment by "instances" of methods was actually a "copy" of it on memory during program execution, NE way, i know now that each thread has its own space, and there for receives its own "copy" of the function.
Thanks!
|
|
|
|
|
|
I think your confusing class instances with threads. You are correct, when you define a class function as static, there is only one copy of the function(per thread). But a thread has it's own stack. So each thread executes it's own copy of the static function. So any local variables inside the static function are multi-thread safe. But any global/static variables are not thread safe. They are shared by all threads threads.
|
|
|
|
|
Ahh! i dint know threads had its own stack, i tought they all ran in the same stack, now i understand, each thread has its own copy of the function, so there isnt "just one" copy of it.
Thanks!
|
|
|
|
|
I have an SDI app that uses an ini file to store settings. The user has the option to manually edit the ini file from my program, which is done through notepad. What I want to do is suspend execution of my program until notepad exits. I read up on createprocess() and shellexecute() along with waitforsingleobject()but couldnt figure out how to do it.
Any help would be great!
Thanks,
Daniel
|
|
|
|
|
here is some code I use to open an UDL file
and wait for the UDL Editor to exit.
BUT! Your main thread is blocked and so
the repaint is blocked!!!
<br />
SHELLEXECUTEINFO inf;<br />
memset(&inf,0,sizeof(SHELLEXECUTEINFO));<br />
inf.cbSize = sizeof(SHELLEXECUTEINFO);<br />
inf.fMask=SEE_MASK_NOCLOSEPROCESS;<br />
<br />
inf.lpVerb=_T("open");<br />
inf.lpFile=sUdlFile;<br />
<br />
if(ShellExecuteEx(&inf)) {<br />
WaitForSingleObject(inf.hProcess,-1);<br />
CloseHandle(inf.hProcess);<br />
}<br />
|
|
|
|
|