I need help on 2 things.

First, I created an application, I put 2 check boxes (auto click and auto 'z')

I double clicked the Auto Click check box and inputted this code -

Code:
procedure TForm1.CheckBox2Click(Sender: TObject);
begin
mouse_event(MOUSEEVENTF_leftDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
if Odd(GetAsyncKeyState(VK_F1)) then
end;

end.
I want it so when I hit the key 'F1' it will check Auto click and it will start clicking. But it will only start clicking when I tick it, and can I speed it up?

Next, I want to create the same thing, this time it presses "z" here was a code I found from a game but have no clue how to use it

Code:
var
  MS: HWND;
begin
MS := FindWindow('MapleStoryClass', NIL);
PostMessage(MS,wm_KeyDown,57, 57);
end;