亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? gps.cpp

?? 這是從賽迪網共享出來的可以直接使用的 GBS lib
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
/*
Module : GPS.CPP
Purpose: "C" style Implementation to GPS32
Created: PJN / 28-12-1997
History: PJN / 20-01-1998  1.  A number of problems were discovered when GPSLIB was being
                               used in a UNICODE build. These problems have been fixed
                           2.  Mak file now includes all the possible build options
                           3.  Mak file no longer hard codes output to d:\winnt\system32
                           4.  Included release binaries in distribution
			   PJN / 26-08-1998  1.  Small change to stdafx.h to include afxcview.h in gps32exe
				                   2.  The GpsShowControlPanel function now actually works
													 3.  Minor tweaks to the GPS Mak files
													 4.  Removed a number of unused symbols
													 5.  Change ID of a number of GPS32EXE menu items to avoid conflict
													     with new VC 6 defines.
													 6.  Updated all Version Infos to 1.02
													 7.  Removed a level 4 warning from the Test app.
													 8.  Removed unused toolbar from GPS CPL file
													 9.  GPS cpl file now uses standard F2 accelerator for Rename
                           10. GPS32EXE toolbar is now shown flat
													 11. Number of extra TRACE statements have been added to 
													     aid in debugging.
         PJN / 11-08-1999  1.  Now uses the WINAPI calling convention meaning that GPSLIB is now
                               callable from VB.
                           2.  Now also ships a GPS.BAS file for use of GPSLIB in VB
         PJN / 27-09-2001  1.  Fixed a problem where the background serial port thread using causing
                           heavy CPU utilization.
                           2.  Updated the project settings so that all binaries get build to the Bin
                               directory and all Lib files get created in a Lib directory
                           3.  Updated the version info's in all the binaries
                           4.  Updated the copyright message in the code modules
         PJN / 21-08-2002  1.  Fixed a synchronisation problem between the worker thread and the 
                           GpsGetPosition method. Thanks to Bill Oatman for spotting this problem.



Copyright (c) 1997 - 2002 by PJ Naughter.  (Web: www.naughter.com, Email: pjna@naughter.com)

All rights reserved.

Copyright / Usage Details:

You are allowed to include the source code in any product (commercial, shareware, freeware or otherwise) 
when your product is released in binary form. You are allowed to modify the source code in any way you want 
except you cannot modify the copyright details at the top of each module. If you want to distribute source 
code with your application, then you are only allowed to distribute versions released by the author. This is 
to maintain a single distribution point for the source code. 

*/


/////////////////////////////////  Includes  //////////////////////////////////
#include "stdafx.h"
#include "gps.h"
#include "serport.h"
#include "resource.h"
#include "nmea.h"
#include "math.h"
#include "gpssetup.h"



//////////////////////////////////  Macros / Defines //////////////////////////
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#define new DEBUG_NEW
#endif


////////////////////////////////// Locals /////////////////////////////////////
class GPSHandle
{
public:
  GPSHandle();
  ~GPSHandle();

  GPSPOSITION      m_Position;    //the actual data
  CEvent*          m_pKillEvent;  //Event to signal thread to exit
  CEvent*          m_pStartEvent; //Is the background thread running
  GPSDEVINFO       m_DevInfo;     //Settings of the comms port to use
  BOOL             m_bRunning;    //Is the background thread running
  CWinThread*      m_pThread;     //The pointer to the background thread
  CCriticalSection m_csPosition;  //Critical section used to serialized access to m_Position
};


BOOL GetGpsDevice(DWORD dwDevice, LPGPSDEVINFO lpGpsDevInfo);
BOOL SetGpsDevice(DWORD dwDevice, LPCGPSDEVINFO lpGpsDevInfo, BOOL bCheckDefault = TRUE);
BOOL SetGpsNumDevices(DWORD dwDevices);
UINT GpsMonitorThead(LPVOID pParam);


////////////////////////////////// Implementation /////////////////////////////

GPSHandle::GPSHandle()
{
  ZeroMemory(&m_Position, sizeof(GPSPOSITION));
  m_pKillEvent = new CEvent(FALSE, TRUE);
  m_pStartEvent = new CEvent(FALSE, TRUE);
  m_pThread = NULL;
}


GPSHandle::~GPSHandle()
{
  delete m_pStartEvent;
  m_pStartEvent = NULL;

  delete m_pKillEvent;
  m_pKillEvent = NULL;
} 


