• Advertisement
Sign in to follow this  

Win32 in C# - Is that possible?

This topic is 4170 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...",

	// 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
Also, I would generally make sure that the functionality you are looking for isn't already in the .Net framework (like file handling).

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement