Methods that are static do not require an instance of a class. Look at the
Math class for example. It's methods are all static and can be callled using
Math.Atan2(...) etc.
When you create your class as a placeholder for your interop imports you can
just invoke them using the name of the class followed by the method. For
example...
class MyNativeMethods
{
[DllImport(""user32.dll")]
public static extern IntPtr GetDC(intPtr hWnd);
}
// in your code....
IntPtr hDC=MyNativeMethods.GetDC(this.hWnd);
Hope this helps.
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"Dmension" <df****@napcosecurity.com> wrote in message
news:OF**************@TK2MSFTNGP14.phx.gbl...
Thanks for the reply Bob,
But my issue is, I dont know how to instantiate that class I created in
my form1.cs and where should I do this. If possible could you give me a
small piece of code to get me started. I already placed the dll imports in
a class.
"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:O1**************@TK2MSFTNGP10.phx.gbl... DLLImport statements are all static extern anyway so just go ahead and do
what you suggest.
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"Dmension" <df****@napcosecurity.com> wrote in message
news:eB**************@TK2MSFTNGP15.phx.gbl... Hello Folks,
Newbie here needs a little help.
Here is my issue.
I want to place all my dll import data into class called
testdllimport.cs
Then I want to call, reference, or instantiate the class in my
form1.cs!!
Is this possible.
Thanks in advance.