2011-01-12 7 views

답변

5

C 코드 :

#include <Windows.h> 
//... 
SendMessage(hWndButton, BM_CLICK, 0, 0); 

C# 코드 :

[DllImport("user32.dll")] 
static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam); 

... 
Button myButton = ...; 
const int BM_CLICK = 0x00F5; 
SendMessage(myButton.Handle, BM_CLICK, IntPtr.Zero, IntPtr.Zero); 

그러나 C#으로, 당신은 그냥 쉽게 수행 할 수 있음을 유의하십시오

myButton.PerformClick(); 
+0

는 u는이 학습과를 exaplin 수 있습니다 부디? –

+0

정말 C#입니까? –

+0

죄송합니다. C 버전의 힌트였습니다. C# 버전은 아래에 있습니다. 말 그대로해야 할 것은 정확한 'myButton' 함수를 호출하는 것입니다. – Mehrdad