开发者

Using mmsystem.h in VisualStudio 2008

开发者 https://www.devze.com 2023-02-20 22:46 出处:网络
I\'m trying do create a 64bit dll which sets a global hook. As I read it can\'t be done with CLR (I even tried), so I created a Win32 project and I will build it for 64bit platform.

I'm trying do create a 64bit dll which sets a global hook. As I read it can't be done with CLR (I even tried), so I created a Win32 project and I will build it for 64bit platform. Will it work this way?

My main question is how to use mmsystem.h in this project. I need to use multimedia timer and when I use timeBeginPeriod or timeSetEvent I have a linker error:

1>dll64.obj : error LNK2019: unresolved external symbol __imp__timeSetEvent@20 referenced in function _InstallHook1@0

1>dll64.开发者_开发问答obj : error LNK2019: unresolved external symbol __imp__timeBeginPeriod@4 referenced in function _InstallHook1@0

How to fix this?


You have to link with winmm.lib, it isn't one of the default libraries that gets linked. A simple way is to put the link instruction in your source code:

#include <windows.h>
#include <mmsystem.h>
#pragma comment(lib, "winmm.lib")
0

精彩评论

暂无评论...
验证码 换一张
取 消