Quote from tfjield:
pandabear, while re-reading this thread, I realized I wasn't very clear in my response to your question about creating another window. I thought that elaborating a bit might help new users of the API get started.
If you are programming in MFC, you can create a CDialog. CDialog's don't create their own message pump, but use the message pump of their parent window, the handle to which you can get to pass to the CDialog initialization routines via a call to AfxGetMainWnd(). This follows the examples given by Assent with the API.
Now you can set up a paradigm where you call, say, CMyDialog::CreateStock() which then posts a custom (WM_USER+) message to the CMyDialog, where by using PreTranslateMessage you can route the message to CMyDialog::OnCreateStock() which will be executed in the main Anvil thread.
I use event handles to simulate SendMessage across threads (i.e. so that CreateStock() will not return until OnCreateStock() is finished, so that I can pass a return value, etc.)
I didn't want to use SendMessage or SendMessageTimeout, because this will preempt the other messages already in the queue and may cause (fatal) delays in Anvil -- you might get booted from the server if you cause too much of a delay.
You can do this with a hook, as well. I chose the CDialog approach because I'm very comfortable with MFC and it suited my style better. But either approach will give you suitable results.
Hope this helps.