Click here to Skip to main content
15,883,705 members
Articles / Desktop Programming / MFC

A Google Docs Based Backup Application

Rate me:
Please Sign up or sign in to vote.
4.89/5 (71 votes)
20 Mar 2015CPOL4 min read 98.4K   3.9K   121  
A C++ client for uploading documents to your Google Docs account
#pragma once

#include "UploadList.h"

class CMainWindow
{
public:
	CMainWindow(void);
	~CMainWindow(void);
  BOOL CreateShow(const wchar_t *windowClassName, int nCmdShow);
  HWND GetHandle() { return m_handle; }

  void OnDropFiles(HDROP drop);

private:
  HWND m_handle;
  unsigned int m_queueFilesMessage;
  CUploadList m_uploadList;
  CSystemTray m_trayIcon;
  BOOL m_uploading;
  HIMAGELIST m_toolbarImages;
  HWND m_toolbar;
  size_t m_currentFile; // index of file being uploaded or the next to upload, the one with GetPos() = 1
  int m_currentRetry;
  int m_countErrors;
  int m_countSuccess;
  wstring m_hintConvertDocsButton;

  // cache for result of folder creation, used if the next file is in the same folder as previously uploaded
  wstring m_googleFolderId; 
  wstring m_saveGooglePath;

  static LRESULT CALLBACK StaticWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
  static BOOL QueueScanCallback(void *param, const wstring &fileName);
  LRESULT WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
  void OnAfterCreate();
  int SettingsDlg();
  void OnDestroy();
  void QueueFiles(const vector<wstring> &fileNames);
  void OnSize();
  void OnExit();
  void StartUpload(size_t fileToUpload);
  void EndFileUpload( BOOL abort );
  void AbortUpload();
  void SetCurrentStatus(CUploadItem::ITEMSTATE state, const wstring &msg);
  wstring GetFormattedUploadStatus();
  void OnTimer(WPARAM timerId);
  void BeforeUploadSeriesStart();
  void AfterUploadSeriesEnd(BOOL showMessage = TRUE);
  void CreateToolbar();
  BOOL SetToolbarButton(DWORD buttonId, const wstring &text, int image = -1);
  void ClearFilesLV();
  void OnQueueFiles();
  void OnDelayedQueueFiles(WPARAM wParam, LPARAM lParam);
  BOOL ProvideNoUploadState(const wchar_t *uploadInProgressWarning);
  void OnClearList();
  void UpdateUploadButton();
  BOOL QueueFile(const wstring &path, size_t googlePathOffset);
  LRESULT OnNotify(NMHDR *pnm);
  BOOL OnContextMenu(HWND window, int x, int y);
  BOOL OnCommand(DWORD id, DWORD event);
  void SetConvertDocs(BOOL premier, BOOL checked);
  BOOL GetConvertDocs();
  void UpdateTitle();
  void OnUploadRetry();
  void OnClose();
  void OnFirstStart();
};

CMainWindow *AppWindow();

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
CEO Secured Globe, Inc.
United States United States
Michael Haephrati is a music composer, an inventor and an expert specializes in software development and information security, who has built a unique perspective which combines technology and the end user experience. He is the author of a the book Learning C++ , which teaches C++ 20, and was published in August 2022.

He is the CEO of Secured Globe, Inc., and also active at Stack Overflow.

Read our Corporate blog or read my Personal blog.





Comments and Discussions