I'm trying to pinvoke a function in a C++ dll but I'm getting an error that
entry point can not be located from my pinvoke code. Do I need to add any
code to the C++ DLL to make the pinvoke? The following is what I have in my
C# code:
[DllImport("Prop SheetHost.dll")]
public static extern void ShowAdProp(
[MarshalAs(Unman agedType.LPStr)]
String m);
//This is where I invoke the function
private void propertyToolStr ipMenuItem_Clic k(object sender,
EventArgs e)
{
ShowAdProp("'CN =1608,CN=Users, CN=Accounting,C N=Contexts,CN=U nity,CN=Symark, CN=Program Data,DC=unity,D C=windev,DC=sym ark,DC=com");
}
//This is start of the C++ dll
using namespace std;
void ShowAdProp(wstr ing adPath)
{
CoInitialize(NU LL);
HRESULT hr;
HINSTANCE hInstance = NULL;
HWND hwndConsole = GetConsoleWindo w();
if(hwndConsole)
{
hInstance = (HINSTANCE)(LON G_PTR)GetWindow LongPtr(hwndCon sole,
GWLP_HINSTANCE) ;
}
CPropSheetHost *pHost = new CPropSheetHost( hInstance);
// Hold a reference count for the CPropSheetHost object.
pHost->AddRef();
hr = pHost->SetObject(adPa th.c_str());
--
Thanks.