This is interesting. I made a small test program with the following code:
Code:
Option Explicit
Private Declare Sub ExitProcess Lib "kernel32" (ByVal uExitCode As Long)
Private Sub Command1_Click()
ExitProcess 0&
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
I then watched with a API spy tool to see what was happening for each button. Basically, they all call ExitProcess, but calling ExitProcess in code seems to do it more rapidly. The others had a lot of GetCurrentThreadId calls and a few Sleep 0 calls. The "X" button of the form wasn't really different either. Oddly, using End also made a call to LoadLibrary for oleaut32 and then GetProcAddress for "SysAllocString". I know the tool I use doesn't reveal everything, so maybe someone else can add to this.
Please remember to rate the posts and threads that you find useful.
How can something be both new and improved at the same time?