IR Remote Control - Hold Button

I'm trying to control my PC volume using a IR remote control. Right now it works, but for each step UP or DOWN I have to press the button again and again and again. I'd love to make it work just as the TV works, so when you hold the V+ button the volume rises up for how long you keep the button hold and same with V-.

#include <IRremote.h>
#include <HID-Project.h>                          
#include <HID-Settings.h>

#define code1 16732335 // Volume Down
#define code2 16742535 // Volume Up
#define code3 4294967295 // Hold

int RECV_PIN = 8;
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup() {
   irrecv.enableIRIn();
}

void loop() {
   unsigned int last=0;
   if (irrecv.decode(&results))
   {
          unsigned int i = results.value;
          if(i==code3)
                 i=last;
          else // i==code1 || i==code2
                 last=i;
          switch(i)
          {
          case code1: // Volume Down
                 Keyboard.press(KEY_RIGHT_CTRL);
                 Keyboard.press(KEY_F11);
                 delay(50);
                 Keyboard.releaseAll();
                 break;
          case code2: // Volume Up
                 Keyboard.press(KEY_RIGHT_CTRL);
                 Keyboard.press(KEY_F12);
                 delay(50);
                 Keyboard.releaseAll();
                 break;
          }
  irrecv.resume();
   }
}

What is wrong in the code?

Have you tried printing the value of i before the switch/case that uses its value ?
Is its value what you expect ?

last is set to zero each time through loop(). Is that what you intend to happen ?

For instance

  unsigned int last = 0;
  if (irrecv.decode(&results))
  {
    unsigned int i = results.value;
    if (i == code3)
      i = last;

So, if you receive a repeat code you set i to zero then use switch/case on its value.

Look wrong to me

I don't know exactly how to print the value you're talking about, but anyway I've tried your code and it doesn't work

I think Bob meant that you set last to 0

unsigned int last = 0;

and then set i to last, thus 0

i = last;

He didn't post his code, but only wanted to show you what you are actually doing in your code.
Maybe try

static unsigned int last = 0;

I think Bob meant that you set last to 0

Yes I did. Sorry for any confusion