引用GUID [英] Referencing GUIDs

查看:78
本文介绍了引用GUID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试捕获一个事件并引用一个GUID以查看它是哪个事件.代码如下:

I'm trying to capture an event and reference a GUID to see which event it is. The code is below:

DWORD WINAPI AvisionEventProc(LPVOID lpParam){
    //HANDLE hEvent = * (HANDLE *) lpParam;   // This thread's read event
    STINOTIFY pStiNotify;

    if (debug){
        wprintf(L"Avision Event\n");
    }
    while(true){
        WaitForSingleObject(hAvisionEvent, INFINITE);
        wprintf(L"Event");
        pStiDevice->GetLastNotificationData(&pStiNotify);
        if (pStiNotify.guidNotificationCode == GUID_STIUserDefined1){
            wprintf(L"User defined 1");
        }else if (pStiNotify.guidNotificationCode == GUID_STIUserDefined2){
            wprintf(L"User defined 2");
        }else if (pStiNotify.guidNotificationCode == GUID_STIUserDefined3){
            wprintf(L"User defined 3");
        }

        ResetEvent(hAvisionEvent);
    }
    return 1;
}

这可以正常编译,但是链接时出现以下错误:

This compiles just fine but I get the errors below when linking:

1>sti.obj : error LNK2001: unresolved external symbol _GUID_STIUserDefined3
1>sti.obj : error LNK2001: unresolved external symbol _GUID_STIUserDefined2
1>sti.obj : error LNK2001: unresolved external symbol _GUID_STIUserDefined1

奇怪的是,当我从中提取其他常量时,sti.h被链接了.我确实注意到GUID清除了以下内容:

The strange thing is that sti.h is linked in as I am pulling other constants from it. I did notice by the GUID decleration the following:

#if defined( _WIN32 ) && !defined( _NO_COM)

/*
 * Class IID's
 */

// B323F8E0-2E68-11D0-90EA-00AA0060F86C
DEFINE_GUID(CLSID_Sti, 0xB323F8E0L, 0x2E68, 0x11D0, 0x90, 0xEA, 0x00, 0xAA, 0x00, 0x60, 0xF8, 0x6C);

/*
 * Interface IID's
 */

// {641BD880-2DC8-11D0-90EA-00AA0060F86C}
DEFINE_GUID(IID_IStillImageW, 0x641BD880L, 0x2DC8, 0x11D0, 0x90, 0xEA, 0x00, 0xAA, 0x00, 0x60, 0xF8, 0x6C);

<snip>

/*
 * Standard event GUIDs
 */

// {740D9EE6-70F1-11d1-AD10-00A02438AD48}
DEFINE_GUID(GUID_DeviceArrivedLaunch, 0x740d9ee6, 0x70f1, 0x11d1, 0xad, 0x10, 0x0, 0xa0, 0x24, 0x38, 0xad, 0x48);

<snip>

#endif

如果已定义"行会停止被引用的GUID(我正在编写Win32控制台应用程序),还是由于我对GUID缺乏理解而在这里犯了更根本的错误?

Does the "if defined" line stop the GUIDs being referenced (I am writing a win32 console app) or is there something more fundamental I have wrong here to do with a lack of understanding on GUIDs?

谢谢您的帮助.

干杯

尼尔

推荐答案

#include <initguid.h>应该被添加.那会有所帮助.

#include <initguid.h>should be added. That will help.

这篇关于引用GUID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