1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| var i,TabCount:integer;
AWinHAndle,TabCtrlHandle:HWND;
AControl:TWinControl;
Item:PTCItem;
begin
//Met Delphi en avant plan
SetActiveWindow(FindWindow('Delphi', nil));
sleep(100);
//File => New => Other.. => Mon template
//Menu File (=Alt+F)
keybd_event(VK_LMENU, 0, 0, 0);
keybd_event(ord('F'), 0, 0, 0);
keybd_event(ord('F'), 0, KEYEVENTF_KEYUP, 0);
keybd_event(VK_LMENU, 0, KEYEVENTF_KEYUP, 0);
//Déjà positionné sur New
// keybd_event(VK_DOWN, 0, 0, 0);
// keybd_event(VK_DOWN, 0, KEYEVENTF_KEYUP, 0);
//Other
keybd_event(VK_RIGHT, 0, 0, 0);
keybd_event(VK_RIGHT, 0, KEYEVENTF_KEYUP, 0);
keybd_event(VK_UP, 0, 0, 0);
keybd_event(VK_UP, 0, KEYEVENTF_KEYUP, 0);
//on est sur le bon menu, on ouvre la fenètre
keybd_event(VK_RETURN, 0, 0, 0);
keybd_event(VK_RETURN, 0, KEYEVENTF_KEYUP, 0);
//on attend l'ouverture de la fenêtre (5 secondes)
sleep(3000);
//on continue en choisissant le bon onglet...
AWinHAndle:=GetForegroundWindow;
EnumChildWindows(AWinHAndle, @EnumProc, Integer(memo1.Lines));
TabCtrlHandle:=FindWindowEx(AWinHAndle,0,PChar('TTabControl'),nil);
TabCount:=SendMessage(TabCtrlHandle, TCM_GETITEMCOUNT, 0, 0);
//Et là je ne sais pas :/
EnumTabs(TabCtrlHandle,Memo1.Lines);
end; |
Partager