I see no other way to do this for vertical walls, since the memory locations of the pixels in question are not contiguous if the storage used has the typical bitmap layout.
But you may be approaching the whole problem the wrong way. Instead of working directly with the bitmap image of the rendered scene you should build the scene as a list of objects, each of which represents an element of the scene. In this case the vertical wall would be one such object, storing its location and dimensions internally. You then walk over the list of objects and test whether the point (X,Y) falls inside such an object. This search can be sped up considerably by storing the objects in a tree or list sorted on coordinates. I have never worked in this area myself, but it is a common problem in game design, there should be plenty of literature around on the subject.