Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# VB
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 20-Nov-12 2:41am
AlmirM661
Comments
Lakhan Aanjana at 20-Nov-12 11:21am
   
try this
 
http://www.developerfusion.com/tools/convert/vb-to-csharp/?batchId=17e4fb38-1c4e-422c-9d7a-0746a44b915a
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
AlmirM at 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 at 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);
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

as this signature indicates a platform invokation of a win32-dll, take a look at pinvoke.net[^]
  Permalink  
v2
Comments
AlmirM at 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 at 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 :)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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[^]
  Permalink  
v2

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

  Print Answers RSS
0 CPallini 350
1 Sergey Alexandrovich Kryukov 320
2 BillWoodruff 309
3 George Jonsson 274
4 OriginalGriff 237
0 OriginalGriff 4,903
1 CPallini 3,960
2 Sergey Alexandrovich Kryukov 3,474
3 George Jonsson 2,786
4 Gihan Liyanage 2,386


Advertise | Privacy | Mobile
Web01 | 2.8.140905.1 | Last Updated 20 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100