BOOL GetGpsDevice(DWORD dwDevice, LPGPSDEVINFO lpGpsDevInfo)
{
  BOOL bSuccess = FALSE;
  HKEY hKey;

  CString sValueKey;
  sValueKey.Format(_T("SOFTWARE\\PJ Naughter\\GPS32\\%d"), dwDevice);

  LONG nError = RegOpenKeyEx(HKEY_LOCAL_MACHINE, sValueKey, 0, KEY_ALL_ACCESS, &hKey);
  if (nError == ERROR_SUCCESS) 
  {
    DWORD dwType;
    DWORD dwSize;

    RegQueryValueEx(hKey, _T("DeviceName"), 0, &dwType, NULL, &dwSize);
    TCHAR* pszName = new TCHAR[dwSize / sizeof(TCHAR)];
    RegQueryValueEx(hKey, _T("DeviceName"), 0, &dwType, (LPBYTE) pszName, &dwSize);
    _tcscpy(lpGpsDevInfo->szDeviceName, pszName);
    delete [] pszName;

    RegQueryValueEx(hKey, _T("DefaultReceiver"), 0, &dwType, (LPBYTE) &lpGpsDevInfo->bDefaultReceiver, &dwSize);

    RegQueryValueEx(hKey, _T("Port"), 0, &dwType, (LPBYTE) &lpGpsDevInfo->wCommPort, &dwSize);

    RegQueryValueEx(hKey, _T("BaudRate"), 0, &dwType, (LPBYTE) &lpGpsDevInfo->dwCommBaudRate, &dwSize);

    RegQueryValueEx(hKey, _T("DataBits"), 0, &dwType, (LPBYTE) &lpGpsDevInfo->wCommDataBits, &dwSize);

    RegQueryValueEx(hKey, _T("StopBits"), 0, &dwType, (LPBYTE) &lpGpsDevInfo->wCommStopBits, &dwSize);

    bSuccess = TRUE;

    RegCloseKey(hKey);
  }
	else
	{
	  TRACE(_T("GetGpsDevice, Failed to open a registry key, Error was: %d\n"), nError);
	}

  return bSuccess;
}


BOOL GpsSetNumDevices(DWORD dwDevices)
{
  BOOL bSuccess = FALSE;
  HKEY hKey;
  DWORD dwDisposition;

  LONG nError = RegCreateKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\PJ Naughter\\GPS32"), 0, _T(""),
                               REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dwDisposition);
  if (nError == ERROR_SUCCESS) 
  {
    RegSetValueEx(hKey, _T("NumberOfDevices"), 0, REG_DWORD, (CONST BYTE*) &dwDevices, sizeof(DWORD));
    
    RegCloseKey(hKey);

    bSuccess = TRUE;
  }
	else
	{
    TRACE(_T("GpsSetNumDevices, Failed in call to create a registry key, Error was: %d\n"), nError);
	}

  return bSuccess;
}


