|
-
Jan 13th, 2005, 09:51 AM
#1
Thread Starter
Addicted Member
Delaring API's ***RESOLVED***
I am new to C# and need to convert a VB.NET library to C#. The library uses some API's and I haven't got a clue. Can anyone help? Below are the API's:
Code:
Private Declare Function GetMenu Lib "user32" (ByVal hwnd As Integer) As Integer
Declare Function GetMenuItemInfo Lib "user32" Alias "GetMenuItemInfoA" (ByVal hMenu As Integer, ByVal un As Integer, ByVal b As Integer, ByRef lpMenuItemInfo As MENUITEMINFO) As Integer
Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Integer, ByVal nPos As Integer) As Integer
Private Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Integer) As Integer
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Integer, ByVal hWnd2 As Integer, ByVal lpsz1 As String, ByVal lpsz2 As String) As Integer
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Private Declare Function SetFocusAPI Lib "user32" Alias "SetFocus" (ByVal hwnd As Integer) As Integer
Last edited by d.patrick; Jan 14th, 2005 at 04:17 PM.
-
Jan 14th, 2005, 02:51 PM
#2
Re: Delaring API's
To use APIs a quick example
Code:
using System;
using System.Runtime.InteropServices;
using System.Diagnostics;
class myClass
{
[DllImport("user32.dll")]
public static extern int MessageBox(int hParent,string Message,string Caption,int Type);
static void Main()
{
MessageBox(0,"Hello","Message",0);
}
}
-
Jan 14th, 2005, 04:17 PM
#3
Thread Starter
Addicted Member
Re: Delaring API's
Thanks for your help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|