English 中文(简体)
msi.h 给 dll 中的编译错误
原标题:msi.h gives compilation error in dll

我最近才开始与 DLLS 合作。 虽然我已经在 Linux 上做了一些严重的 C++ 程序, 并且知道 DLLS 是什么 。 我需要使用自定义动作编码一个窗口安装器 。 为此我在2010年视觉工作室新建了一个 DLL 项目 。 当我试图将 msi.h 包含在 StdAfx.h 文件里时, 我就会发现错误 :

1>------ Build started: Project: CustomAction, Configuration: Debug Win32 ------
1>  DllEntry.cpp
1>c:program files (x86)microsoft sdkswindowsv7.0aincludemsi.h(86): error C2146: syntax error : missing  ;  before identifier  WINAPI 
1>c:program files (x86)microsoft sdkswindowsv7.0aincludemsi.h(86): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:program files (x86)microsoft sdkswindowsv7.0aincludemsi.h(86): error C2146: syntax error : missing  ;  before identifier  MsiCloseHandle 
1>c:program files (x86)microsoft sdkswindowsv7.0aincludemsi.h(86): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
......................

此工程除了 StdAfx. cpp 外, 没有任何其它东西, 其中包括 StdAfx 信头和 StdAfx.h 文件, 即 :

#include   <msi.h>
#include   <msiquery.h>
#include   <stdio.h>

I tried adding path to the msi.lib in the linker input properties of the project. It didn t work. I also tried adding path to the lib folder, include folder and bin folder of the windows sdk directory, that also didn t work. What is the cause for this and also if anyone can give me pointers to any tutorial to using custom actions with windows installers as I am a newbie in this area.

最佳回答

看起来 取决于 WINAPI 宏。 因此,你可能需要先包括 :

#include <windows.h>
#include <msi.h>

在 DLLS 工作时头文件没有什么特别之处。 头文件的工作方式与您已经习惯的工作方式相同 。

问题回答

暂无回答




相关问题
Why running a service as Local System is bad on windows?

I am trying to find out the difference between difference service account types. I tumbled upon this question. The answer was because it has powerful access to local resources, and Network Service ...

Programmatically detect Windows cluster configuration?

Does anyone know how to programatically detect that a Windows server is part of a cluster? Further, is it possible to detect that the server is the active or passive node? [Edit] And detect it from ...

get file icon for Outlook appointment (.msg)

I ve read Get File Icon used by Shell and the other similar posts - and already use SHFileInfo to get the associated icon for any given extension, and that works great. However, Outlook uses ".msg" ...

Identifying idle state on a windows machine

I know about the GetLastInputInfo method but that would only give me the duration since last user input - keyboard or mouse. If a user input was last received 10 minutes ago, that wouldn t mean the ...

Terminating a thread gracefully not using TerminateThread()

My application creates a thread and that runs in the background all the time. I can only terminate the thread manually, not from within the thread callback function. At the moment I am using ...

热门标签