BOOL SetGpsDevice(DWORD dwDevice, LPCGPSDEVINFO lpDevice, BOOL bCheckDefault)
{
  //Fix up the case where we have just made this device 
  //the default by removing the default flag from all 
  //other devices
  if (bCheckDefault && lpDevice->bDefaultReceiver)
  {
    //make all other devices non default
    for (DWORD i=0; i<GpsGetNumDevices(); i++)
    {
      GPSDEVINFO devInfo;
      GetGpsDevice(i, &devInfo);
      devInfo.bDefaultReceiver = FALSE; 
      SetGpsDevice(i, &devInfo, FALSE);
    }
  }

  BOOL bSuccess = FALSE;
  HKEY hKey;
  DWORD dwDisposition;
  CString sValueKey;
  sValueKey.Format(_T("SOFTWARE\\PJ Naughter\\GPS32\\%d"), dwDevice);
	LONG nError = RegCreateKeyEx(HKEY_LOCAL_MACHINE, sValueKey, 0, _T(""), REG_OPTION_NON_VOLATILE,
                               KEY_ALL_ACCESS, NULL, &hKey, &dwDisposition);
  if (nError == ERROR_SUCCESS) 
  {
    RegSetValueEx(hKey, _T("DeviceName"), 0, REG_SZ, (CONST BYTE*) lpDevice->szDeviceName, _tcslen(lpDevice->szDeviceName));

    RegSetValueEx(hKey, _T("DefaultReceiver"), 0, REG_DWORD, (CONST BYTE*) &lpDevice->bDefaultReceiver, sizeof(BOOL));

    DWORD dwData = lpDevice->wCommPort;
    RegSetValueEx(hKey, _T("Port"), 0, REG_DWORD, (CONST BYTE*) &dwData, sizeof(DWORD));

    RegSetValueEx(hKey, _T("BaudRate"), 0, REG_DWORD, (CONST BYTE*) &lpDevice->dwCommBaudRate, sizeof(DWORD));

    dwData = lpDevice->wCommDataBits;
    RegSetValueEx(hKey, _T("DataBits"), 0, REG_DWORD, (CONST BYTE*) &dwData, sizeof(DWORD));

    dwData = lpDevice->wCommStopBits;
    RegSetValueEx(hKey, _T("StopBits"), 0, REG_DWORD, (CONST BYTE*) &dwData, sizeof(DWORD));

    RegCloseKey(hKey);

    bSuccess = TRUE;
  }
	else
	{
    TRACE(_T("SetGPSDevice, Failed in call to create a registry key, Error was: %d\n"), nError);
	}

  //make sure that at least one device is default
  if (bCheckDefault && !lpDevice->bDefaultReceiver)
  {
    DWORD dwDevices = GpsGetNumDevices();
    GPSDEVINFO* pGpsDevInfo = new GPSDEVINFO[dwDevices];
    dwDevices = GpsEnumDevices(pGpsDevInfo, dwDevices);
    BOOL bFound = FALSE;
    for (DWORD i=0; i<dwDevices && !bFound; i++)
    {
      if (pGpsDevInfo[i].bDefaultReceiver)
        bFound = TRUE;
    }
    delete [] pGpsDevInfo;

    if (!bFound)
    {
      TRACE(_T("SetGpsDevice, Found no device with default receiver attribute\n"));
      TRACE(_T("  making first device the default\n"));

      GPSDEVINFO devInfo;
      GetGpsDevice(0, &devInfo);
      devInfo.bDefaultReceiver = TRUE; 
      SetGpsDevice(0, &devInfo, FALSE);
    }
  }

  return bSuccess;
}


BOOL WINAPI GpsSetDevice(LPCTSTR lpszEntry, LPCGPSDEVINFO lpGpsDevInfo)
{
  //Find the device with the corresponding entry name
  DWORD dwDevices = GpsGetNumDevices();
  GPSDEVINFO* pGpsDevInfo = new GPSDEVINFO[dwDevices];
  dwDevices = GpsEnumDevices(pGpsDevInfo, dwDevices);
  BOOL bFound = FALSE;
  for (DWORD i=0; i<dwDevices && !bFound; i++)
  {
    if (_tcsicmp(lpszEntry, pGpsDevInfo[i].szDeviceName) == 0)
      bFound = TRUE;
  }
  delete [] pGpsDevInfo;

  if (!bFound)
  {
    TRACE(_T("GpsSetDevice, Failed to find GpsEntry for %s\n"), lpszEntry);
    return FALSE;
  }

  return SetGpsDevice(i-1, lpGpsDevInfo);
}


BOOL WINAPI GpsShowControlPanel()
{
#ifdef _DEBUG
  #ifdef _UNICODE
  	UINT nExec = ::WinExec("GPS103UD.EXE", SW_SHOW);
  #else
		UINT nExec = ::WinExec("GPS103D.EXE", SW_SHOW);
  #endif
#else
  #ifdef _UNICODE
  	UINT nExec = ::WinExec("GPS103U.EXE", SW_SHOW);
  #else
		UINT nExec = ::WinExec("GPS103.EXE", SW_SHOW);
	#endif
#endif
  if (nExec <= 31)
	  TRACE(_T("GpsShowControlPanel, Failed in call to WinExec GPS executable, WinExec returns: %d"), nExec);
  
	return (nExec > 31);
}


BOOL WINAPI GpsCreateEntry(HWND hWnd)
{
  BOOL bSuccess = FALSE;

  CWnd* pParent = CWnd::FromHandle(hWnd);

	CInstallPropertySheet propSheet(IDS_GPS_SETUP, pParent);
  propSheet.m_psh.dwFlags |= PSH_NOAPPLYNOW;
	int nResponse = propSheet.DoModal();

  if (nResponse == ID_WIZFINISH)
  {
    DWORD dwDevices = GpsGetNumDevices();

    GPSDEVINFO GpsInfo;
    _tcscpy(GpsInfo.szDeviceName, propSheet.m_Page3.m_sName); 
    GpsInfo.bDefaultReceiver = (propSheet.m_Page3.m_nMakeDefault == 0);
    GpsInfo.wCommPort = (WORD) propSheet.m_Page2.m_dwPort;
    GpsInfo.dwCommBaudRate = propSheet.m_Page2.m_dwBaudRate;
    GpsInfo.wCommDataBits = 8; 
    GpsInfo.wCommParity = GpsParityNone;
    GpsInfo.wCommStopBits = GpsStopBits1;

    bSuccess = SetGpsDevice(dwDevices, &GpsInfo);

    //increment the number of devices parameter
    GpsSetNumDevices(dwDevices + 1);
  }

  return bSuccess;
}


