Do you have a little more information for us ahlzl?
If I get want you mean, when 'picking' objects on the screen you are actually picking pixels which are traced back to their owners that draw them such as a line, edge or face. If it's not 2d wire frame (all lines/edges) it becomes very hard to determine an edge when the whole face is rendered as the edge is also rendered, if that makes sense.
Ok, when using the acad command it highlights the edges yes? This allows you to be able to pick the isolated highlighted edge. In you code you need highlight the object, have a look at 'highlighting' in the help doc's, you may also need to catch the mouse over event or similar to imitate how autocad does this without actually picking an object.
Do you have any code so far we might be able to help you with?
I tried your routine. It does seem like a bug. You might post it at the Autodesk Discussion Groups to see if anyone has an alternative method. Sorry I couldnt be of much help