Where is LPPICTURE defined? - c++

I'm trying to write a function to load a JPEG, and I've downloaded the sample code from MSDN Q218972, but it is using precompiled headers and I am not.
I've spent hours looking for where LPPICTURE and OleLoadPicture() are defined but can't find it anywhere.
Does anyone know which header I need to include for these two?
In future, is there any resource I can use to find this information? MSDN documents the .NET world extremely well and it's often trivial to find what I need to include, but I'm finding that it takes longer to identify headers to include for my Win32 program than to learn how to write a Win32 program!

OleLoadPicture() is defined in OleCtl.h and implemented in OleAut32.dll. The import library is OleAut32.lib.
The information is found towards the bottom of the MSDN topic.
As for LPPICTURE, that is also defined when you include OleCtl.h.

Related

Is there common practice to find required header files of libraries in C++?

I am fairly new to C++ and this might sound like a very dumb question, but is there any resource or common practice to find the headers that need to be included when using C/C++ libraries?
For example: I am currently doing a project using the OpenSSL library.
How do I find out which headers I need to include for the sample codes on this page:
https://wiki.openssl.org/index.php/EVP_Key_and_Parameter_Generation
I had this issue many times and I am almost always struggling to find the right header files to include if the documentation doesn't provide a full working example.
Am I missing smoething when it comes to finding the required header files or is this lack of documentation the norm for examples?
I am aware that you were hoping to find something like a fancy database or any secret documentation to get the header.
Like for the Qt framework in the Qt Creator would be positioning the cursor on a written class in the code and just pressing alt + enter is adding the necessary header on top of the code.
Sadly that functionality is just for Qt not for c/c++ implemented.
The correct answer to your question might be as simple and maybe basic as so and it is also the fastest way I found and probably most people use:
A search engine of your choice(Google, DuckDuckgo, Startpage.com ...)
library command (f.e. EVP_PKEY)
Programming language name (f.e. c++, Qt, ...)
Proof of concept f.e. for startpage.com:
Maybe https://en.cppreference.com/w/cpp/header is an alternative - I just never found stuff real quick there.
The second best option I found and use regularly to find in addition to the header even good sample codes/examples is a program called Recoll (For Linux, Mac and Windows - or a similar desktop search engine)
Recoll is based on the very capable Xapian search engine library, for
which it provides a powerful text extraction layer and a complete, yet
easy to use, Qt graphical interface.
(https://www.lesbonscomptes.com/recoll/)
It works like that:
I put a selection of the best 50 books to a special topic in a folder (f.e. c++, c, qt - just stay really specific) and let recoll crawl the folder.
Now use keywords like EVP_PKEY to find every topic in all of your most loved and respected pdf c++ books in nano- to milliseconds - depending on how much money you spend on your pdf library. (Sure, you have to get/buy them first)
(But its a freaking fast tool and even prioritized due to the Xapian search engine library)

How do I retrieve the file Property metadata in Windows from within QT?

I couldn't find a good answer for this.
What is the code for looking at the metadata of an executable file, like Description and Company, or the API reference guide for doing such a thing?
I have looked through QFileInfo, but the code can only read and output the basic cross platform information like names, path, and times.
I dont think there is a Qt'ish way to do it, because such information is not really cross-platform. As it was mentioned in comments best way to use windows API for this.
I faced once similar problem when I had to handle all this information within cross-platform project. So goal was to keep all metadata available through cross-platform builds as well as showing it properly on Windows File Properties dialog. Most fast solution I was able to come up with is to define all this information via #define in one version.h, so it became to be available within software and reuse same defines in windows RC file which included version.h and was included itself in the .pro under win32 condition.

How to create a file with UNICODE path on Windows with C++

I am wondering which Win32 API call is creating the files with UNICODE path. Just to make sure, I am not talking about the content here only the file path. I would appreciate if somebody would hit me with an MSDN url, my google fu failed this time.
Thanks a million in advance.
See CreateFile msdn link: http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858%28v=vs.85%29.aspx, if you pass a unicode string to the lpFileName parameter then the unicode version of CreateFile will be used.
Also you need to open the file in binary mode see this discussion on msdn forum: http://social.msdn.microsoft.com/forums/en-US/vclanguage/thread/71fa98ca-e757-4099-8f7f-fefcfe645298 which points to this msdn article: http://msdn.microsoft.com/en-us/library/c4cy2b8e%28vs.71%29.aspx
The principal tag on this question is "c++" not "windows.
Now, unless that was just a all-too-common cheat to get a windows api question in front of a larger - mostly unrelated - audience, the answer should be slightly relevant to c++.
As such, in a C++ app, there are a number of std:: specializations that can take wchar_t. wofstream for example.

Taking an Input from a C++ Gui into another C++ program

I am currently developing a C++ program that does all the mathematical calculations, prints items to the screen that is scanned in by an RFID Reader, and allows the user to select a payment method. (Basically using RFID tags to replace barcodes)
I have started writing my C++ code for a keyboard entry and have no idea how to take an input from my RFID reader into my program. My RFID Reader is a DLP-RFID1 from it comes with some demo software and drivers. I got it working with windows 7 last week on the demo software(a GUI using Microsoft Visual Studio).
My question is can I take the input from my Demo GUI and some how use that as my input for my C++ program? If I can can some one push me in the right direction by links, pointers, reading material?
Also I have basic C++ experience. I am teaching myself how to program in C++ and right now only know print statements, while loops, switch/case, math functions, and etc.
That is a very specific question about hardware and software of that vendor an not really general knowledge. However, those types of devices, in my past experience with bar code readers and such, usually have a driver that comes with them which allows you to set them up as an actual keyboard (for example, you could even go into a text editor and capture the codes). If you can set them up like that, then reading them is nothing more than reading stdin. For example, cin >> stringVariable;
Assuming that you have demo software in C++:
The demo software should link against one or more libraries that comes with the demo, and include a header that declares the functions in the library. You have to (at minimum) include this header and link against that same library, and use those libraries. The demo will help you understand which functions you need to call and how.
As already said it is very dependent on how they want you to use it but some general guide lines.
Look for header file that came with their demo ( ends in ".h" or ".hpp")
you will need to #include that in your project at the very minimum
Look for a .lib file. you will need to link that to your file. With gcc you would type something like G++ -l[libname].
With MSVS there are two ways i know of. You will need to right click the project in the sidebar. Click something like options or preferences. Expand linker options. Add the library.
or you can type #pragma comment(lib, "filename.lib") in your file near your includes
If there is a .dll (windows) or .so(Linux) file you can dynamically link it. There are many ways to do this. Google search for C++ Dynamic link libraries should be some help. As a newbie try to stick with Static Linking first. that would be another good keyword to search for. The best tutorial on dynamic linking for windows i have found is actually in assembly. but its all Win32 function calls anyways so its not hard to understand. Icz DLL tutorial

Where are Windows Messages such as WM_LBUTTONDOWN, WM_COMMAND, and WM_CLOSE defined in the win32 C/C++ API?

I'm running through theForger's Win32 API Programming Tutorial. On page 4 he suggests it would be handy to find the list of #define statements in the API header files which list all the WM_* messages. I decided it probably would be worth my while to take a gander at them all, so I tried to find them, but was unsuccessful.
If anyone could just send the name of the appropriate file and possibly its location relative to "windows.h" my way, it would be much appreciated. I have been rummaging around in my compiler's "include" folder for quite a while now, and for the life of me I can't find it, so I figured before I go ahead and look at every single include file (there are 294 of them), I should ask you guys, since I'm sure someone knows already.
Thanks in advance.
Try winuser.h in the platform SDK include folder.