Hi,
I am using the madshi IPC Queue functionality. This queue is being shared across processes.
My project need is that I want to know if the IPC queue has been created by another process. Is there such a API that help me know if the queue is already existing ?
Thanks,
- Nilesh Padbidri.
IPC Queue Existing ?
Only 1 IPC queue can exist in system at 1 time by design of Madshi so each queue name must be unique. If you need to know if the IPC is already up the easiest way is to try and create the queue with the same name as the queue you are checking. If project1.exe creates an ipc queue with name of "test" and project2.exe needs to know if queue is already up (project2.exe could be a DLL of course too and do this which would also work just fine) you could just try and recreate the same queue to check.
--Iconic
Code: Select all
if not BOOL(CreateIPCQueue('Test', Callback)) then
MessageBox(0, 'Already Up', nil, MB_OK)
else
MessageBox(0, 'Not Up', 'Created Queue Successfully', MB_OK);
IPC Queue Existing ?
Thanks, the solution does work.
But we are also assuming that the MADSHI library will never fail to create a queue, right ?
Thanks,
- Nilesh Padbidri.
But we are also assuming that the MADSHI library will never fail to create a queue, right ?
Thanks,
- Nilesh Padbidri.
Re: IPC Queue Existing ?
Heh...npadbidri wrote:But we are also assuming that the MADSHI library will never fail to create a queue, right ?
You're right, of course there could be another reason why CreateIpcQueue could fail. What I can do is to make sure that GetLastError will return a good value when CreateIpcQueue fails. Currently you can not rely on GetLastError when CreateIpcQueue failed. But I think with the next build I'll return ERROR_ALREADY_EXISTS if the queue already existed and some other error otherwise. Would that help?
Re: IPC Queue Existing ?
Yes that would be useful. But I think it would be useful to have a explicit function to check if a queue is existing.
The reason for a separate function is because to CreateIpcQueue if I pass NULL as the callback it returns failure. So it would be good to have a independent function for the same.
The reason for a separate function is because to CreateIpcQueue if I pass NULL as the callback it returns failure. So it would be good to have a independent function for the same.