I'm not sure. Also, I just found this in MSDN:
An application calls EndDialog from within the dialog box procedure; the function must not be used for any other purpose.
So I'm not sure if it's ok to call this function. I think
SendMessage(hDlg, WM_COMMAND, MAKELONG(IDOK, BN_CLICKED), GetDlgItem(hDlg, IDOK));
is still the cleanest solution. But I don't know how to emulate or access MAKELONG in VB. It basically combines two 16-bit values (integers in VB) to one 32-bit (long in VB).
Here is the C definition of MAKELONG, maybe you know how to convert it:
Code:
#define MAKELONG(a, b)      ((LONG)(((WORD)(a)) | ((DWORD)((WORD)(b))) << 16))
long is 32 bit, word is 16 bit and dword is 32 bit.