Click here to Skip to main content
15,893,622 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
how can I convert this to c#.

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer

Thanks a lot
Almir
Posted
Comments
[no name] 20-Nov-12 11:21am    
try this

http://www.developerfusion.com/tools/convert/vb-to-csharp/?batchId=17e4fb38-1c4e-422c-9d7a-0746a44b915a

 
Share this answer
 
Comments
AlmirM 20-Nov-12 8:50am    
This translator does not return anything after I copy/paste my line of code...
Did you try? If yes can you please then let me about the results
Thanks
earloc 20-Nov-12 8:53am    
the output gives

[DllImport("user32.dll", EntryPoint="SendMessageA")]
private static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
as this signature indicates a platform invokation of a win32-dll, take a look at pinvoke.net[^]
 
Share this answer
 
v2
Comments
AlmirM 20-Nov-12 9:03am    
When I copy/paste

[DllImport("user32.dll", CharSet = CharSet.Auto)]
static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam);

Then DllImport is underlined saying that I missing type or reference. What shoul I referernce to in order to make this working
Please help
earloc 20-Nov-12 9:32am    
DllImport (System.Runtime.InteropServices.DllImportAttribute) is defined in mscorlib.dll. make sure you add a using directive to its namespace:

using System.Runtime.InteropService;
refer to http://msdn.microsoft.com/en-US/library/system.runtime.interopservices.dllimportattribute.aspx

and remember: MSDN is your friend :)
Use this online converter to convert your code
Convert VB.NET to C#[^]

You might also find the below article helpful
.NET Code Conversion - Convert your code[^]
 
Share this answer
 
v2
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900