0

I have a win32 dll that I inject into a running process in order to extract and monitor/log data. This dll then hosts the CLR and uses ExecuteInDefaultAppDomain to load my c# dll that creates a WinForm.

Currently, when my c# dll is loaded and the init function is called, it creates a WinForm with a richtextbox to display information and it can import all my win32 dll's functions easily.

So now, how can I call a function to write to my richtextbox in my c# WinForm repeatedly(in a loop) from one of the functions in my win32 dll(both dll's are already loaded in the same process)?

edit: I have looked up quite a lot of topics relating to the various ways but none seemed to fit my situation on sites like here stackoverflow, msdn, codeguru, google.

Would using reverse p/invoke work for me in this situation? If so, can you please show me a small example?

Scleractinian
  • 77
  • 1
  • 7

1 Answers1

0

Of course you'll use P/Invoke with a Delegate. Look at this answer here on SO: Howto implement callback interface from unmanaged DLL to .net app?

Community
  • 1
  • 1
Simon Mourier
  • 132,049
  • 21
  • 248
  • 298