예전에 winTV2K 를 컴퓨터를 켜지자 마자 전체화면으로 만들기 위해서 사용했던 코드들 중 일부 입니다.
해당 윈도우를 최상위 상단으로 옮긴 다음 (마우스로 선택 한 것과 같은거죠)
키보드로 CTRL+T 를 누른 것과 같은 효과를 내기 위해서 만든 코드 입니다.
사용한 함수는 기본적으로 윈도우에서 제공하는 함수로서 바로 keybd_event 라는 API 입니다.
자세한 함수 설며을 위해서는 다음 폴딩페이지를 펼쳐서 보시기 바랍니다.
keybd_event
The keybd_event function synthesizes a keystroke. The system can use
such a synthesized keystroke to generate a WM_KEYUP or WM_KEYDOWN message. The keyboard driver's interrupt
handler calls the keybd_event function.
Windows NT: This function has been superseded. Use SendInput instead.
VOID keybd_event(
BYTE bVk, // virtual-key code BYTE bScan, // hardware scan code DWORD dwFlags, // flags specifying various function options DWORD dwExtraInfo // additional data associated with keystroke );
Parameters
bVk
Specifies a virtual-key code. The code must be a value in the range 1 to
254.
bScan
Specifies a hardware scan code for the key.
dwFlags
A set of flag bits that specify various aspects of function operation. An
application can use any combination of the following predefined constant values
to set the flags.
Value
Meaning
KEYEVENTF_EXTENDEDKEY
If specified, the scan code was preceded by a prefix byte having
the value 0xE0 (224).
KEYEVENTF_KEYUP
If specified, the key is being released. If not specified, the
key is being depressed.
dwExtraInfo
Specifies an additional 32-bit value associated with the key stroke.
Return Values
This function has no return value.
Remarks
Although keybd_event passes an OEM-dependent hardware scan code to the
system, applications should not use the scan code. The system converts scan
codes to virtual-key codes internally and clears the up/down bit in the scan
code before passing it to applications.
An application can simulate a press of the PRINTSCREEN key in order to obtain
a screen snapshot and save it to the clipboard. To do this, call
keybd_event with the bVk parameter set to VK_SNAPSHOT, and the
bScan parameter set to 0 for a snapshot of the full screen or set
bScan to 1 for a snapshot of the active window.
Windows CE: Windows CE supports an additional flag for the
dwFlags parameter. Use the KEYEVENTF_SILENT flag to simulate a keystroke
without making a clicking sound.
Windows CE does not support the KEYEVENTF_EXTENDEDKEY flag.
keybd_event이 키보드 이벤트 처리 함수를 이용해서 특정 윈도우에 뭔가를 하려면 다음과 같이 사용합니다.