DWORD WINAPI GpsGetNumDevices()
{
  DWORD dwDevices = 0;
  DWORD dwType;
  DWORD dwSize = sizeof(DWORD);
  HKEY hKey;

  LONG nError = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\PJ Naughter\\GPS32"),
                             0, KEY_ALL_ACCESS, &hKey);
  if (nError == ERROR_SUCCESS) 
  {
    RegQueryValueEx(hKey, _T("NumberOfDevices"), 0, &dwType, (LPBYTE) &dwDevices, &dwSize);
    RegCloseKey(hKey);
  }
	else
	{
    TRACE(_T("GpsGetNumDevices, Failed in call to open the registry, Error was: %d\n"), nError);
	}


  return dwDevices;
}


DWORD WINAPI GpsEnumDevices(LPGPSDEVINFO lpRasDevInfo, DWORD dwRequestedDevices)
{
  DWORD dwDevicesToRetreive = min(GpsGetNumDevices(), dwRequestedDevices);

  for (DWORD i=0; i<dwDevicesToRetreive; i++)
    GetGpsDevice(i, &lpRasDevInfo[i]);

  return dwDevicesToRetreive;
}


BOOL WINAPI GpsDeleteEntry(LPCTSTR lpszEntry)
{
  //Find the device with the corresponding entry name
  DWORD dwDevices = GpsGetNumDevices();
  GPSDEVINFO* pGpsDevInfo = new GPSDEVINFO[dwDevices];
  dwDevices = GpsEnumDevices(pGpsDevInfo, dwDevices);
  BOOL bFound = FALSE;
  for (DWORD i=0; i<dwDevices && !bFound; i++)
  {
    if (_tcsicmp(lpszEntry, pGpsDevInfo[i].szDeviceName) == 0)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
人人精品人人爱| 中文字幕一区三区| 蜜桃精品在线观看| 日韩视频一区二区在线观看| 免费三级欧美电影| 国产日韩av一区二区| 成人小视频免费在线观看| 国产精品二三区| 91福利区一区二区三区| 日韩1区2区3区| 久久久噜噜噜久噜久久综合| 波多野结衣在线一区| 尤物av一区二区| 日韩欧美一二三四区| 国产99精品在线观看| 亚洲综合清纯丝袜自拍| 亚洲精品一区二区三区在线观看| 盗摄精品av一区二区三区| 亚洲影视在线播放| 精品国产一区二区三区av性色| 国产成人免费9x9x人网站视频| 亚洲欧洲日韩av| 欧美精品vⅰdeose4hd| 国产露脸91国语对白| 樱桃国产成人精品视频| 欧美xxxxxxxxx| 91福利社在线观看| 国产专区欧美精品| 一级精品视频在线观看宜春院| 日韩欧美中文一区二区| 成人黄色免费短视频| 日韩精品一二区| 国产欧美综合在线| 欧美一级国产精品| 91免费版在线| 精品一区二区三区免费播放| 亚洲免费观看高清完整版在线| 日韩免费观看高清完整版| 97精品久久久午夜一区二区三区| 奇米影视一区二区三区小说| ...中文天堂在线一区| 精品国产乱码久久久久久老虎| 日本精品免费观看高清观看| 国产精品亚洲一区二区三区在线| 亚洲韩国精品一区| 国产精品美女久久久久久久久| 欧美一区二区三区视频免费 | 一区二区三区电影在线播| 日韩欧美国产系列| 欧美系列日韩一区| www.久久久久久久久| 极品少妇一区二区| 日韩av一区二| 亚洲国产视频a| 亚洲视频一区二区免费在线观看| 26uuu亚洲| 欧美一区二区三区播放老司机| 色香蕉久久蜜桃| av在线一区二区三区| 国产一区二区三区综合| 蜜臀av一区二区三区| 天堂久久一区二区三区| 亚洲一卡二卡三卡四卡| 亚洲人123区| 综合久久国产九一剧情麻豆| 欧美国产综合一区二区| 日本网站在线观看一区二区三区| 一区二区三区日本| 一区二区三区四区高清精品免费观看 | 日韩激情一二三区| 亚洲最新视频在线观看| 亚洲女同女同女同女同女同69| 国产女主播视频一区二区| 精品久久久久久久一区二区蜜臀| 欧美一级日韩免费不卡| 91精品国产一区二区三区香蕉| 欧美日韩一区二区三区高清| 91论坛在线播放| 色又黄又爽网站www久久| 丁香网亚洲国际| 成人免费视频免费观看| 99久久精品免费精品国产| a在线欧美一区| 91久久一区二区| 精品视频一区二区三区免费| 欧美色倩网站大全免费| 在线成人午夜影院| 欧美一区二区黄色| 精品国产麻豆免费人成网站| 久久天堂av综合合色蜜桃网| 国产农村妇女毛片精品久久麻豆| 国产女主播一区| 综合婷婷亚洲小说| 亚洲最大成人网4388xx| 亚洲18女电影在线观看| 美美哒免费高清在线观看视频一区二区 | 亚洲欧洲99久久| 亚洲女子a中天字幕| 亚洲高清不卡在线| 秋霞午夜鲁丝一区二区老狼| 国产一本一道久久香蕉| 91视频.com| 91精品国产一区二区人妖| 26uuu亚洲综合色| 亚洲欧美日本在线| 日韩国产欧美三级| 国产真实精品久久二三区| 91小视频在线免费看| 91精品国产综合久久婷婷香蕉 | 欧美性大战久久| 精品不卡在线视频| 亚洲欧美一区二区久久| 日韩精品亚洲一区| 99亚偷拍自图区亚洲| 欧美日韩日日摸| 精品国产乱码久久久久久浪潮| 最新日韩av在线| 六月婷婷色综合| 91色九色蝌蚪| www国产精品av| 亚洲一区二区在线视频| 国产一区二区成人久久免费影院 | 欧美精品在线观看播放| 久久蜜桃av一区二区天堂| 亚洲一区欧美一区| 国产成人自拍网| 欧美老年两性高潮| 国产精品久久久久久户外露出| 日一区二区三区| 97se亚洲国产综合自在线| 欧美mv日韩mv国产| 亚洲电影中文字幕在线观看| 国产白丝精品91爽爽久久| 欧美一区二区视频在线观看| 一区精品在线播放| 国产精品原创巨作av| 欧美疯狂做受xxxx富婆| 亚洲欧洲精品一区二区三区不卡| 捆绑调教美女网站视频一区| 欧美自拍偷拍午夜视频| 国产精品国产三级国产有无不卡 | 国产精品乱码久久久久久| 日韩成人精品在线| 欧美亚洲精品一区| 中文字幕乱码久久午夜不卡| 麻豆中文一区二区| 51精品秘密在线观看| 亚洲精品免费看| 99精品视频一区| 亚洲国产高清不卡| 国产一区二区福利| 26uuu精品一区二区三区四区在线| 亚洲一区二区三区在线看| 91免费观看在线| 专区另类欧美日韩| av电影在线观看完整版一区二区| 久久久蜜桃精品| 国产麻豆视频精品| 国产亚洲女人久久久久毛片| 国产一区二区看久久| 久久综合一区二区| 国内精品伊人久久久久av一坑| 日韩美一区二区三区| 乱一区二区av| 久久综合给合久久狠狠狠97色69| 美女诱惑一区二区| 欧美一级欧美三级在线观看| 日本免费在线视频不卡一不卡二| 欧美日韩高清影院| 日av在线不卡| 久久丝袜美腿综合| 成人午夜精品在线| 亚洲美女免费视频| 欧美猛男男办公室激情| 日韩精品一区第一页| 欧美大白屁股肥臀xxxxxx| 蜜桃av一区二区| 久久久三级国产网站| www.久久精品| 亚洲综合在线视频| 欧美电影一区二区| 另类小说欧美激情| 久久久亚洲午夜电影| 成人av动漫网站| 亚洲一区欧美一区| 欧美xingq一区二区| 福利视频网站一区二区三区| 中文字幕在线视频一区| 欧美色网一区二区| 免费高清在线一区| 国产欧美精品一区二区三区四区| 91污片在线观看| 五月婷婷综合网| 久久人人爽人人爽| 9色porny自拍视频一区二区| 亚洲成人av福利| 精品国产露脸精彩对白| 成人avav影音| 水蜜桃久久夜色精品一区的特点| 欧美mv日韩mv亚洲|