I am trying to get the ID of a dialog box inside the callback function. I figured the following should work:

Upon entry to the dialog callback function:

dlgidd = GetWindowLong(hwindow, GWL_ID); // Get the dialog ID number
if(dlgidd == 0)
{
radioID = GetLastError();
}

But I get the error "Invalid window handle". It happens even if I put it after the WM_INITDIALOG message. I have no problem setting a value (the 'hwindow' value seems okay for the SetWindowLong() function).

Any ideas? I must be doing something VERY stupid!!

I am passing different dialog box templates and I thought this would be a good way to get the ID without placing it as a parameter.

Thanks,

Brian