Right now, when the RasDial function is run synchronously, the program is unusable unless it is disconnected.
In contrast, when the RasDial function is run asynchronously, it immediately jumps to the callback function and doesn't dial up anymore. It returns success straight after the callback function is finished.
I am a bit confused about the use of the callback function parameter in the RasDial function. Here is the RasDial function:
Is it like I have to set dwNotifierType to 0 and put a self-defined function into the lpvNotifier parameter, and then the RasDial function will do the dial-up while executing the callback function? Is there anything I have missed? Or is there something I have done wrong?
By the way, I still don't understand the concept of RasDialFunc. What does the placeholder mean? What does that do? (Sorry, maybe this is a silly question. I am just a programming beginner).
Here is my code:
typedef LPVOID (*RASDIALFUNC)(UINT, RASCONNSTATE, DWORD);
LPVOID RasDialFunction(UINT unMsg, RASCONNSTATE rascs, DWORD dwError)
/* No coding at the moment */
printf("Please enter the telephone number: ");
// Fill RASDIALPARAMS structure
rdParams.dwSize = sizeof(RASDIALPARAMS);
rdParams.szEntryName = '\0';
rdParams.szCallbackNumber = '\0';
rdParams.szDomain = '\0';
// Call RasDial Function
HRASCONN hRasConn = NULL;
rdFunc = RasDialFunction;
DWORD dwRet = RasDial(NULL, NULL, &rdParams, 0L, rdFunc(WM_RASDIALEVENT, RASCS_OpenPort, 0), &hRasConn);
/* Further more codes...... */
I have been stucked for a few weeks already. So please HELP!