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

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

?? gps.cpp

?? GPS !do you want to download?
?? 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| 国产真实乱对白精彩久久| 日韩一级完整毛片| 这里只有精品免费| 欧美精品一区二区高清在线观看| 日本欧美一区二区在线观看| 九色porny丨国产精品| 狠狠色丁香九九婷婷综合五月| 国产呦精品一区二区三区网站| 国产传媒日韩欧美成人| 综合av第一页| 美国精品在线观看| 丰满放荡岳乱妇91ww| 欧美日韩国产三级| 久久久久久亚洲综合| 一区二区三区在线观看欧美| 美女网站视频久久| 亚洲国产成人va在线观看天堂| 国产一区二区三区国产| 欧洲色大大久久| 欧美激情自拍偷拍| 日本不卡一区二区三区| 91精品福利在线| 国产精品看片你懂得| 国产一区二区三区在线观看免费| av在线播放一区二区三区| 视频一区中文字幕国产| 视频在线观看一区二区三区| 国产一区激情在线| 在线观看av不卡| wwww国产精品欧美| 色94色欧美sute亚洲线路一ni| 成人国产视频在线观看| 久久综合一区二区| 看国产成人h片视频| 日韩欧美一区电影| 午夜精品久久久久久久| 欧美日韩免费一区二区三区视频| 亚洲欧美视频一区| 欧美性感一区二区三区| 亚洲mv在线观看| 日韩亚洲电影在线| 久久99精品国产.久久久久| 美腿丝袜在线亚洲一区| 精品国产区一区| 成人精品电影在线观看| 欧美又粗又大又爽| 三级久久三级久久久| 欧美zozozo| 91在线看国产| 蜜臀av一区二区三区| 国产午夜精品久久久久久久| 色噜噜狠狠成人中文综合| 性欧美疯狂xxxxbbbb| 欧美成人精品3d动漫h| 国产成人在线视频免费播放| 伊人色综合久久天天人手人婷| 在线观看日韩精品| 久久不见久久见免费视频7| 亚洲国产精华液网站w| 在线观看91视频| www.久久精品| 久久精品国产网站| 亚洲国产精品久久艾草纯爱 | 亚洲欧美综合在线精品| 欧美日本国产视频| 国产成人啪午夜精品网站男同| 亚洲午夜私人影院| 国产天堂亚洲国产碰碰| 欧美顶级少妇做爰| 在线亚洲高清视频| 91老师国产黑色丝袜在线| 国产精品一区二区你懂的| 蜜桃视频在线观看一区二区| 亚洲福利一二三区| 亚洲午夜精品网| 一区二区三区久久| 亚洲欧美日韩中文播放| 亚洲欧美日韩国产另类专区| 18欧美亚洲精品| 中文字幕在线一区| 亚洲色欲色欲www| 亚洲视频免费在线观看| 一区二区三区av电影| 伊人开心综合网| 亚洲一级片在线观看| 午夜精品福利在线| 韩国理伦片一区二区三区在线播放| 日本不卡一区二区三区高清视频| 丝袜诱惑制服诱惑色一区在线观看 | 亚洲欧美日韩人成在线播放| 亚洲与欧洲av电影| 午夜精品国产更新| 国产精品一区二区久激情瑜伽| 精品国产乱码久久久久久图片 | 国产精品自在在线| 中文字幕五月欧美| 天堂成人免费av电影一区| 久久91精品国产91久久小草| jlzzjlzz亚洲女人18| 久久综合九色综合97_久久久| 欧美经典一区二区| 亚洲一区二区精品视频| 国产福利一区二区三区| 欧美做爰猛烈大尺度电影无法无天| 欧美精品色一区二区三区| 久久久精品欧美丰满| 亚洲国产裸拍裸体视频在线观看乱了| 777色狠狠一区二区三区| 精品国产乱码久久久久久免费 | 国产美女娇喘av呻吟久久 | 中文字幕av一区二区三区 | 中文字幕在线观看一区| 香蕉久久一区二区不卡无毒影院| 国产麻豆成人精品| 欧美va亚洲va香蕉在线| 日韩综合在线视频| 欧美性猛交xxxxxxxx| 亚洲素人一区二区| 国产精品久久久久毛片软件| 韩国精品久久久| 久久亚洲精品小早川怜子| 奇米精品一区二区三区四区 | 亚洲六月丁香色婷婷综合久久 | av不卡在线播放| 国产精品国产三级国产三级人妇 | 国产欧美日韩亚州综合 | 成人午夜激情视频| 中文字幕免费不卡在线| 奇米影视一区二区三区小说| 洋洋av久久久久久久一区| 欧美丝袜丝交足nylons| 亚洲国产成人av好男人在线观看| 欧美日韩一区二区三区高清| 亚洲成人av一区| 91精品国产综合久久精品麻豆 | 欧美一区在线视频| 久久91精品国产91久久小草 | 中文字幕一区二区三区视频| av午夜精品一区二区三区| 亚洲国产精品久久一线不卡| 91超碰这里只有精品国产| 国产一区二区三区香蕉| 亚洲视频你懂的| 日韩一区二区三区免费观看| 国产精品一区二区视频| 亚洲精品国产一区二区精华液| 6080yy午夜一二三区久久| 本田岬高潮一区二区三区| 无吗不卡中文字幕| 18欧美亚洲精品| 精品国产污污免费网站入口 | 成人黄色片在线观看| 亚洲 欧美综合在线网络| 国产欧美日韩另类一区| 欧美日韩国产乱码电影| 91香蕉视频污在线| 国产精品一区二区三区乱码| 久久国内精品自在自线400部| 国产精品色眯眯| 精品国免费一区二区三区| 欧美三级视频在线观看| 成人av在线资源| 成人免费的视频| 另类小说视频一区二区| 日韩欧美的一区二区| 亚洲二区在线观看| 一区二区久久久| 中文字幕综合网| 中文字幕佐山爱一区二区免费| 国产馆精品极品| 国产成人在线视频网站| 国产精品1区2区3区| 国产传媒日韩欧美成人| 国产精品一卡二卡| 99精品国产热久久91蜜凸| 91一区二区三区在线播放| 91首页免费视频| 国产老肥熟一区二区三区| 日本一区二区三区在线观看| 中文字幕免费观看一区| 日韩理论片网站| 亚洲已满18点击进入久久| 美国一区二区三区在线播放| 国产伦精品一区二区三区免费 | 天堂久久一区二区三区| 日韩va亚洲va欧美va久久| 精品一区二区免费看| 成人动漫av在线| 欧美日韩三级视频| 国产三级精品在线| 亚洲成人你懂的| 国产激情精品久久久第一区二区| 成人aaaa免费全部观看| 欧美一卡2卡三卡4卡5免费|