CreateProcess iexplore -getting dwThreadId.how to check status 'Active' or not

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

FindWindowEx returns after it has found out the first window having given class name and title. So it may and may not be the one you are looking for.
To find out all the windows having given class name and title you could use EnumWindows API

Please can you explain based on the foll.code. cmdlaunch to launching iexplore and getting dwThreadId but how do i connect this with GetWindowThreadProcessId->threadid beacuse I am not getting 'active' status everytime,one time it says 'Active' and next time 'Not Active' and when try to close the window it's not getting closing the particular window. I used ->[If lhWnd Then PostMessage lhWnd, WM_CLOSE, 0&, 0&].

Hello! Help Please!
VB Form and Module has below codes->It's working fine but not closing the exact "IExplore". createprocess dwThreadId not matching with lhWnd = FindWindowEx(0&, lhWnd, "IEFrame", vbNullString)
lthreadid = GetWindowThreadProcessId(lhWnd, lProcessId)

and tried with Call EnumWindows(AddressOf EnumCallback, hWnd) also but I couldn't match dwthreadid with GetWindowThreadProcessId processId. I don't have any problem with notepad but Iexplore instance threadid totally not matching.
So that I couldn't test whether it is Active or Not.

Expected Functionality.
1. Open iexplore instance with createprocess--Working
2. In next 'Status' command button to display the Status of iexplore ThreadId [Whether is active or not] - Not working with exact threadid. now just trying with Iframe
3. 'Close' Command button to close that particular Iexplore based on threadid.

Expected Functionality.
1. Open iexplore instance with createprocess--Working
2. In next 'Status' command button to display the Status of iexplore ThreadId [Whether is active or not] - Not working with exact threadid. now just trying with Iframe
3. 'Close' Command button to close that particular Iexplore based on threadid. ->Now Closing all Internet explore or Explicitly setting threadid. Pls. see the below code

lthreadid = GetWindowThreadProcessId(lhWnd, lProcessId)
lCurrentThreadId = lthreadid
Based on lcurrentthreaid and checking active status and closing the particular iexplore. but I could not match the pinfo.dwthreadid with hwnd threadid. If tried the same flow with processId also still not showing matching value.Help please.

Have you tried using GetActiveWindow or GetForegroundWindow? Also, have you considered ShellExecute or ShellExecuteEx to open a new iexplorer window? Seems to me you could use the window handle, and don't really need the ThreadID at all.

Please remember to rate the posts and threads that you find useful.How can something be both new and improved at the same time?