2
I’m new to c#, and I wanted to do this: I have the dllimport class that is being used in another class. The problem is this, I want to pass the constant(dll path) according to the version windows 64 or 32. I tried to pass a method as parameter, but it did not roll and so I saw the dllimport class only accepts static(or constant) argument. Does anyone know how I solve it? Follows my code:
//const string DllName = "C:\\EZForecourt\\EZClient.dll";
public string DllName()
{
if (Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE") == "AMD64" || Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432") == "AMD64")
{
return "C:\\EZForecourt\\EZClient64.dll";
}
else
{
return "C:\\EZForecourt\\EZClient.dll";
}
}
//--------------------------------- Connection -----------------------------------------//
[DllImport(DllName, CharSet = CharSet.Unicode)]
internal static extern Int32 ClientLogon(Int32 ClientID, Int16 ClientType, Int32 EventHandle, System.IntPtr hWnd, Int32 wMsg);