Click here to Skip to main content
15,883,788 members
Articles / Mobile Apps / Windows Mobile

GPS and Web Service using C++ ATL/WTL (Windows Mobile 6, Standard)

Rate me:
Please Sign up or sign in to vote.
4.93/5 (27 votes)
18 Jan 2008CPOL7 min read 104.5K   1.4K   81  
This article explains how to use the GPS API and Web Service on a SmartPhone to show demographics information for the current location.
// DemographicsView.h : interface of the CDemographicsView class
//
/////////////////////////////////////////////////////////////////////////////

#pragma once
#include "IGPSSink.h"

class CDemographicsView : 
	public CWindowImpl<CDemographicsView>,
	public IGPSSink
{
	GPS_DEVICE m_gpsDevice;
	GPS_POSITION m_gpsPosition;
	DemographixQuery::SummaryInformation m_info;
	CRITICAL_SECTION m_cs;
	CBitmap m_hBackground;
	
	CFontHandle m_DefaultFont;
	CFont m_DefaultFontBold;
	CFont m_SmallFont;
	CFont m_SmallFontBold;

	double m_oldLat;
	double m_oldLong;
public:
	DECLARE_WND_CLASS(NULL)

	CDemographicsView();
	virtual ~CDemographicsView();

	BOOL PreTranslateMessage(MSG* pMsg);

	BEGIN_MSG_MAP(CDemographicsView)
		MESSAGE_HANDLER(WM_PAINT, OnPaint)
		MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground)
	END_MSG_MAP()

	// Handler prototypes (uncomment arguments if needed):
	//	LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
	//	LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
	//	LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)

	LRESULT OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
	LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);

	HRESULT SetGPSPosition(GPS_POSITION gps_Position);
	HRESULT SetGPSDeviceInfo(GPS_DEVICE gps_Device);
	INT TextOut(INT x, INT y, LPCTSTR szText, CDC & dc, HFONT hfont);
};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Chief Technology Officer CDYNE Corporation
United States United States
Developer, Maker and Tinkerer

Comments and Discussions