Hi,
I'm trying to get InternetDial() working, and no matter what I try, it always crashes wininet.dll.
unsigned long int *conn;
InternetDial(hwndDlg,"GPRS",INTERNET_DIAL_UNATTENDED,conn,0);
I have included wininet.h.
I have added wininet.lib into linker.
hwndDlg is valid handle to my window.
"GPRS" is an existing RAS/DUN entry.
I've found some pieces of information on net that crashing may be due to 'parameter mismatch'. I couldn't find any more info though.
I haven't got any trouble working with other windows libraries and functions...
RasDial() from ras.h is working fine for me.
Anybody ? Any clues ?
For reference:
DWORD InternetDial(
HWND hwndParent,
LPTSTR lpszConnectoid,
DWORD dwFlags,
DWORD_PTR lpdwConnection,
DWORD dwReserved
);
OK, got some clues.
I set the 'conn' pointer to NULL before calling InternetDial().
I've got no idea why it helps.
There's no crash now, but InternetDial() returns ERROR_INVALID_PARAMETER.
Is it possible that 'unsigned long int *' is not a proper type here ?
Interesting.
The MSDN entry for InternetDial() says.
=============
lpdwConnection
[out] Pointer to a variable that specifies the connection number.
=============
So, you need to give the address of a variable, conn in this case.
unsigned long int conn;
InternetDial(hwndDlg,"GPRS",INTERNET_DIAL_UNATTENDED,&conn,0);
John
My god.
I'm so stupid.
It's [out] parameter... and I was standing on my head doing crazy stuff to make it work :/
Thanks !
Also, although it works as a 'long int' the variable to be correct should be a DWORD
DWORD conn;
John