-2

I am trying to send a record from one dll to one exe.

The dll is an Outlook add-in I wrote, the exe is my main application.

I used this example to succesfully send a record from exe to exe, but when I try to do the same from dll to exe it doesn't work.

Note: please open the link and there you find the code I am using. That code is for an EXE sender application and a EXE sender application. This works.

If I put the sender code inside a dll the example doesn't work anymore.

Could you suggest a solution?

UnDiUdin
  • 14,924
  • 39
  • 151
  • 249
  • A record, I updated the question. – UnDiUdin Oct 27 '11 at 15:02
  • You need to show the code that sends the `WM_COPYDATA`, and the code the receives it. You also need to explain what "it doesn't work" means. – David Heffernan Oct 27 '11 at 15:11
  • -1. What does "doesn't work" mean? – Rob Kennedy Oct 27 '11 at 15:39
  • Post the code that doesn't work. The record declaration is NO help. – Warren P Oct 27 '11 at 16:18
  • 1
    I'd start with a simple string. If you can't send 'Hello, world!', then any discussion about the record is irrelevant. – Chris Thornton Oct 27 '11 at 17:50
  • Unfair downvotes since I wrote the question with no much detail but clear: I put a link to the example I used so there wou can find the code I use. That example is an EXE to EXE. I just did DLL to EXE and I am not able to send the messages. Since the only difference between the original example and what I did is EXE to EXE changed to DLL to EXE this may be could trigger in some of you the idea for the solution. This is why my question was intentionally written like this. – UnDiUdin Oct 28 '11 at 10:10
  • You are "not able to send the messages"? Do you mean that `SendMessage` fails? If it fails, it should return an error code. Have you checked for that? Are you sure you've found the correct window handle? You've stepped through your code with the debugger, and at every step, every calculation and function call has yielded exactly the value you knew in advance it that it would yield? Until you've done that, you aren't finished working on this problem. What did you expect to happen, and what happened instead? – Rob Kennedy Oct 28 '11 at 15:27

1 Answers1

0

Assuming that you can make it work with a string (which remains to be seen), you could simply serialize your record to a string (CSV, possibly using a weird delimiter like ~), send as a string (PAnsiChar or PWideChar), then de-serialze back into the record at the other end. This isn't as elegant as what you want, but absolutely, positively, will work.

Chris Thornton
  • 15,620
  • 5
  • 37
  • 62