Windows and doors can only exist inside of walls. They 'know' about the wall because the wall is their 'host'.
No other objects are wall-aware, and so the intelligence you hope for is not possible. You can create objects that are not windows and doors and save them as a window or door 'type' - but they would only be aware of the single wall that they would 'belong' to - it is impossible to query any information about adjacent walls.
Oops. Just realized that you posted this to the Developer forum. Is that intentional? Are you trying to program a custom add-on to manage what you are asking, or are you just asking how to work as a user in ArchiCAD?
One of the forum moderators • AC 25 USA and earlier • MacOS 11.6.7, iMac Pro