|
You couldn't find anything here[^]?
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
I think he/she wants to get the caller id which is not in that list. I did this in the past, but I beleive there is no standard for this. For me I opened a terminal window to the modem and when a call came in it would appear on the terminal. I detected this extracted the caller id and sent it to my main program. This was a vb program yuck.... I wrote it only to begin to learn vb.
John
|
|
|
|
|
You can get Caller indentification info from LINECALLINFO struct, look up TAPI in MSDN
Peter Molnar
|
|
|
|
|
Couldn't find a better place to post the question, feel free to direct me to a better place...
Needing to automate our application testing using a keystroke/mouseclick recorder for playing back user events.... I thought there was something called Microsoft Test, but can't find any info on it...
Does Microsoft still makes something like this...??? If not, can someone suggest a popular automated testing tool for recording user events for playback...???
thanks
|
|
|
|
|
|
I am writing a scientific program that uses multiples threads to separate the GUI from the scientific simulation. I am using the CRT library so I am using the _beginthreadex() routine to start the "worker" thread. The problem is this: every once in a while (it is not reproducible, I have worked weeks on coming up with a reproducible situation but have never been successful) the _beginthreadex() routine will return NULL. When I check the error using GetLastError(), it states that there is not enough memory to run the thread. Once this error occurs, the thread cannot be started and the program must be restarted before it will successfully start the thread. When this error occurs the system is not out of memory and the program is not using much memory itself (as evidenced by the Windows task manager. This is an extremely frustrating problem for me and the other people that use this program. Has anyone had any similar experiences and can point me in the right direction for handling this problem.
Thanks,
Jay
|
|
|
|
|
jhoin wrote:
as evidenced by the Windows task manager
Are you absolutly sure of this? How much virtual memory is your process using? You may have run out of address space. Or have a highly fragmented address space such that there is no free block that is 1 MB to allocate a stack.
John
|
|
|
|
|
Thanks for you comments. No, I am not sure about this. A stupid question: How does one distinguish virtual memory and regular ram? How do I measure how much address space I have available? Oftentimes, the problem occurs right after the program starts up.
Jay
|
|
|
|
|
jhoin wrote:
How does one distinguish virtual memory and regular ram?
Virtual memory is the amount of RAM + swap files. You can have as large as a 4GB swapfile on every drive in your system. The address space of a single process is limited normally to 2GB with the largest block you can allocate being less than 1.3 GB because of memory fragmentation caused by dlls not loading sequentially in your address space.
jhoin wrote:
Oftentimes, the problem occurs right after the program starts up.
Then it is probably not a memory problem. How many threads are you spawning?
John
|
|
|
|
|
John,
Thanks for the primer on memory. I agree I don't think memory is a problem.
I am only spawning 3 threads at a time. It just doesn't make sense. The frequency of the problem depends on the machine it is being run on. I am at my wits end on this one.
Any arbitrary suggestions?
Jay
|
|
|
|
|
Are you putting in NULL for the Security descriptor parameter?
John
|
|
|
|
|
Post the code that spawns the thread including the parameters.
Keep a system log. I suspect that maybe one or more processes is taking up too much resources or that the issue has to do with system security.
Kuphryn
|
|
|
|
|
Here is the code which has been pared down a bit to get rid of unrelated initialization:
(one note: this routine itself was started as a thread so it is second in line and is trying to start a third thread.)
unsigned __stdcall micro_main(void *dummy)
{
unsigned threadID;
//other unrelated code
PSECURITY_DESCRIPTOR pSD;
SECURITY_ATTRIBUTES sa;
pSD = (PSECURITY_DESCRIPTOR) LocalAlloc( LPTR, SECURITY_DESCRIPTOR_MIN_LENGTH);
if (pSD == NULL)
{
LPVOID lpMsgBuf;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,NULL, GetLastError(),MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),(LPTSTR) &lpMsgBuf,0,NULL );
MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION );
LocalFree( lpMsgBuf );
}
if (!InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION))
{
LPVOID lpMsgBuf;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,NULL, GetLastError(),MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),(LPTSTR) &lpMsgBuf,0,NULL );
MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION );
LocalFree( lpMsgBuf );
}
if (!SetSecurityDescriptorDacl(pSD, TRUE, (PACL) NULL, FALSE))
{
LPVOID lpMsgBuf;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,NULL, GetLastError(),MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),(LPTSTR) &lpMsgBuf,0,NULL );
MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION );
LocalFree( lpMsgBuf );
}
sa.nLength = sizeof(sa);
sa.lpSecurityDescriptor = pSD;
sa.bInheritHandle = TRUE;
MICRO_THREAD_SUB = (HANDLE)_beginthreadex( &sa, 0, &sub_main_MACRO_CONTROL, NULL, 0, &threadID );
if (MICRO_THREAD_SUB == 0)
{
// it is here that that I always get the error
LPVOID lpMsgBuf;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,NULL, GetLastError(),MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),(LPTSTR) &lpMsgBuf,0,NULL );
MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION );
LocalFree( lpMsgBuf );
}
else
{
WaitForSingleObject(MICRO_THREAD_SUB,INFINITE);
CloseHandle(MICRO_THREAD_SUB);
}
// _endthreadex(0);
}
/*this is the thread which is called which immediately calls another thread-could that char com[200000]; be part of the problem? (it was used for some early debugging and no longer has any functionality.*/
unsigned __stdcall sub_main_MACRO_CONTROL(void *dummy)
{
char com[200000];
Run_Parser_Simulation(Sim->MACRO);
// _endthreadex(0);
return 0;
}
Thanks for looking at this. Regards,
Jay
|
|
|
|
|
There is quite a bit going on in the code including the call to LocalAlloc().
pSD = (PSECURITY_DESCRIPTOR) LocalAlloc( LPTR, SECURITY_DESCRIPTOR_MIN_LENGTH);
Try passing in __beginthreadex() default parameters, i.e. NULL, etc. to make sure the callback function is valid.
Kuphryn
|
|
|
|
|
Kuphryn,
Thanks for your answer. I brought in the PSECURITY_DESCRIPTOR code as a response to the memory allocation errors. Before that I used _beginthreadex() without default parameters. The problem is that the memory allocation errors only occur intermittantly and in what seems to be an unreproducible manner.
Jay
|
|
|
|
|
Or is it a deadlock somewhere?
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
What do you mean by a deadlock?
Regards,
Jay
|
|
|
|
|
thread A holding resource A and waiting for resource B
thread B holding resource B and waiting for resource A
Causing infinite waiting for resources of both threads.
Check out multithreading management topic.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Anthony,
That is not quite the logic I am using. It is:
thread A launches thread B and continues on so that GUI is responsive
thread B launches thread C and waits for thread C to finish.
This should be o.k., I think.
Jay
|
|
|
|
|
i am using a visual studio add in.
in one of the methods i am using
CWinApp* pApp = AfxGetApp();
i need to get a pointer the visual studio app, not the add in app,
in both cases, even if i use or don't use
AFX_MANAGE_STATE(AfxGetStaticModuleState())
i get a pointer to the add in app
and not the pointer to the visual studio (exe)
how can i retrieve the pointer to the visual studio exe???
thanks
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
im not very experienced in add in´s - would FindWindow() or FindWindowEx() help?
|
|
|
|
|
nop, not in this matter....
(thanks anyway)
any other suggestions?
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Is this a VS.NET or a VC 6 add-in?
|
|
|
|
|
VC 6
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Wouldn't you just use the IApplication pointer that gets passed to IDSAddIn::OnConnection?
|
|
|
|