Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / May 2004

Tip: Looking for answers? Try searching our database.

who on earth has done a complete win32 api wrapper for C#?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
~dr-sci-fi - 28 May 2004 12:49 GMT
looking for a comprehensive version of most common API functions used in
.Net, sample below:

===============================================================
using System;
using System.Runtime.InteropServices;

namespace ApiWrapper
{
/// <summary>
/// Summary description for Win32API.
/// Date: 5 March, 2004
/// </summary>
public class Win32API
{
 /// <summary>
 /// The SendMessage function sends the specified message to a window or
windows.
 /// The function calls the window procedure for the specified window and
does not return
 /// until the window procedure has processed the message. The PostMessage
function, in contrast,
 /// posts a message to a thread's message queue and returns immediately.
 /// </summary>
 /// <param name="WindowHandle">hWnd: Identifies the window whose window
procedure is to receive
 /// the message. Two values have special meanings:
 /// HWND_BROADCAST
 ///  The message is posted to all top-level windows in the system,
including disabled or
 ///  invisible unowned windows, overlapped windows, and pop-up windows.
 ///  The message is not posted to child windows.
 /// NULL
 ///  The function behaves like a call to PostThreadMessage with the
dwThreadId parameter set
 ///  to the identifier of the current thread.</param>
 /// <param name="Command">wMsg: Message to send</param>
 /// <param name="Data">wParam: Specifies additional message-specific
information.</param>
 /// <param name="ID">lParam: Specifies additional message-specific
information.</param>
 /// <returns>The return value specifies the result of the message
processing and depends on the message sent.</returns>
 [DllImport("user32.dll", EntryPoint="SendMessage")]
 public static extern int SendMessage(int WindowHandle, int Command, int
Data, int ID);

 /// <summary>
 /// The PostMessage function places (posts) a message in the message queue
associated with the
 /// thread that created the specified window and then returns without
waiting for the thread
 /// to process the message.
 /// </summary>
 /// <param name="WindowHandle">hWnd: Identifies the window whose window
procedure is to receive
 /// the message. Two values have special meanings:
 /// HWND_BROADCAST
 ///  The message is posted to all top-level windows in the system,
including disabled or
 ///  invisible unowned windows, overlapped windows, and pop-up windows.
 ///  The message is not posted to child windows.
 /// NULL
 ///  The function behaves like a call to PostThreadMessage with the
dwThreadId parameter set
 ///  to the identifier of the current thread.</param>
 /// <param name="Command">wMsg: Message to send</param>
 /// <param name="Data">wParam: Specifies additional message-specific
information.</param>
 /// <param name="ID">lParam: Specifies additional message-specific
information.</param>
 /// <returns>The return value specifies the result of the message
processing and depends on the message sent.</returns>
 [DllImport("user32.dll", EntryPoint="PostMessage")]
 public static extern int PostMessage(int WindowHandle, int Command, int
Data, int ID);

 /// <summary>
 /// The FindWindow function retrieves the handle to the top-level window
whose class name and
 /// window name match the specified strings. This function does not search
child windows.
 /// </summary>
 /// <param name="ClassName"></param>
 /// <param name="WindowName"></param>
 /// <returns></returns>
 [DllImport("user32.dll", EntryPoint="FindWindow")]
 public static extern int FindWindow(string ClassName, string WindowName);

 [System.Runtime.InteropServices.DllImportAttribute("gdi32.dll")]
 public static extern bool BitBlt(
  IntPtr hdcDest, // handle to destination DC
  int nXDest, // x-coord of destination upper-left corner
  int nYDest, // y-coord of destination upper-left corner
  int nWidth, // width of destination rectangle
  int nHeight, // height of destination rectangle
  IntPtr hdcSrc, // handle to source DC
  int nXSrc, // x-coordinate of source upper-left corner
  int nYSrc, // y-coordinate of source upper-left corner
  System.Int32 dwRop // raster operation code
  );
}
}
===============================================================

TIA

- sci
Brian Long - 28 May 2004 13:25 GMT
Suggest you check out http://pinvoke.net/

- Brian Long

> looking for a comprehensive version of most common API functions used in
Bob Powell [MVP] - 28 May 2004 14:31 GMT
Thats an excellent concept but lacking in content.

I keep adding to my win32 definitions but I don't think I'll ever do a
complete one. Too much work!

Signature

Bob Powell [MVP]
Visual C#, System.Drawing

Image transition effects, automatic persistent configuration and
design time mouse operations all in April's issue of Well Formed
http://www.bobpowell.net/wellformed.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://royo.is-a-geek.com/siteFeeder/GetFeed.aspx?FeedId=41

> Suggest you check out http://pinvoke.net/
>
> - Brian Long
>
> > looking for a comprehensive version of most common API functions used in

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.