Destroying Joints

Ok, I have a game right now, quite in the early stages and I need to destroy a joint when the mouse clicks "on" it (more like near it) I have tried some AABB creation around the mouse co-ords but it doesn't seem to work right.

Currently I have the keys 1-3 destroying the appropriate joints, but that's not very user friendly and I intend on have a lot of joints eventually (in later levels) and it would get quite confusing.

Code:
if(key=='1'){
      if(!j1Destroyed){
         world->DestroyJoint(joint1);
         j1Destroyed = 1;
      }
   }
   if(key=='2'){
      if(!j2Destroyed){
         world->DestroyJoint(joint2);
         j2Destroyed = 1;
      }
   }
   if(key=='3'){
      if(!j3Destroyed){
         world->DestroyJoint(joint3);
         j3Destroyed = 1;
      }
   }


Code:
if(wheel->IsSleeping()){
      const int k_bufferSize = 10;
      b2Shape *buffer[k_bufferSize];
      int count = world->Query(finishAABB, buffer, k_bufferSize);
      for(int i = 0; i < count; i++){
         if(buffer[i]->GetBody() == wheel){
            if(currentLevel == 5){
               exit(1);
            }
            printf("YOU WIN!\n");
            for(;;){
               if(world->GetBodyList() != NULL){
                  b2Body* dBody = world->GetBodyList();
                  world->DestroyBody(dBody);
                  dBody->GetNext();
               }
               else if(world->GetBodyList() == NULL){
                  j1Destroyed = j2Destroyed = j3Destroyed = 0;
                  SetUpLevel(GetNextLevel());
                  return;
               }
            }
         }
      }
   }


I have that for when the ball (objective wheel) hits the AABB at the end of the level. I tried using the same type of code around the mouse co-rds and stuff, using some ideas from the mousejoint, but nothing is seeming to work. Any help woud be greatly appreciated. I can post more code if it needs to be posted.

Also, I understand there is a wiki, but right now it's not working, so that's why I'm asking. Thank you.

EDIT: OK wow I feel like an idiot. I forgot to ConvertScreenToWorld for the mouse co-ords. But I fixed it! Haha, I'll leave this here for referencing and here's my code. (C++ & GLUT)

Code:
void MouseClick(int button, int state, int x, int y){
   if(button == GLUT_LEFT_BUTTON && state == GLUT_DOWN){
      b2Vec2 p = ConvertScreenToWorld(x, y);
      b2AABB tempAABB;
      b2Vec2 d;
      d.Set(1.0f, 1.0f);
      tempAABB.lowerBound = p - d;
      tempAABB.upperBound = p + d;
      const int32 k_maxCount = 10;
      b2Shape* shapes[k_maxCount];
      int count = world->Query(tempAABB, shapes, k_maxCount);
      for(int i = 0; i<count; i++){
         if(shapes[i]->GetBody()->GetJointList()->joint != NULL){
            world->DestroyJoint(shapes[i]->GetBody()->GetJointList()->joint);
         }
      }
   }
}

Original thread: https://box2d.org/forum/viewtopic.php?t=4315