Sorry if this sounds dumb, but is it possible to control or gain access to data in other applications? I'm not talking about making a macro type program that has predefined mouse movements and timings, but a program that can "tap" into another and access its data, or invoke some of its functions.

I don't have any specific program in mind or specific example, I'm just curious as to how one could achieve something like this. I looked into this with Java, but no one seems to have an answer (or good one at that), so I'm trying my luck with c#. Any help would be appreciated, thanks.