Here's any interesting result for the Forum to contemplate.
For two simple routines to test "FindWindow":
Process "A" is simply a form that displays its own handle, and class ("ThunderFormDC") in a label.
Process "B" uses "FindWindow two different ways to get process A's handle;
First: hWnd1 = FindWindow("ThunderFormDC", "targetForm")
Second: hWnd1 = FindWindow(vbNullString, "targetForm")
Process "B" then displays hWnd1 in "MsgBox".
For the first method ("ThunderFormDC"): Running in the development environment, process "B" finds the form-handle of process "A". However, in the compiled version, "hWnd1" is empty.
For the second method ("vbNullString"): Both the development environment version and the compiled version find process A's handle.
The question is why, in the first method, using the actual form-class, only succeeds in the development environment, and fails in the complied version?
P.S. I don't recommend using "FindWindow" to obtain a handle of another process, as it's been proven unreliable, even when using "vbNullString"; perhaps using it with a registered-class would be more reliable. I'm just curious as to why using the actual class-name produces different results when run in the development environment as opposed to the compiled version.
Additional Information for first method ("ThunderFormDC"): Apparently success or failure only depends on process "A". If "A" is run in development, "B" will succeed running in development or compiled. Failure only occurs went "A" is run compiled; then "B" will fail whether in development, or compiled.
For two simple routines to test "FindWindow":
Process "A" is simply a form that displays its own handle, and class ("ThunderFormDC") in a label.
Process "B" uses "FindWindow two different ways to get process A's handle;
First: hWnd1 = FindWindow("ThunderFormDC", "targetForm")
Second: hWnd1 = FindWindow(vbNullString, "targetForm")
Process "B" then displays hWnd1 in "MsgBox".
For the first method ("ThunderFormDC"): Running in the development environment, process "B" finds the form-handle of process "A". However, in the compiled version, "hWnd1" is empty.
For the second method ("vbNullString"): Both the development environment version and the compiled version find process A's handle.
The question is why, in the first method, using the actual form-class, only succeeds in the development environment, and fails in the complied version?
P.S. I don't recommend using "FindWindow" to obtain a handle of another process, as it's been proven unreliable, even when using "vbNullString"; perhaps using it with a registered-class would be more reliable. I'm just curious as to why using the actual class-name produces different results when run in the development environment as opposed to the compiled version.
Additional Information for first method ("ThunderFormDC"): Apparently success or failure only depends on process "A". If "A" is run in development, "B" will succeed running in development or compiled. Failure only occurs went "A" is run compiled; then "B" will fail whether in development, or compiled.