Click to See Complete Forum and Search --> : DllImport & C++.NET
lior6543
April 22nd, 2005, 11:25 AM
Looking for a code demonstrating how to use "DllImport" in C++.NET.
Couldn't find any examples in C++.NET.
Google is flooded with examples in C#.
It is very important. PLEASE HELP.
dumbquestion
April 22nd, 2005, 04:03 PM
Here's a link showing how to import the ShellExecute command in shell32.dll:
http://www.codeguru.com/forum/showthread.php?t=335006
Here's another showing how to import the BitBlt command in gdi32.dll:
http://www.codeguru.com/forum/showthread.php?t=313039
Hope it helps!
lior6543
April 23rd, 2005, 05:34 AM
Tnanks!
Though I already found out how to use it.
Let me ask you this:
Are you familiar with the names clash problem while using:
using namespace System::Runtime::InteropServices;
...and then you need to #undef functions ???
dumbquestion
April 24th, 2005, 08:48 AM
Yes, I've had some problems in VC++ .NET with DLL imports and then naming conflicts with the MessageBox class. If I had a form that I did a DLL import in and then in the same form tried to call MessageBox::Show, for example, I would get an error saying:
"error C2653: 'MessageBoxA' : is not a class or namespace name"
I guess Windows and .NET have naming conflicts, so if you add
#undef MessageBox
after your include statements at the top of the form file, the problem goes away.
lior6543
April 24th, 2005, 06:42 PM
thank you for your help!
codeguru.com
Copyright WebMediaBrands Inc., All Rights Reserved.