Ever since the "disatrous" Adobe Encore (CS4 and 5 does not matter)'s way of storing the installation directory details in Sqlite database file and some uninstall string in the registry, I would like to create dll to get the install directory from Sqlite database as per recommended by the Inno Setup (I can only use that to create some language pack installer for now.) users (http://news.jrsoftware.org/read/article.php?id=24706&group=jrsoftware.innosetup.code#24706).
Hence, I have written a dll in VB.NET as I am only familiar with that (I do not have any experience in C++, so sorry for that) and only to realized that Inno Setup can only call native dlls (Code for VB.NET is here): http://www.daniweb.com/forums/thread310549.html
So the problem is, I would like to create a C++ Native DLL and such that, I have the following prototype in my code (main.h):
#ifndef __MAIN_H__
#define __MAIN_H__
#include <windows.h>
#include <string>
#include <sstream>
/* To use this exported function of dll, include this header
* in your project.
*/
#define DLL_EXPORT __declspec(dllexport)
#ifdef __cplusplus
extern "C"
{
#endif
[B]string[/B] DLL_EXPORT GetDirectory([B]string[/B] SubDomain);
#ifdef __cplusplus
}
#endif
#endif // __MAIN_H__
And in main.cpp
#include "main.h"
#include "cppSQLite3.h"
#include <iostream>
#include <string>
// a sample exported function
[B]string[/B] DLL_EXPORT GetDirectory([B]string[/B] Subdomain)
{
//Write a function to get the installation directory.
[I] return 0;[/I]
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
// attach to process
// return FALSE to fail DLL load
break;
case DLL_PROCESS_DETACH:
// detach from process
break;
case DLL_THREAD_ATTACH:
// attach to thread
break;
case DLL_THREAD_DETACH:
// detach from thread
break;
}
return TRUE; // succesful
}
I have the CppSQLite from http://www.codeproject.com/KB/database/CppSQLite.aspx and I have no complication error when I changed the bold part into int
and hence the italics return 0; as I do not have an idea to declare a string variable.
For now, I am not asking on how to connect Sqlite connection but as why cant I put string as a type but can only have int / char? How should I do such that it accepts a receiving and returning string values (Receiving the target value / column to be searched, such as: {27B54140-8302-4B5D-83DD-AEE4B18BC7A4} while returning the installation path before researching on Sql issue.
Thanks a lot.