?? gps.cpp
字號:
// GPS.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "GPS.h"
#include <windows.h>
#include <commctrl.h>
#include <Gpsapi.h>
#define MAX_LOADSTRING 100
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
HANDLE hNewLocationData = CreateEvent(NULL, FALSE, FALSE, NULL);
HANDLE hDeviceStateChange = CreateEvent(NULL, FALSE, FALSE, NULL);
HANDLE hGPSDevice = ::GPSOpenDevice(hNewLocationData, hDeviceStateChange, NULL, NULL);
if (!hGPSDevice)
return 0;
static const int GPS_CONTROLLER_EVENT_COUNT = 2;
HANDLE gpsHandles[GPS_CONTROLLER_EVENT_COUNT] =
{ hNewLocationData, hDeviceStateChange };
GPS_POSITION gpsPosition = { 0 };
gpsPosition.dwSize = sizeof(GPS_POSITION);
gpsPosition.dwVersion = GPS_VERSION_1;
GPS_DEVICE gpsDev = { 0 };
gpsDev.dwSize = sizeof(GPS_DEVICE);
gpsDev.dwVersion = GPS_VERSION_1;
DWORD dwRet;
do {
dwRet = WaitForMultipleObjects(GPS_CONTROLLER_EVENT_COUNT, gpsHandles, FALSE, INFINITE);
if (dwRet == WAIT_OBJECT_0) {
dwRet = GPSGetPosition(hGPSDevice, &gpsPosition, 3000, 0);
if (ERROR_SUCCESS != dwRet)
continue;
}
else
if (dwRet == WAIT_OBJECT_0 + 1) {
dwRet = GPSGetDeviceState(&gpsDev);
if (ERROR_SUCCESS != dwRet)
continue;
}
} while (1);
::GPSCloseDevice(hGPSDevice);
hGPSDevice = NULL;
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -