I need to use the Windows Event Log functionality. To access the function of this API, you need to add dll to the project. I added the following to the .pro file:
LIBS += -lws2_32 \ c:/windows/System32/wevtapi.dll \ c:/Windows/System32/kernel32.dll \ Then, just in case, added wevtapi.h and #pragma comment(lib, "Wevtapi.lib") wherever necessary.
But MinGW does not see the functions and types in the focus:
EvtOpenChannelEnum EvtNextChannelPath PEVT_VARIANT Gives an error message
'EvtOpenChannelEnum' hChannels = EvtOpenChannelEnum (NULL, 0);
What am I doing wrong?
code:
#include <QCoreApplication> #include <windows.h> #include <sddl.h> #include <stdio.h> #include <winevt.h> #include <QCoreApplication> #include <winsock2.h> #include <windows.h> #include <sddl.h> #include <stdio.h> #include <winevt.h> #include <iostream> #include <string> #include <vector> #pragma comment(lib, "Wevtapi.lib") int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); EVT_HANDLE hChannels = NULL; hChannels = EvtOpenChannelEnum(NULL, 0); return a.exec(); } .pro
QT += core QT -= gui LIBS += -lws2_32 \ c:/windows/System32/wevtapi.dll \ c:/Windows/System32/kernel32.dll \ c:/Windows/System32/shlwapi.dll LIBS += -lws2_32 -lkernel32 -lwevtapi -lshlwapi CONFIG += c++11 TARGET = untitled7 CONFIG += console CONFIG -= app_bundle TEMPLATE = app SOURCES += main.cpp
LIBS += -lkernel32 -lwevtapi- user194374#include <WinEvt.h>. - user194374WinEvt.h. 2) In this case, we need a minimal compiled example. - user194374