0

I need to do some maintenance on an old program made with C++Builder 2006. One of the problems is making Drag&Drop working again, and i've found the solution in various sites (Here the first question i've found here).

But i can't find the ChangeWindowMessageFilter declaration anywere: according to the MS site, this function is available from Windows Vista, so i'm not surprised that it isn't in my winuser.h.

How can i call this function?

Jabberwocky
  • 48,281
  • 17
  • 65
  • 115
Parduz
  • 662
  • 5
  • 22
  • 3
    Apparently C++Builder 2006 did not yet contain the latest additions for Vista. You can call `ChangeWindowMessageFilter` (or any other win32 function not defined in your antiquated Windows.h) by using [`GetprocAddress`](https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-getprocaddress) – Jabberwocky Mar 30 '22 at 07:53
  • 1
    Alternatively you can declare the function, and generate an import library (see [Building an Import Library and Export File](https://learn.microsoft.com/en-us/cpp/build/reference/building-an-import-library-and-export-file)). This is assuming that C++Builder is compatible with Microsoft's build tools. – IInspectable Mar 30 '22 at 13:58
  • 2
    @IInspectable "*This is assuming that C++Builder is compatible with Microsoft's build tools*" - It is not. But C++Builder has its own [`IMPLIB.EXE`](https://docwiki.embarcadero.com/RADStudio/en/IMPLIB.EXE,_the_Import_Library_Tool_for_Win32) and [`MKEXP.EXE`](https://docwiki.embarcadero.com/RADStudio/en/MKEXP.EXE,_the_64-bit_Windows_Import_Library_Tool_for_C%2B%2B) tools for generating 32-bit and 64-bit import libraries, respectively. – Remy Lebeau Mar 30 '22 at 17:27
  • Ok, is one way better than the other? @RemyLebeau: there's still something online that explains how to do it? or could you provide an example as a solution? – Parduz Apr 01 '22 at 10:17
  • 1
    @Parduz it really comes down to experience and goals. If you expect to use this function (or other newer APIs) alot, it may make more sense to create an updated import library to include them. On the other hand, if this is more of a one-off, it may make more sense to just load the function(s) dynamically as needed. It is whatever you are more comfortable doing. – Remy Lebeau Apr 01 '22 at 14:40

0 Answers0