When passing a var to a function the value is passed, not the var. So your function SQLWR_OpenDB should be like this - passing the address
BOOL SQLWR_OpenDB (LPCSTR lpszDBFile, DBHANDLE * phDB)
{
BOOL r = sqlite3_open (lpszDBFile, phDB);
if (r != SQLITE_OK)
{
SQLWR_ShowSqlErrMB (*phDB);
}
return r;
} // ***** End SQLWR_OpenDB *****
The call should be like this - of course you may not need the MessageBox func.
case IDB_OPENDB: // Open database (wrapper function)
if(SQLWR_OpenDB (DBFILENAME, &ghDB) == SQLITE_OK)
MessageBox (NULL, TEXT ("Open DB Success!"), TEXT ("Test"), MB_OK | MB_ICONINFORMATION);
else
MessageBox (NULL, TEXT ("Could not open DB!"), TEXT ("Test"), MB_OK | MB_ICONINFORMATION);
return TRUE;
And the prototype should be like this
BOOL SQLWR_OpenDB (LPCSTR, DBHANDLE*);
Also look up WM_COMMAND - the return value should be zero if you handle the message.
John