Click here to Skip to main content
15,884,388 members
Home / Discussions / C#
   

C#

 
GeneralRe: scalar data visualization Pin
Member 123014433-Mar-16 17:49
Member 123014433-Mar-16 17:49 
AnswerRe: scalar data visualization Pin
dan!sh 3-Mar-16 18:01
professional dan!sh 3-Mar-16 18:01 
GeneralRe: scalar data visualization Pin
Pete O'Hanlon3-Mar-16 23:41
mvePete O'Hanlon3-Mar-16 23:41 
GeneralRe: scalar data visualization Pin
Sascha Lefèvre3-Mar-16 0:55
professionalSascha Lefèvre3-Mar-16 0:55 
GeneralRe: scalar data visualization Pin
Mycroft Holmes3-Mar-16 19:22
professionalMycroft Holmes3-Mar-16 19:22 
GeneralRe: scalar data visualization Pin
Sascha Lefèvre3-Mar-16 23:23
professionalSascha Lefèvre3-Mar-16 23:23 
GeneralRe: scalar data visualization Pin
OriginalGriff3-Mar-16 23:30
mveOriginalGriff3-Mar-16 23:30 
QuestionC++ DLL within C# application Pin
my Nick2-Mar-16 10:03
my Nick2-Mar-16 10:03 
Hello, dear forum.
I have a problem programming on C#. My recent activities with C++ are back over 20 years.
I downloaded from the internet a server/client-solution for SQLite and am stuck in my C#-application using this dll.
C++
HRESULT hr;
HMODULE hMod = NULL;
PDLLGETCLASSOBJECT proc = NULL;
IClassFactory* pFactory = NULL;

//Get the module from list or load it
hMod = GetModule( szDllPath );
if( !hMod ) return( false );

//Get Proc address
proc = (PDLLGETCLASSOBJECT) GetProcAddress( hMod, "DllGetClassObject" );
if( !proc ) return( false );

hr = proc( IInterface , IID_IClassFactory , (void**)&Factory );
if( hr || !pFactory ) return( false );

hr = pFactory->CreateInstance( NULL, IInterface , pInterface );
if( hr || !pInterface ) return( false );

pFactory->Release();

What I've done so far (not much):
C#
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode]
private static extern IntPtr LoadLibrary(String lpFileName);

[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true)]
private static extern IntPtr GetProcAddress(IntPtr hModule, String procName);

[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern Boolean FreeLibrary(IntPtr hModule);

...

private static String DLLFile = string.Empty;
private static IntPtr handleDLL = IntPtr.Zero;
private static IntPtr handleProc = IntPtr.Zero;

...

DLLFile = MyPath + @"Lib\SQLQueryAS.dll";
handleDLL = LoadLibrary(DLLFile);
if (handleDLL == IntPtr.Zero) throw new Win32Exception(Marshal.GetLastWin32Error());

handleProc = GetProcAddress(handleDLL, "DllGetClassObject");
if (handleProc == IntPtr.Zero) throw new Win32Exception(Marshal.GetLastWin32Error());

???
and now
???

Then (unless I have understood correctly) it should invite a class, so you can responsive in this class located methods (procs/functions).
Please help me. What should happen next?
Thank you in advance.

modified 2-Mar-16 17:05pm.

AnswerRe: C++ DLL within C# application Pin
Eddy Vluggen2-Mar-16 10:37
professionalEddy Vluggen2-Mar-16 10:37 
GeneralRe: C++ DLL within C# application Pin
my Nick2-Mar-16 11:01
my Nick2-Mar-16 11:01 
GeneralRe: C++ DLL within C# application Pin
John Torjo2-Mar-16 11:37
professionalJohn Torjo2-Mar-16 11:37 
GeneralRe: C++ DLL within C# application Pin
Mycroft Holmes2-Mar-16 11:57
professionalMycroft Holmes2-Mar-16 11:57 
AnswerRe: C++ DLL within C# application Pin
my Nick2-Mar-16 22:28
my Nick2-Mar-16 22:28 
GeneralRe: C++ DLL within C# application Pin
Richard MacCutchan2-Mar-16 22:48
mveRichard MacCutchan2-Mar-16 22:48 
AnswerRe: C++ DLL within C# application Pin
John Torjo2-Mar-16 22:52
professionalJohn Torjo2-Mar-16 22:52 
GeneralRe: C++ DLL within C# application Pin
my Nick2-Mar-16 23:07
my Nick2-Mar-16 23:07 
QuestionHow To? Abstract base class with Generic Constraints that also implements other interfaces Pin
Foothill2-Mar-16 8:46
professionalFoothill2-Mar-16 8:46 
AnswerRe: How To? Abstract base class with Generic Constraints that also implements other interfaces Pin
Sascha Lefèvre2-Mar-16 9:14
professionalSascha Lefèvre2-Mar-16 9:14 
GeneralRe: How To? Abstract base class with Generic Constraints that also implements other interfaces Pin
Foothill2-Mar-16 9:22
professionalFoothill2-Mar-16 9:22 
GeneralRe: How To? Abstract base class with Generic Constraints that also implements other interfaces Pin
Sascha Lefèvre2-Mar-16 9:33
professionalSascha Lefèvre2-Mar-16 9:33 
QuestionHow to preview office file in windows app 8.1 using C# Pin
Shaimaa Fawzy2-Mar-16 4:16
Shaimaa Fawzy2-Mar-16 4:16 
AnswerRe: How to preview office file in windows app 8.1 using C# Pin
Frank Kerrigan4-Mar-16 3:52
Frank Kerrigan4-Mar-16 3:52 
GeneralRe: How to preview office file in windows app 8.1 using C# Pin
Shaimaa Fawzy5-Mar-16 5:53
Shaimaa Fawzy5-Mar-16 5:53 
QuestionObserver Pattern with Remote Machines Pin
Bernhard Hiller2-Mar-16 0:54
Bernhard Hiller2-Mar-16 0:54 
QuestionRe: Observer Pattern with Remote Machines Pin
dan!sh 2-Mar-16 1:42
professional dan!sh 2-Mar-16 1:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.