EndDialog returns an INT_PTR. An INT_PTR is guaranteed to be big enough to hold either an int or a pointer. This means that you can safely return a pointer which is cast to an INT_PTR.
Here is some quick sample code. Error checking is omitted.
Code:
/* Set up the string to return. */
char* pszStudentName = (char*) malloc(255);
strcpy(pszStudentName, "Joe Blogs");
/* Return string. */
EndDialog(hDlg, (INT_PTR) pszStudentName);
Code:
/* Receive returned string. */
char* pszStudentName = (char*) DialogBox(...);
/* Free returned string when done. */
free(pszStudentName);
If you have the old header files, INT_PTR will not be defined. Simply add the following to the top of your file.
Code:
typedef int INT_PTR;
If you are using C++, consider using new/delete in place of malloc/free.