Didn't you read the CreateDialogParam documentation?
It describes it very clear:
dwInitParam [in]
Type: LPARAM
The value to be passed to the dialog box procedure in the lParam parameter in the WM_INITDIALOG message.
So handle WM_INITDIALOG message and check the LPARAM!