I got the process ids of the excel application instances and I need to get windows handler for that.
I tried with AccessibleObjectFromWindow function as below, but I'm getting E_FAIL in hr. Any help is appreciated. Thanks in advance.
Main aim is to get the window handlers of the existing excel application instances. If there are two excel applications opened, I need to get the window handlers for those two instances. From the window handlers, I need to get excel application pointers. Hope you understood the scenario. Pls let me know if you need more clarification
When you say a process, there is a main thread in the process.
The main thread creates thread-a.
The thread-a needs to communicate to the main thread to create the other thread.
You can do this using events.
Create an event in the main thread using CreateEvent.
The main thread can then wait for the event to be signaled using WaitForSingleObject.
The other threads can then use SetEvent to signal this event.
If your main thread is a UI thread, you will need another dedicated thread to wait for the event to become signaled so that the UI thread is not blocked.
But I believe PostThreadMessage is a better way to do this.
If your process has a window, you can also use PostMessage to the main window to achieve this.
«_Superman_» I love work. It gives me something to do between weekends.
I find 2 group of raw socket functions, one is basic kind, another one starts with WSA.
The WSA functions are the Windows Socket 2 implementation, and just offer some enhanced functionality. They are all described in the MSDN documentation[^]. As far as I am aware the differences in implementation are unlikely to affect the speed.
You're going to want to look into DNS lookups, which change human readable URLs, e.g. www.codeproject.com (what you've called a named IP, which isn't strictly correct) in to IP Adresses (what you've called digital IP).
Named IP is in english characters, such as "www.hello.abc.efg" - how to convert it to digital IP, such as "188.8.131.52"?
The former is referred to as the host name while the latter is referred to as as IP dotted address. To get one from the other, you can use gethostbyname() and gethostbyaddr(). Both, however, have been deprecated by getnameinfo().
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
I am not sure if this is an answer to your question but take a look at PostThreadMessage[^], you do not need to have a window for that, only a message queue in the given thread. You could use that + somekind of mechanism to route the incoming message to the correct instances, like have some identifier or handle in the wParam and the sent integer in the lParam, then on the receiving side you use wParam to identify the instance and call some member function feeding it lParam. Be careful with posting because it might happen that the targeted object gets destroyed before the message arrives and then when you try to call the method of the destroyed instance you get a crash. This of course depends on the implementation. Good luck.
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Sometimes you just have to hate coding to do it well. <