Hi again (again),
Last question, I promise.
I'm looking to start the GPS up wen the device starts. I don't mind changing hte registry for this, or doing it programatically. All the stuff I have found is either for C#, or the registry info doesn't exist in my phone.
Once again, any help would be very appreciated.
Cheers,
Dan.

GPRS Connect at Startup
erdoll
You need to set a few more fields in CONNMGR_CONNECTIONINFO
.dwParams = CONNMGR_PARAM_GUIDDESTNET;
Actually this will be enough, but make sure you call ZeroMemory on the structure before filling in the fields
CONNMGR_CONNECTIONINFO pConnInfo;
ZeroMemory(&pConnInfo, sizeof(CONNMGR_CONNECTIONINFO));
pConnInfo.cbSize = sizeof(CONNMGR_CONNECTIONINFO);
pConnInfo.dwPriority = CONNMGR_PRIORITY_HIPRIBKGND;
pConnInfo.dwParams = CONNMGR_PARAM_DESTNET;
...
Jassim Rahma
No worries:
Remember, GPRS turns on (but only if I use the CONNMGR_STATUS_CONNECTED) but it never gets to the message box with "here2".
// Turns on the GPRS connection
static void startGPRS()
{
CONNMGR_CONNECTIONINFO pConnInfo;
pConnInfo.cbSize = sizeof(CONNMGR_CONNECTIONINFO);
pConnInfo.dwPriority = CONNMGR_PRIORITY_HIPRIBKGND;
pConnInfo.bExclusive = false;
pConnInfo.bDisabled = false;
pConnInfo.guidDestNet = IID_DestNetInternet;
HANDLE *phConnection = NULL;
MessageBox(NULL,L"here",L"Error",MB_OK);
HRESULT hr = ConnMgrEstablishConnectionSync(&pConnInfo, phConnection,
15000, (DWORD *)CONNMGR_STATUS_CONNECTED);
MessageBox(NULL,L"here2",L"Error",MB_OK);
if (hr != S_OK)
{
char error[100];
_snprintf(error,100,"Couldn't Start GPRS - Error returned: %s",hr);
MessageBox(NULL,CA2W(error),L"Error",MB_OK);
}
CloseHandle(phConnection);
}
I get the same error if I replace (DWORD *)CONNMGR_STATUS_CONNECTED with say foo, where:
DWORD conn = CONNMGR_STATUS_CONNECTED;
DWORD *foo = &conn;
Other things I tried didn't compile. Any ideas
venp
Numeric value is "-2147467259"... which according to winerror.h is E_FAIL.
Strange...
Phill Midwinter
haha, I had that, but it was throwing errors. I realised later why, but never put it back in, thinking the way I created the variable would take care of the size parameter automagically.
Anyways, I added that in, and it still didn't solve the problem. I didn't bother checking the HRESULT cause if it didn't work, the errors for HRESULT didn't seem like they'd be much chop. But I did it now, cause it's the right thing to do anyways. My error is N_BOARD_FFUART. A search on the MSDN site, MSDN the program, Google, and the Universe, returned nothing. Either this error is bogus or it's uncommon.
Any ideas
joe.hamilton
Binu Jeesman
djchapin
marcy
nhaas
Thanks for the quick reply.
Now it doesn't throw an error, but the same problem that first arose is back. Now it doesn't connect and the function returns immediately with the error N_BOARD_FFUART. This is a hard battle to win haha.
Nidonocu
hahaha, my error was being cause by using NULL as the 4th parameter. This parameter is meant to be the one it checks against to make sure it is connected or whatever.
Now mine works, but only if I use the CONNMGR_STATUS_CONNECTED value. It connects, but the ConnMgrEstablishConnectionSync never returns. Even after the supposed timeout time. So it opens the GPRS connection, but they just stops the program at that point.
Using the debugger, it tells me it that I have an "Access violation writing location 0x00000010". Now, as the value of the define is 0x10, I know it has something to do with that. I've tried to make it point to everything and everything, but it either won't compile or throws the same error.
Derek at Potters Clay
HANDLE *phConnection = NULL;
MessageBox(NULL,L"here",L"Error",MB_OK);
HRESULT hr = ConnMgrEstablishConnectionSync(&pConnInfo, phConnection,
15000, (DWORD *)CONNMGR_STATUS_CONNECTED);
Should be
HANDLE hConnection = NULL;
DWORD dwStatus;
MessageBox(NULL,L"here",L"Error",MB_OK);
HRESULT hr = ConnMgrEstablishConnectionSync(&pConnInfo, &hConnection,
15000, &dwStatus);
D11
I don't know what I was talking about in the last post, I must have been reading some very strange things.
I've implemented it now, and it compiles and runs, but it doesn't actually inialise the GPRS.
The GPRS connection remains the same.
Here is what I have:
CONNMGR_CONNECTIONINFO pConnInfo = { sizeof(CONNMGR_CONNECTIONINFO) };
pConnInfo.dwPriority = CONNMGR_PRIORITY_HIPRIBKGND;
pConnInfo.bExclusive = false;
pConnInfo.bDisabled = false;
pConnInfo.guidDestNet = IID_DestNetInternet;
HANDLE phConnection;
ConnMgrEstablishConnectionSync(&pConnInfo, &phConnection, 15000, NULL);
Any ideas why that wouldn't work Could it be that my GUID is wrong Also, it does the same thing without the sync (ConnMgrEstablishConnection).
Tarey Wolf
Sanjukta