Check if application was started from within Visual Studio debug session

前端 未结 3 1912
眼角桃花
眼角桃花 2020-12-03 02:20

I am working on an application that installs a system wide keyboard hook. I do not want to install this hook when I am running a debug build from inside the visual studio (o

3条回答
  •  情话喂你
    2020-12-03 03:08

    For those working with Windows API, there's a function which allows you to see if any debugger is present using:

    if( IsDebuggerPresent() )
    {
        ...
    }
    

    Reference: http://msdn.microsoft.com/en-us/library/ms680345.aspx

提交回复
热议问题