Send 「ctrl+w」to Another App

摘要:送出「Ctrl+W」組合鍵給CoolEdit 2000

送出「Ctrl+W」組合鍵給CoolEdit 2000,代表要關掉一個聲音檔。
 


#include <windows.h>
#include <stdio.h>>
void main()
{
   HWND hwnd = FindWindow("COOL2000SS",NULL);
   if(hwnd)
   {
       PostMessage(hwnd, WM_KEYDOWN,VK_CONTROL, 0);
       PostMessage(hwnd, WM_KEYDOWN, 'W'       ,0);
       PostMessage(hwnd, WM_COMMAND, 0x010808  ,0);
   }
}