开发者

.Net application windows controls injection

开发者 https://www.devze.com 2023-01-24 10:03 出处:网络
I have a legacy application implemented as windows forms .net application. It allows to script it events (with vbs) but doesn\'t allow to improve it\'s UI.

I have a legacy application implemented as windows forms .net application. It allows to script it events (with vbs) but doesn't allow to improve it's UI.

Is it possible to inject some custom user controls into legacy application controls tree in order to communicate with them from script-abilities further?

p.s. legacy applica开发者_运维技巧tion code is missed. It's also impossible to rewrite it from scratch


If you go to great lengths and put in much effort, I'm sure this would be possible using reflection and code re-writing or any such thing. But it would almost certainly be a lot simpler, less time-consuming and less error-prone to simply modify the GUI by changing the source code and then recompiling.

If your GUI isn't meant to be flexible, making it flexible should happen by re-designing or re-factoring the code, not by abusing the existing code into something that it wasn't meant to do.


Update #1: As said in the comment, since you no longer have the source code, the option of recompiling is gone. Unless you re-wrote the application from scratch or partly retrieved some source code through a reverse engineering tool like .NET Reflector. (Assuming the code hasn't been obfuscated.)

Update #2: If you want to go down the route of enumerating HWNDs (Win32 window handles), you might be interested in a related issue: namely, that of modifying Windows' default file open/save dialogs. If you want to insert or change controls in these dialogs, you basically have to deal with HWNDs and then manipulate controls through these, using native Win32 API functions.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号