📄 bt.cpp
字号:
// BT.cpp : 定义应用程序的入口点。
//
#include "stdafx.h"
#include "BT.h"
#include <bthutil.h>
#include <string.h>
#include <wchar.h>
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
LONG lRet;
HKEY hkey;
DWORD dwModeC;
DWORD dwModeL;
DWORD dwSize;
TCHAR *strParm1;
TCHAR *strParm2;
dwSize = sizeof(DWORD);
if (BthGetMode(&dwModeC) == ERROR_SUCCESS)
{
lRet = RegCreateKeyEx(HKEY_CURRENT_USER,_T("MY\\BT"),NULL,NULL,NULL,KEY_ALL_ACCESS,NULL,&hkey,NULL);
if (lRet == ERROR_SUCCESS)
{
lRet = RegQueryValueEx(hkey, _T("LastStauts"), 0, NULL, (LPBYTE)&dwModeL, &dwSize);
if (lRet != ERROR_SUCCESS)
dwModeL = dwModeC;
RegSetValueEx(hkey, _T("LastStauts"), 0, REG_DWORD, (LPBYTE)& dwModeC,dwSize);
RegCloseKey(hkey);
}
strParm1 = _tcstok(lpCmdLine,_T(" "));
strParm2 = _tcstok(NULL,_T(" "));
if (strParm1 == NULL || _tcscmp(strParm1, _T("3")) == 0)
{
if (dwModeC != BTH_POWER_OFF)
dwModeC = BTH_POWER_OFF;
else
{
if (strParm2 != NULL)
dwModeC = BTH_DISCOVERABLE;
else
dwModeC = BTH_CONNECTABLE;
}
}
else if (_tcscmp(strParm1, _T("0")) == 0)
dwModeC = BTH_POWER_OFF;
else if (_tcscmp(strParm1, _T("1")) == 0)
{
if (strParm2 != NULL)
dwModeC = BTH_DISCOVERABLE;
else
dwModeC = BTH_CONNECTABLE;
}
else if (_tcscmp(strParm1, _T("2")) == 0)
{
dwModeC = dwModeL;
}
BthSetMode(dwModeC);
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -