Josh,
Following the tutorial in VS2019, I've noticed a couple of issues
1) While adding the class (function object) in step 5 of the tutorial, If I right click on the project name and choose "Add->Class" I don't get a dialog to choose "ATL Simple Object". To remedy this, I had to go to Solution Explorer, right click on the project and choose "Add New Item". That got me the dialog I needed to create an ATL Simple Object. We'll have to update the tutorial for 2019 for sure.
2) In step 13, while correcting the MIDL output from the Properties sheet of IadsFunction.idl, I noticed that "Generate Type Library" was set to "No". I wonder if that's that problem. Perhaps with older versions this step wasn't necessary for "implement interface"
3) In step 14, when building the project for the first time, I got a compile error. It said basically "dllmain.h: error C2065: LIBID_MyProjectNameLib': undeclared identifier". This to me indicates the output of the Midl compile (header and cpp file) isn't being included in the project. I then searched for the StdAfx.h and StdAfx.cpp files where this is normally placed and those files were nowhere to be found. After searching, I realized they renamed those files to pch.h and pch.cpp respectively. I added
#include "IadsFunction.h" (the name of the header file you entered in step 13 in the "Header File" row.. Make sure it's not projectName.h.. unless of course they fixed their previous bugs noted in the tutorial and that works now)
into the pch.h file
Then I added
#include "IadsFunction
.h"
#include "
IadsFunction_i.c"
into the pch.cpp file, hit build and got a "cannot opem file 'atls.lib' (sigh)
After a quick search online, it seems the directory isn't in the path for ATL projects by default, so they suggested finding the file and adding the location under "Linker->Additional Library Directories" (Mine was at C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.27.29110\atlmfc\lib\spectre\x64 for 64 bit build). I did that, hit build again. This time it actually built... but it failed to "regsvr32" because I forgot to run DevStudio "As Administrator". Restarting Visual Studio in Admin mode fixed that issue. Clean rebuild worked 0 errors/warnings.
4) I then went on to step number 15.. the infamous "Implement interface" step. I saw the same thing you did. It just didn't show any interfaces in the list.. very confusing..... but then I remembered that I told the MIDL compile in step 2 above to "Generate Type Library->Yes", so I changed the "Implement Interface" dialog "Implement interface from->File" and browsed to the x64 debug directory and selected the IadsFunction.tlb file and BINGO, there was the IIadsFunction interface in the list. Geez what a mess they've made of things now. I thought it was bad before, but they just keep surprising me with every new release lol.
5) After I implemented the interface, a slew of compile errors flooded in. After what I can only describe as a storm of confusing compile messages, I think I tripped on a possible answer. While implementing the interface, the wizard injected a line of code into my pch.h file "#import "C:\Jim\TestFunction\x64\Debug\IadsFunction.tlb" raw_interfaces_only, raw_native_types, no_namespace, named_guids, auto_search" with makes a bit of sense. It's trying to create the header and cpp files for the interface and include them in the project automatically. The problem is that when this line is executed, it creates an all lower case iadsfunction.tlh file and then seemingly fails to include it because it's looking for IadsFunction.tlh (upper case first letters). I'm confused but I press on.
6) So now I comment out the #import
"C:\Jim\TestFunction\x64\Debug\IadsFunction.tlb" line in the pch.h file and hit build. It builds. Ok that's interesting.
One, we're missing something regarding the "implement interface" step. The only way I could get it to implement an interface is by pointing directly to the tlb file. I'm not sure why or how that changed.
Second, we need to get the project to compile IadsFunction.idl to get the header files (and now the tlb file apparently to implement the interface), but once we implement the interface, the wizard injects and import statement into our pch.h file that fails to compile and then subsequently needs to be commented out.
Looks like we'll need to do a lot more work to update the C++ tutorial for Visual Studio 2019. It might take a long time to fumble through all of these issues. For now, try and go back and use the TLB method I described above... then try to survive the aftermath. You may make it out alive.
Just for reference, after that flurry of compile errors, my final pch.h file looks like:
#ifndef PCH_H
#define PCH_H
// add headers that you want to pre-compile here
#include "framework.h"
#include "IadsFunction.h"
#include "TestFunction_i.c"
//#import "C:\Jim\TestFunction\x64\Debug\IadsFunction.tlb" raw_interfaces_only, raw_native_types, no_namespace, named_guids, auto_search
#endif //PCH_H
and my pch.cpp file looks like:
/ pch.cpp: source file corresponding to the pre-compiled header
#include "pch.h"
Let me know if you make any progress or learn something new. We'll try to button this stuff up and update our tutorial asap,
Jim