I used the following as a query on master.mdf to restore the database which works well and tested in VC++.
qryRestore.Format("RESTORE DATABASE %s FROM DISK = '%%s.bak' WITH MOVE '%s' TO '%s%s.mdf', MOVE '%s_log' TO '%s%s_log.ldf'", sDest, backupDir, sSrc, sSrc, dataDir, sDest, sSrc, dataDir, sDest);
pConnection->Execute(_bstr_t(qryRestore), &vRecordsAffected, adExecuteNoRecords|adCmdText)
Here sDest= New DB Name
backupDir = Path for Backup directory
sSrc = Name of .bak file
dataDir = path for DATA folder of SQL.