Sign in to follow this  

Win32 in C# - Is that possible?

This topic is 4077 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have just started to learn C#. Before I thought it would be something like CPP and Visual Basic combined, but it seems more likely to be Java and VB. Anyway, i'll to ask something else, I want to use Win32 API functions embeded in my C# code. Like :
private void button1_Click(object sender, EventArgs e)
{
	// C# code
	MessageBox.Show("If you can read this text, it means my program works...",
			"SUCCESS!",
			MessageBoxButtons.OK,
			MessageBoxIcon.Information,
			MessageBoxDefaultButton.Button1,
			MessageBoxOptions.DefaultDesktopOnly);

	// A Win32 function
	HANDLE hFile = CreateFile((LPCTSTR)               "Input.txt",
        	                  (DWORD)                 GENERIC_READ,
                	          (DWORD)                 FILE_SHARE_READ,
                        	  (LPSECURITY_ATTRIBUTES) NULL,
				  (DWORD)                 OPEN_EXISTING,
        	                  (DWORD)                 FILE_ATTRIBUTE_NORMAL,
                	          (HANDLE)                NULL);
}
How can I do that?

Share this post


Link to post
Share on other sites

This topic is 4077 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this