├── debug_log.txt ├── snap_tips.h ├── my_version_checks.h ├── LOGO.GIF ├── PLAY.BMP ├── SNAP.WAV ├── STOP.BMP ├── ARROW.CUR ├── ICON1.ICO ├── ICON3.ICO ├── ICON4.ICO ├── ICON5.ICO ├── ICON6.ICO ├── OTHERS.BMP ├── SMALL.ICO ├── SMALL3.ICO ├── SNAP2.WAV ├── SNAPTO.ICO ├── SOUNDS.GIF ├── UNSNAP.WAV ├── about.html ├── icon2.ico ├── snapTo.chm ├── snapit.ico ├── snapit.rc ├── BITMAP1.BMP ├── BITMAP2.BMP ├── BMP00001.BMP ├── BMP00002.BMP ├── CURSOR1.CUR ├── CURSOR2.CUR ├── DESKTOP_.ICO ├── ENABLED3.ICO ├── ENABLED5.ICO ├── ICO00001.ICO ├── ICO00002.ICO ├── ICO00003.ICO ├── ICO00004.ICO ├── ICON256.ICO ├── OTHERS_D.BMP ├── OTHERS_D.ICO ├── SELF_DIS.ICO ├── disabled.ico ├── disabled2.ico ├── disabled3.ico ├── disabled5.ico ├── enabled.ico ├── ico00005.ico ├── ico00006.ico ├── ico00007.ico ├── ico00008.ico ├── ico00009.ico ├── icon256_2.ico ├── icon256_3.ico ├── icon256_4.ico ├── icon256_5.ico ├── icon256_6.ico ├── smallicon.gif ├── snapTo9.ico ├── snapitold.ICO ├── snaptoA.ico ├── snaptoW.ico ├── xpenable.ico ├── auto_lineup.exp ├── auto_lineup.lib ├── preferences.gif ├── snapTo.exe.lnk ├── createguides.gif ├── x-click-but21.gif ├── xptray_enabled.ico ├── x-click-but21256.bmp ├── xptray_disabled.ico ├── x-click-but21 copy.bmp ├── CSHELP.HPJ ├── CTXHELP.HPJ ├── snap_lineup.h ├── snap_KeepToScreen.h ├── snap_ini.h ├── snap_CenterSize.h ├── snap_EqualSize.h ├── snap_CropTop.h ├── snap_MouseSpeed.h ├── Index.hhk ├── snap_lib_internal.h ├── snap_registry.h ├── StdAfx.c ├── snap_MultiSz.h ├── snap_taskbar.h ├── snap_types.h ├── snap_TrackResults.h ├── SNAPPER.H ├── snap_debug.h ├── snap_mywm_msg.h ├── resource2.h ├── resource1.h ├── snap_InTests.h ├── snapTo.hhp ├── common_thread.h ├── performance.html ├── snap_ResultStack.h ├── snap_sounds.h ├── running.html ├── snap_CornerInfo.h ├── snap_libW.manifest ├── snap_settings.h ├── allsnap.ini ├── snap_WinRects.h ├── snap_App.h ├── CTXHELP.H ├── WDJSUB.H ├── introducing.html ├── snap_lineup.c ├── snap_MouseSpeed.c ├── snap_grid.h ├── snap_testers.h ├── snap_ResultStack.c ├── snap_Crop.h ├── Table of Contents.hhc ├── LICENSE ├── SNAPIT.DSW ├── EULA.TXT ├── IE5.CSS ├── StdAfx.h ├── snap_TrackResults.c ├── knownproblems.html ├── drguiquestion.txt ├── snap_MultiSz.c ├── SIDES.H ├── snap_results.h ├── snap_testinfo.h ├── snap_CropTop.c ├── snap_CornerInfo.c ├── snap_grid.c ├── CTXHELP.TXT ├── snap_CenterSize.c ├── snap_sounds.c ├── snap_EqualSize.c ├── snap_CropTop.c.bak.c ├── snap_InTests.c ├── resource.hm ├── snapTo.iss ├── help.html ├── sides_old.c ├── .gitattributes ├── SNAP_LIB.H ├── mydebug.c ├── SNAP_LIB.RC ├── snap_lib1.rc ├── snap_taskbar.c ├── snap_tips.c ├── MYDEBUG.H ├── ALLSNAPB.sln ├── .gitignore ├── COUA.CSS ├── IE4.CSS ├── snap_XP.c ├── snap_lib.vcxproj.filters ├── settings.html ├── allSnap.iss ├── allSnapDebug.iss ├── SIDES.C ├── snap_Crop.c ├── snap_ini.c ├── snapit.vcxproj.filters ├── Snapper.c ├── CmnHdr.h └── resource.h /debug_log.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /snap_tips.h: -------------------------------------------------------------------------------- 1 | 2 | void tips_show(HWND hwndCtrl); -------------------------------------------------------------------------------- /my_version_checks.h: -------------------------------------------------------------------------------- 1 | #define IS_WIN95(os) (os.dwMajorVersion==4) -------------------------------------------------------------------------------- /LOGO.GIF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/LOGO.GIF -------------------------------------------------------------------------------- /PLAY.BMP: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/PLAY.BMP -------------------------------------------------------------------------------- /SNAP.WAV: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/SNAP.WAV -------------------------------------------------------------------------------- /STOP.BMP: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/STOP.BMP -------------------------------------------------------------------------------- /ARROW.CUR: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/ARROW.CUR -------------------------------------------------------------------------------- /ICON1.ICO: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/ICON1.ICO -------------------------------------------------------------------------------- /ICON3.ICO: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/ICON3.ICO -------------------------------------------------------------------------------- /ICON4.ICO: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/ICON4.ICO -------------------------------------------------------------------------------- /ICON5.ICO: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/ICON5.ICO -------------------------------------------------------------------------------- /ICON6.ICO: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/ICON6.ICO -------------------------------------------------------------------------------- /OTHERS.BMP: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/OTHERS.BMP -------------------------------------------------------------------------------- /SMALL.ICO: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/SMALL.ICO -------------------------------------------------------------------------------- /SMALL3.ICO: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/SMALL3.ICO -------------------------------------------------------------------------------- /SNAP2.WAV: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/SNAP2.WAV -------------------------------------------------------------------------------- /SNAPTO.ICO: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/SNAPTO.ICO -------------------------------------------------------------------------------- /SOUNDS.GIF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/SOUNDS.GIF -------------------------------------------------------------------------------- /UNSNAP.WAV: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/UNSNAP.WAV -------------------------------------------------------------------------------- /about.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/about.html -------------------------------------------------------------------------------- /icon2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/icon2.ico -------------------------------------------------------------------------------- /snapTo.chm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/snapTo.chm -------------------------------------------------------------------------------- /snapit.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/snapit.ico -------------------------------------------------------------------------------- /snapit.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/snapit.rc -------------------------------------------------------------------------------- /BITMAP1.BMP: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/BITMAP1.BMP -------------------------------------------------------------------------------- /BITMAP2.BMP: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/BITMAP2.BMP -------------------------------------------------------------------------------- /BMP00001.BMP: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/BMP00001.BMP -------------------------------------------------------------------------------- /BMP00002.BMP: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/BMP00002.BMP -------------------------------------------------------------------------------- /CURSOR1.CUR: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/CURSOR1.CUR -------------------------------------------------------------------------------- /CURSOR2.CUR: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/CURSOR2.CUR -------------------------------------------------------------------------------- /DESKTOP_.ICO: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/DESKTOP_.ICO -------------------------------------------------------------------------------- /ENABLED3.ICO: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/ENABLED3.ICO -------------------------------------------------------------------------------- /ENABLED5.ICO: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/ENABLED5.ICO -------------------------------------------------------------------------------- /ICO00001.ICO: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/ICO00001.ICO -------------------------------------------------------------------------------- /ICO00002.ICO: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/ICO00002.ICO -------------------------------------------------------------------------------- /ICO00003.ICO: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/ICO00003.ICO -------------------------------------------------------------------------------- /ICO00004.ICO: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/ICO00004.ICO -------------------------------------------------------------------------------- /ICON256.ICO: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/ICON256.ICO -------------------------------------------------------------------------------- /OTHERS_D.BMP: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/OTHERS_D.BMP -------------------------------------------------------------------------------- /OTHERS_D.ICO: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/OTHERS_D.ICO -------------------------------------------------------------------------------- /SELF_DIS.ICO: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/SELF_DIS.ICO -------------------------------------------------------------------------------- /disabled.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/disabled.ico -------------------------------------------------------------------------------- /disabled2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/disabled2.ico -------------------------------------------------------------------------------- /disabled3.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/disabled3.ico -------------------------------------------------------------------------------- /disabled5.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/disabled5.ico -------------------------------------------------------------------------------- /enabled.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/enabled.ico -------------------------------------------------------------------------------- /ico00005.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/ico00005.ico -------------------------------------------------------------------------------- /ico00006.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/ico00006.ico -------------------------------------------------------------------------------- /ico00007.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/ico00007.ico -------------------------------------------------------------------------------- /ico00008.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/ico00008.ico -------------------------------------------------------------------------------- /ico00009.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/ico00009.ico -------------------------------------------------------------------------------- /icon256_2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/icon256_2.ico -------------------------------------------------------------------------------- /icon256_3.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/icon256_3.ico -------------------------------------------------------------------------------- /icon256_4.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/icon256_4.ico -------------------------------------------------------------------------------- /icon256_5.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/icon256_5.ico -------------------------------------------------------------------------------- /icon256_6.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/icon256_6.ico -------------------------------------------------------------------------------- /smallicon.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/smallicon.gif -------------------------------------------------------------------------------- /snapTo9.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/snapTo9.ico -------------------------------------------------------------------------------- /snapitold.ICO: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/snapitold.ICO -------------------------------------------------------------------------------- /snaptoA.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/snaptoA.ico -------------------------------------------------------------------------------- /snaptoW.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/snaptoW.ico -------------------------------------------------------------------------------- /xpenable.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/xpenable.ico -------------------------------------------------------------------------------- /auto_lineup.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/auto_lineup.exp -------------------------------------------------------------------------------- /auto_lineup.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/auto_lineup.lib -------------------------------------------------------------------------------- /preferences.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/preferences.gif -------------------------------------------------------------------------------- /snapTo.exe.lnk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/snapTo.exe.lnk -------------------------------------------------------------------------------- /createguides.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/createguides.gif -------------------------------------------------------------------------------- /x-click-but21.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/x-click-but21.gif -------------------------------------------------------------------------------- /xptray_enabled.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/xptray_enabled.ico -------------------------------------------------------------------------------- /x-click-but21256.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/x-click-but21256.bmp -------------------------------------------------------------------------------- /xptray_disabled.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/xptray_disabled.ico -------------------------------------------------------------------------------- /x-click-but21 copy.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iheckman/allsnap/HEAD/x-click-but21 copy.bmp -------------------------------------------------------------------------------- /CSHELP.HPJ: -------------------------------------------------------------------------------- 1 | [OPTIONS] 2 | LCID=0x1009 0x0 0x0 ; English (Canada) 3 | REPORT=Yes 4 | HLP=cshelp.hlp 5 | -------------------------------------------------------------------------------- /CTXHELP.HPJ: -------------------------------------------------------------------------------- 1 | [OPTIONS] 2 | LCID=0x1009 0x0 0x0 ; English (Canada) 3 | REPORT=Yes 4 | HLP=ctxhelp.hlp 5 | -------------------------------------------------------------------------------- /snap_lineup.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | void WINAPI setIsAutolineupOn(BOOL new_auto_lineup); 5 | BOOL WINAPI IsAutolineupOn(void); 6 | void LINEUP_Cleanup(void); -------------------------------------------------------------------------------- /snap_KeepToScreen.h: -------------------------------------------------------------------------------- 1 | #include "windef.h" 2 | #include "snap_results.h" 3 | 4 | void KeepToScreen 5 | ( 6 | TEST_INFO * p_test_info, 7 | SNAP_RESULTS * p_snap_results 8 | ); -------------------------------------------------------------------------------- /snap_ini.h: -------------------------------------------------------------------------------- 1 | //snap_ini.h 2 | 3 | #ifndef SNAP_INI_INCLUDE 4 | 5 | #define SNAP_INI_INCLUDE 6 | 7 | 8 | BOOL LoadSettingsFromINI (void); 9 | BOOL SaveSettingsToINI (void); 10 | 11 | #endif //SNAP_INI_INCLUDE -------------------------------------------------------------------------------- /snap_CenterSize.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "./sides.h" 5 | 6 | BOOL isCentered(void); 7 | void CenterSize_Adjust(RECT * p_init_rect,enum SIDE v_side,enum SIDE h_side); 8 | void CenterSize_Init(HWND); -------------------------------------------------------------------------------- /snap_EqualSize.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "./sides.h" 5 | 6 | BOOL isEqualing(void); 7 | void EqualSize_Init(HWND hwnd); 8 | void EqualSize_Adjust(RECT * p_init_rect,enum SIDE v_side,enum SIDE h_side); -------------------------------------------------------------------------------- /snap_CropTop.h: -------------------------------------------------------------------------------- 1 | #include "snap_results.h" 2 | 3 | void snap_CropTop(LPRECT rcWindow); 4 | void snap_UnCropTop(LPRECT rcWindow); 5 | void snap_UnCropResults(SNAP_RESULTS * psnap_results); 6 | 7 | BOOL should_we_crop_this(HWND hwnd); 8 | -------------------------------------------------------------------------------- /snap_MouseSpeed.h: -------------------------------------------------------------------------------- 1 | //snap_MouseSpeed.h 2 | // 3 | #ifndef __SNAP_MOUSE_SPEED_H__ 4 | #define __SNAP_MOUSE_SPEED_H__ 5 | 6 | void MouseSpeed_Reset(void); 7 | void MouseSpeed_Track(void); 8 | BOOL MouseSpeed_isFast(void); 9 | 10 | #endif -------------------------------------------------------------------------------- /Index.hhk: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | -------------------------------------------------------------------------------- /snap_lib_internal.h: -------------------------------------------------------------------------------- 1 | // snap_lib_internal.h 2 | #ifndef SNAP_LIB_INTERNAL_INCLUDE 3 | #define SNAP_LIB_INTERNAL_INCLUDE 4 | 5 | #define SNAPLIBAPI __declspec(dllexport) 6 | 7 | #define INTERNAL_INCLUDE 8 | 9 | #include "snap_lib.h" 10 | 11 | #endif SNAP_LIB_INTERNAL_INCLUDE 12 | -------------------------------------------------------------------------------- /snap_registry.h: -------------------------------------------------------------------------------- 1 | //snap_registry.h 2 | #ifdef IH_USE_REGISTRY 3 | 4 | #ifndef SNAP_REGISTRY_INCLUDE 5 | 6 | #define SNAP_REGISTRY_INCLUDE 7 | 8 | 9 | BOOL LoadSettingsFromRegistry (void); 10 | BOOL SaveSettingsToRegistry (void); 11 | 12 | #endif //SNAP_REGISTRY_INCLUDE 13 | 14 | #endif -------------------------------------------------------------------------------- /StdAfx.c: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // snapit.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /snap_MultiSz.h: -------------------------------------------------------------------------------- 1 | //snap_MultiSz.h 2 | #ifndef SNAP_MULTISZ_INCLUDE 3 | #define SNAP_MULTISZ_INCLUDE 4 | 5 | BOOL isStrInMulti(LPCTSTR str, TCHAR * multi_sz); 6 | void setMultiSz(TCHAR * target,TCHAR * source,int max_item_length,int max_total_length); 7 | BOOL is_name_in_classlist(LPCTSTR str,LPCTSTR class_list); 8 | 9 | #endif -------------------------------------------------------------------------------- /snap_taskbar.h: -------------------------------------------------------------------------------- 1 | BOOL AddTaskbarIcon(void); 2 | BOOL AddEmptyTaskbarIcon(void); 3 | BOOL DeleteTaskbarIcon(void); 4 | BOOL ResetTaskbarIcon(void); 5 | VOID RegisterTaskbarCreatedMsg(void); 6 | VOID RestartTaskbarIcon(void); 7 | 8 | BOOL WINAPI isIconHidden(void); 9 | void WINAPI setIconHidden(BOOL hidden); 10 | 11 | extern UINT g_uTaskbarRestart; -------------------------------------------------------------------------------- /snap_types.h: -------------------------------------------------------------------------------- 1 | #ifndef SNAP_TYPES_INCLUDED 2 | 3 | #define SNAP_TYPES_INCLUDED 4 | 5 | #define SNAPT_DESKTOP 1 6 | #define SNAPT_SELF 2 7 | #define SNAPT_OTHERS 4 8 | #define SNAPT_VCENTER 8 9 | #define SNAPT_HCENTER 16 10 | #define SNAPT_NONE 0 11 | #define SNAPT_ANY_SCREEN (SNAPT_DESKTOP|SNAPT_VCENTER|SNAPT_HCENTER) 12 | 13 | #endif -------------------------------------------------------------------------------- /snap_TrackResults.h: -------------------------------------------------------------------------------- 1 | //snap_TrackResults.h 2 | 3 | #ifndef __SNAP_TRACK_RESULTS_H__ 4 | #define __SNAP_TRACK_RESULTS_H__ 5 | 6 | #include "snap_testers.h" 7 | 8 | PSNAP_RESULTS TrackRslts_GetLast(void); 9 | void TrackRslts_Reset(void); 10 | void TrackRslts_Track(PSNAP_RESULTS psnap_results); 11 | //void trsPlayCanceledSound(void); 12 | 13 | #endif -------------------------------------------------------------------------------- /SNAPPER.H: -------------------------------------------------------------------------------- 1 | #ifndef SNAPPER_INCLUDED_ 2 | #define SNAPPER_INCLUDED_ 3 | 4 | extern TCHAR szDEBUG[]; 5 | void snapper_OnMoving(HWND hWnd, LPRECT pRect); 6 | void snapper_OnSizing(HWND hWnd, WPARAM wParam,LPRECT pRect); 7 | void snapper_OnEnterSizeMove(HWND hwnd); 8 | 9 | //void snapper_OnWindowPosChanging(HWND hWnd, LPWINDOWPOS pWindowPos); 10 | 11 | #endif // -------------------------------------------------------------------------------- /snap_debug.h: -------------------------------------------------------------------------------- 1 | #ifdef _DEBUG 2 | 3 | #ifndef SNAP_DEBUG_INCLUDE 4 | #define SNAP_DEBUG_INCLUDE 5 | 6 | #include "mydebug.h" 7 | 8 | #define MY_DEBUG_STR (WM_APP + 121) 9 | 10 | extern HWND g_hwndDebug; 11 | BOOL CALLBACK DebugProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); 12 | void Debug_printMsg(TCHAR * message); 13 | 14 | #endif 15 | #endif -------------------------------------------------------------------------------- /snap_mywm_msg.h: -------------------------------------------------------------------------------- 1 | #ifndef SNAP_MYWM_MSG_INCLUDE 2 | #define SNAP_MYWM_MSG_INCLUDE 3 | 4 | #define MYWM_NOTIFYICON (WM_USER + 1) 5 | #define MYWM_SNAPSOUND (WM_USER + 2) 6 | #define MYWM_UNSNAPSOUND (WM_USER + 3) 7 | #define MYWM_CLOSETHREAD (WM_USER + 4) 8 | #define MYWM_UNHIDEICON (WM_USER + 5) 9 | #define MYWM_IS_CLASS_IN_LIST (WM_USER + 6) 10 | #define MYWM_DEBUG1 (WM_USER + 10) 11 | 12 | #endif -------------------------------------------------------------------------------- /resource2.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by snap_lib1.rc 4 | 5 | // Next default values for new objects 6 | // 7 | #ifdef APSTUDIO_INVOKED 8 | #ifndef APSTUDIO_READONLY_SYMBOLS 9 | #define _APS_NEXT_RESOURCE_VALUE 101 10 | #define _APS_NEXT_COMMAND_VALUE 40001 11 | #define _APS_NEXT_CONTROL_VALUE 1001 12 | #define _APS_NEXT_SYMED_VALUE 101 13 | #endif 14 | #endif 15 | -------------------------------------------------------------------------------- /resource1.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by snap_lib.rc 4 | // 5 | 6 | // Next default values for new objects 7 | // 8 | #ifdef APSTUDIO_INVOKED 9 | #ifndef APSTUDIO_READONLY_SYMBOLS 10 | #define _APS_NEXT_RESOURCE_VALUE 103 11 | #define _APS_NEXT_COMMAND_VALUE 40001 12 | #define _APS_NEXT_CONTROL_VALUE 1001 13 | #define _APS_NEXT_SYMED_VALUE 101 14 | #endif 15 | #endif 16 | -------------------------------------------------------------------------------- /snap_InTests.h: -------------------------------------------------------------------------------- 1 | #ifndef SNAP_INTESTS_INCLUDE 2 | #define SNAP_INTESTS_INCLUDE 3 | 4 | #include "snap_CornerInfo.h" 5 | #include "sides.h" 6 | 7 | BOOL InTests_GetClosestScreenToPt(POINT pt, enum SIDES side, int * p_dist,LPRECT pScreen); 8 | 9 | int InTests_GetClosestScreenToSide(enum SIDES side,LPCRECT pRect, LPRECT pScreen); 10 | 11 | void InTests_TestAllCorners(P_CORNER_INFO pci,LPCRECT pRect); 12 | BOOL InTests_isPtInMonitors(int x, int y); 13 | 14 | #endif -------------------------------------------------------------------------------- /snapTo.hhp: -------------------------------------------------------------------------------- 1 | [OPTIONS] 2 | Compatibility=1.1 or later 3 | Compiled file=allSnap.chm 4 | Contents file=Table of Contents.hhc 5 | Default topic=introducing.html 6 | Display compile progress=Yes 7 | Language=0x1009 English (Canada) 8 | Title=allSnap Help 9 | 10 | 11 | [FILES] 12 | settings.html 13 | introducing.html 14 | running.html 15 | about.html 16 | knownproblems.html 17 | 18 | [MAP] 19 | Compatibility=1.1 or later 20 | 21 | [TEXT POPUPS] 22 | 23 | 24 | 25 | [INFOTYPES] 26 | 27 | -------------------------------------------------------------------------------- /common_thread.h: -------------------------------------------------------------------------------- 1 | #ifndef COMMON_THREAD_INCLUDE 2 | #define COMMON_THREAD_INCLUDE 3 | 4 | typedef unsigned (__stdcall *PTHREAD_START) (void *); 5 | 6 | #define chBEGINTHREADEX(psa, cbStack, pfnStartAddr, \ 7 | pvParam,fdwCreate,pdwThreadId) \ 8 | ((HANDLE)_beginthreadex( \ 9 | (void *) (psa), \ 10 | (unsigned) (cbStack), \ 11 | (PTHREAD_START) (pfnStartAddr), \ 12 | (void *) (pvParam), \ 13 | (unsigned) (fdwCreate), \ 14 | (unsigned *) (pdwThreadId))) \ 15 | 16 | #endif -------------------------------------------------------------------------------- /performance.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Performance/Stability 5 | 6 | 7 | 8 | 9 | 10 |

Performance/Stability

11 |

This program works through window hooking. Hooking is a technique that Microsoft suggest you only use in debugging because it can slow the system down, and mess around with any other program on your system. So use at your own risk.

12 | 13 | 14 | -------------------------------------------------------------------------------- /snap_ResultStack.h: -------------------------------------------------------------------------------- 1 | #ifndef RESULT_STACK_INCLUDE 2 | #define RESULT_STACK_INCLUDE 3 | 4 | #include "snap_results.h" //snap result definition 5 | #define MAXENTRIES 10 6 | 7 | typedef SIDE_SNAP_RESULTS StackEntry; 8 | 9 | typedef struct ResultStack_TAG { 10 | int count; 11 | int front; 12 | int rear; 13 | StackEntry entry[MAXENTRIES]; 14 | } ResultStack; 15 | 16 | void ResultStack_Push(const StackEntry * const p_x, ResultStack *s); 17 | BOOL ResultStack_Pop(StackEntry * p_x, ResultStack *s); 18 | void ResultStack_Init(ResultStack *s); 19 | 20 | 21 | #endif -------------------------------------------------------------------------------- /snap_sounds.h: -------------------------------------------------------------------------------- 1 | 2 | enum SNAP_SOUNDS {SOUND_SNAP, SOUND_UNSNAP}; 3 | 4 | #define NUM_SOUNDS 2 5 | 6 | void SnapSounds_setPath (enum SNAP_SOUNDS which_sound, LPCTSTR file_path); 7 | LPTSTR SnapSounds_getPath (enum SNAP_SOUNDS which_sound); 8 | 9 | void SnapSounds_Play (enum SNAP_SOUNDS which_sound); 10 | 11 | void SnapSounds_Test(LPCTSTR file_path); 12 | void SnapSounds_StopTest(void); 13 | 14 | UINT SnapSounds_BeginThread(void); 15 | 16 | void WINAPI setSnapSound(LPCTSTR file_path,int len); 17 | 18 | LPTSTR WINAPI getSnapSound(void); 19 | 20 | void WINAPI setUnsnapSound(LPCTSTR file_path,int len); 21 | 22 | LPTSTR WINAPI getUnsnapSound(void); -------------------------------------------------------------------------------- /running.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | allSnap - Running 5 | 6 | 7 | 8 | 9 | 10 |

Running

11 | 12 |

13 |

25 |

26 | 27 | 28 | -------------------------------------------------------------------------------- /snap_CornerInfo.h: -------------------------------------------------------------------------------- 1 | #ifndef SNAP_CORNER_INFO_INCLUDE 2 | #define SNAP_CORNER_INFO_INCLUDE 3 | 4 | #include 5 | #include "sides.h" 6 | 7 | typedef struct CORNER_INFO_TAG{ 8 | BOOL topLeft_out; 9 | BOOL topRight_out; 10 | BOOL bottomLeft_out; 11 | BOOL bottomRight_out; 12 | } CORNER_INFO, * P_CORNER_INFO; 13 | 14 | BOOL isCornerOut (P_CORNER_INFO pci, enum SIDES v_side, enum SIDES h_side); 15 | BOOL isSideOut (P_CORNER_INFO pci, enum SIDES side); 16 | BOOL isSideIn (P_CORNER_INFO pci, enum SIDES side); 17 | BOOL isOnlyOneCornerOfSideOut (P_CORNER_INFO pci, enum SIDES side); 18 | 19 | 20 | void updateCornerInfo(P_CORNER_INFO pci,LPCRECT pRect); 21 | 22 | 23 | 24 | #endif -------------------------------------------------------------------------------- /snap_libW.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | Dll for allSnap 9 | 10 | 11 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /snap_settings.h: -------------------------------------------------------------------------------- 1 | 2 | extern HWND g_hwndPropSheet; //PropertySheet Window 3 | 4 | HWND DoPropertySheet(HWND hwndOwner); 5 | 6 | typedef struct VK_ITEM_TAG{ 7 | DWORD data; //value for CB_SETITEMDATA 8 | TCHAR string[20]; //value for CB_ADDSTRING 9 | }CB_VK_ITEM; 10 | 11 | typedef struct SNAP_TYPE_BOX_TAG{ 12 | int box_id; //ID of check box 13 | UINT snap_type; //corresponding snap type 14 | }SNAP_TYPE_BOX; 15 | 16 | #define MAX_THRESH 100 17 | #define MIN_THRESH 2 18 | 19 | #define Is_Checked(hDlg,id)(Button_GetCheck(GetDlgItem((hDlg),(id)))==BST_CHECKED) 20 | 21 | #define Set_Checked(hDlg,id,checked)(Button_SetCheck(GetDlgItem((hDlg),(id)),(checked)?BST_CHECKED:BST_UNCHECKED)) 22 | 23 | #define HANDLE_PROP_NOTIFY -------------------------------------------------------------------------------- /allsnap.ini: -------------------------------------------------------------------------------- 1 | [settings] 2 | win_tresh=10 3 | screen_tresh=10 4 | snap_type=29 5 | play_sounds=1 6 | snap_sound_file=C:\Users\ivanh\Documents\allsnap\allsnap\allsnap\SNAP.WAV 7 | unsnap_sound_file=C:\Users\ivanh\Documents\allsnap\allsnap\allsnap\SNAP2.WAV 8 | toggle_key=18 9 | snap_mdi=0 10 | disable_toggle=1 11 | snapping_insides=1 12 | crop_top=3 13 | is_cropping_top=0 14 | icon_hidden=0 15 | kept_to_screen=0 16 | skinned_classes=icoCTactTrilly;Winamp v1.x;ConsoleWindowClass;Winamp PE;Winamp EQ;Winamp MB;BaseWindow_RootWnd 17 | ignored_classes=Progman;IDEOwner;NeilShadow 18 | cropping_rgn=1 19 | hgridenabled=0 20 | hgridtype=0 21 | hgridval=0 22 | vgridenabled=0 23 | vgridtype=0 24 | vgridval=0 25 | center_key=17 26 | equal_key=16 27 | -------------------------------------------------------------------------------- /snap_WinRects.h: -------------------------------------------------------------------------------- 1 | #ifndef SNAP_WINRECTS_INCLUDE 2 | 3 | #define SNAP_WINRECTS_INCLUDE 4 | 5 | #include "snap_testers.h" 6 | #include "sides.h" 7 | #include "snap_CornerInfo.h" 8 | 9 | #define IS_MDI_CHILD(hwnd)((GetWindowLong((hwnd),GWL_EXSTYLE) & WS_EX_MDICHILD) != 0) 10 | 11 | void WinRects_Refresh(DWORD get_which, HWND hwnd); 12 | void WinRects_getRects(PTEST_RECTS); 13 | void WinRects_RefreshStartScreen(void); 14 | 15 | int WinRects_GetNumScreens(void); 16 | RECT * WinRects_GetScreens(void); 17 | 18 | BOOL WinRects_GetWindowRect(HWND hWnd, LPRECT pRect); 19 | BOOL WinRects_GetRgnBox(HWND hWnd, LPRECT pRgnBox); 20 | 21 | void WinRects_getCurrentScreen(RECT * pRect); 22 | void WinRects_getScreenFromPt(POINT pt, RECT * pRect); 23 | 24 | #endif -------------------------------------------------------------------------------- /snap_App.h: -------------------------------------------------------------------------------- 1 | 2 | #if !defined(AFX_SNAPIT_H__70813C66_3FFA_11D6_8738_444553540000__INCLUDED_) 3 | #define AFX_SNAPIT_H__70813C66_3FFA_11D6_8738_444553540000__INCLUDED_ 4 | 5 | #if _MSC_VER > 1000 6 | #pragma once 7 | #endif // _MSC_VER > 1000 8 | 9 | #include "resource.h" 10 | 11 | 12 | #define SHELLEXECUTE_MAXERROR 32 13 | 14 | #define Can_Handle_Unicode (GetWindowsDirectoryW(NULL, 0) != 0) 15 | 16 | #define MY_MB(x) MessageBox(NULL,x,x,MB_OK); 17 | 18 | 19 | extern HWND g_hWnd; 20 | extern HINSTANCE g_hInst; 21 | extern OSVERSIONINFO g_os; 22 | extern BOOL g_isXP; 23 | 24 | void InitCmnCtls(void); 25 | 26 | extern HICON g_hiPlay; 27 | extern HICON g_hiStop; 28 | 29 | #endif // !defined(AFX_SNAPIT_H__70813C66_3FFA_11D6_8738_444553540000__INCLUDED_) 30 | -------------------------------------------------------------------------------- /CTXHELP.H: -------------------------------------------------------------------------------- 1 | #define IDH_OTHERS 1 2 | #define IDH_ENABLED 2 3 | #define IDH_PLAYSOUNDS 3 4 | #define IDH_UNSNAP_FILE 4 5 | #define IDH_BROWSE_UNSNAP 5 6 | #define IDH_SNAP_FILE 6 7 | #define IDH_BROWSE_SNAP 7 8 | #define IDH_TOGGLEKEYS 8 9 | #define IDH_WIN_THRESH 9 10 | #define IDH_SCREEN_THRESH 10 11 | #define IDH_GENERALL 11 12 | #define IDH_SNAPTOL 12 13 | #define IDH_DESKTOP 13 14 | #define IDH_SOUNDS 14 15 | #define IDH_SELF 15 16 | #define IDH_SNAPMDI 16 17 | #define IDH_QUIETFAST 17 18 | #define IDH_INSIDES 18 19 | #define IDH_INVTOGGLE 19 20 | #define IDH_ADVL 20 21 | #define IDH_PLAY 21 22 | #define IDH_CROPTOP 22 23 | #define IDH_HIDEICON 23 24 | #define IDH_VCENTER 24 25 | #define IDH_HCENTER 25 26 | #define IDH_KEPT 26 -------------------------------------------------------------------------------- /WDJSUB.H: -------------------------------------------------------------------------------- 1 | /* 2 | * wdjsub.h: 3 | * Declarations for subclassing functions defined in wdjsub.c. 4 | * 5 | * See http://www.wdj.com/articles/2000/0003/0003toc.htm for details, 6 | * plus further comments in wdjsub.c. 7 | */ 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | BOOL APIENTRY wdjSubclass ( WNDPROC wndProc, HWND hwnd, void *pData ); 14 | BOOL APIENTRY wdjUnhook ( WNDPROC id, HWND hwnd ); 15 | LRESULT APIENTRY wdjCallOldProc ( WNDPROC id, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); 16 | void * APIENTRY wdjGetData ( WNDPROC id, HWND hwnd ); 17 | BOOL APIENTRY wdjSetData ( WNDPROC id, HWND hwnd, void *pData ); 18 | BOOL APIENTRY wdjIsSubclassed( WNDPROC id, HWND hwnd ); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | 24 | // end of file 25 | -------------------------------------------------------------------------------- /introducing.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Introducing allSnap 5 | 6 | 7 | 8 | 9 | 10 |

Introducing allSnap

11 |

12 | allSnap is a small system tray app that makes every window snap like they do in programs such as Winamp or Photoshop. 13 |

14 |
15 |
16 |

17 | Running allSnap

18 | 19 |

20 | Known Problems

21 | 22 |

23 | Settings

24 | 25 |

26 | About allSnap

27 | 28 | -------------------------------------------------------------------------------- /snap_lineup.c: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "snap_lineup.h" 3 | #include "snap_app.h" 4 | #include "auto_lineup/autolineup.h" 5 | 6 | extern HWND g_hWnd; 7 | extern UINT g_sounds_thread_id; 8 | static BOOL is_autolining_up = FALSE; 9 | 10 | void WINAPI setIsAutolineupOn(BOOL new_auto_lineup){ 11 | #ifdef ASNAP_AUTO_LINEUP 12 | if(g_isXP) 13 | return; //never do anything in XP! 14 | 15 | 16 | 17 | if (new_auto_lineup && !is_autolining_up){ 18 | AUTOLINEUP_Hook(g_hWnd,g_sounds_thread_id); 19 | } 20 | else if (!new_auto_lineup && is_autolining_up){ 21 | AUTOLINEUP_UnHook(); 22 | } 23 | is_autolining_up = new_auto_lineup; 24 | #endif 25 | } 26 | BOOL WINAPI IsAutolineupOn(void){ 27 | return is_autolining_up; 28 | } 29 | 30 | 31 | void LINEUP_Cleanup(void){ 32 | #ifdef ASNAP_AUTO_LINEUP 33 | AUTOLINEUP_UnHook(); 34 | #endif 35 | } -------------------------------------------------------------------------------- /snap_MouseSpeed.c: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "snap_MouseSpeed.h" 3 | #include "snap_lib_internal.h" 4 | 5 | static BOOL first_time = TRUE; 6 | static POINT last_pt; 7 | static int speed = 0; 8 | static BOOL is_too_fast; 9 | 10 | void MouseSpeed_Reset(void){ 11 | first_time = TRUE; 12 | } 13 | 14 | void MouseSpeed_Track(void){ 15 | int dx; 16 | int dy; 17 | int last_jump; 18 | 19 | POINT pt; 20 | 21 | GetCursorPos(&pt); 22 | if (first_time){ 23 | last_pt = pt; 24 | first_time = FALSE; 25 | } 26 | 27 | dx = pt.x - last_pt.x; 28 | dy = pt.y - last_pt.y; 29 | last_jump = dx * dx + dy * dy; // don't bother with square root 30 | speed = (last_jump + speed) / 2; 31 | is_too_fast = ( speed > (getWinThresh() * getWinThresh()) ); 32 | 33 | last_pt = pt; 34 | } 35 | 36 | BOOL MouseSpeed_isFast(void){ 37 | return is_too_fast; 38 | } -------------------------------------------------------------------------------- /snap_grid.h: -------------------------------------------------------------------------------- 1 | //snap_grid 2 | //include types for grid snap. 3 | #pragma once 4 | 5 | typedef enum{ 6 | GRIDTYPE_EVEN, 7 | GRIDTYPE_PIXELS, 8 | GRIDTYPE_SINGLE 9 | }gridsnap_type_t; 10 | 11 | typedef struct{ 12 | BOOL enabled; 13 | gridsnap_type_t type; 14 | int val; 15 | }gridsnap_setting_t; 16 | 17 | typedef struct{ 18 | gridsnap_setting_t h; 19 | gridsnap_setting_t v; 20 | }gridsnap_settings_t; 21 | 22 | void WINAPI setHGridEnabled(BOOL enabled); 23 | void WINAPI setHGridType(int type); 24 | void WINAPI setHGridVal(int val); 25 | void WINAPI setVGridEnabled(BOOL enabled); 26 | void WINAPI setVGridType(int type); 27 | void WINAPI setVGridVal(int val); 28 | BOOL WINAPI isHGridEnabled(void); 29 | int WINAPI getHGridType(void); 30 | int WINAPI getHGridVal(void); 31 | BOOL WINAPI isVGridEnabled(void); 32 | int WINAPI getVGridType(void); 33 | int WINAPI getVGridVal(void); -------------------------------------------------------------------------------- /snap_testers.h: -------------------------------------------------------------------------------- 1 | #if !defined(SNAP_TESTERS_) 2 | #define SNAP_TESTERS_ 3 | 4 | #include "sides.h" 5 | #include "snap_results.h" 6 | #include "snap_TestInfo.h" 7 | 8 | #define MY_MAX(x,y)(((x)>(y))?(x):(y)) 9 | #define MY_MIN(x,y)(((x)<(y))?(x):(y)) 10 | #define VERY_FAR -999; 11 | #define NOWHERE -666; 12 | 13 | 14 | 15 | 16 | void moving_test_all 17 | ( 18 | LPCRECT p_my_rect, 19 | int win_threshold, 20 | int screen_threshold, 21 | PTEST_RECTS ptest_rects, 22 | SNAP_RESULTS * pSnapResults 23 | ); 24 | 25 | void sizing_test_all 26 | ( 27 | enum SIDE v_sizing_side, 28 | enum SIDE h_sizing_side, 29 | LPCRECT p_my_rect, 30 | int win_threshold, 31 | int screen_threshold, 32 | PTEST_RECTS ptest_rects, 33 | SNAP_RESULTS * p_snap_results, 34 | BOOL centering 35 | ); 36 | 37 | void clear_snap_results (SNAP_RESULTS * p_snap_results); 38 | 39 | BOOL is_sizable_side(enum SIDE my_side,TEST_INFO * pTestInfo); 40 | 41 | 42 | 43 | #endif -------------------------------------------------------------------------------- /snap_ResultStack.c: -------------------------------------------------------------------------------- 1 | //snap_ResultStack.c 2 | // 3 | 4 | #include "stdafx.h" 5 | #include "snap_testers.h" 6 | #include "snap_ResultStack.h" 7 | 8 | BOOL ResultStack_isEmpty(ResultStack *s){ 9 | return s->count == 0; 10 | } 11 | 12 | BOOL ResultStack_isFull(ResultStack *s){ 13 | return s->count == MAXENTRIES; 14 | } 15 | 16 | void ResultStack_Init(ResultStack *s){ 17 | s->count = 0; 18 | s->front = 0; 19 | s->rear = 0; 20 | } 21 | 22 | void ResultStack_Push(const StackEntry * const p_x, ResultStack *s) 23 | { 24 | if (!ResultStack_isFull(s)){ 25 | s->count++; 26 | } 27 | s->entry[s->rear] = * p_x; 28 | s->rear = (s->rear + 1) % MAXENTRIES; 29 | 30 | } 31 | 32 | 33 | BOOL ResultStack_Pop(StackEntry * p_x , ResultStack *s) 34 | { 35 | if (ResultStack_isEmpty(s)){ 36 | return FALSE; 37 | } 38 | else { 39 | s->count--; 40 | *p_x = s->entry[s->front]; 41 | s->front = (s->front + 1) % MAXENTRIES; 42 | return TRUE; 43 | } 44 | } -------------------------------------------------------------------------------- /snap_Crop.h: -------------------------------------------------------------------------------- 1 | #include "snap_results.h" 2 | 3 | typedef struct CROP_INFO_TAG{ 4 | BOOL cropping_top; 5 | BOOL has_rgn; 6 | 7 | RECT rcRgn; 8 | RECT uncropped_rect; 9 | RECT cropped_rect; 10 | }CROP_INFO,* PCROP_INFO; 11 | 12 | typedef struct CROP_SIZING_INFO_TAG{ 13 | BOOL has_rgn; 14 | RECT offsets; //stores top bottom right left offset values. (not a real rect) 15 | }CROP_SIZING_INFO, * PCROP_SIZING_INFO; 16 | 17 | void Crop_LoadSizingInfo(HWND hwnd); 18 | 19 | void Crop_LoadMovingCropInfo(PCROP_INFO p_crp,HWND hWnd,LPCRECT pRect); 20 | 21 | void Crop_UnCropSizingResults(SNAP_RESULTS * psnap_results); 22 | void Crop_UnCropMovingResults(PCROP_INFO p_crp,SNAP_RESULTS * psnap_results); 23 | 24 | void Crop_CropSizingRect( 25 | RECT const * prect, 26 | enum SIDE v_side, 27 | enum SIDE h_side, 28 | RECT * p_cropped_rect 29 | ); 30 | 31 | void Crop_UnCropResults(PCROP_INFO p_crp,SNAP_RESULTS * psnap_results); 32 | 33 | LPCRECT Crop_GetPCroppedRect(PCROP_INFO p_crop); 34 | LPCRECT Crop_GetPUncroppedRect(PCROP_INFO p_crop); -------------------------------------------------------------------------------- /Table of Contents.hhc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
  • 12 | 13 | 14 | 15 |
  • 16 | 17 | 18 | 19 |
  • 20 | 21 | 22 | 23 |
  • 24 | 25 | 26 | 27 |
  • 28 | 29 | 30 | 31 |
32 | 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 iheckman 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /SNAPIT.DSW: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "snapTo"=.\snapTo\snapTo.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Project: "snap_lib"=.\snap_lib.dsp - Package Owner=<4> 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<4> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | Project: "snapit"=.\snapit.dsp - Package Owner=<4> 31 | 32 | Package=<5> 33 | {{{ 34 | }}} 35 | 36 | Package=<4> 37 | {{{ 38 | Begin Project Dependency 39 | Project_Dep_Name snap_lib 40 | End Project Dependency 41 | }}} 42 | 43 | ############################################################################### 44 | 45 | Global: 46 | 47 | Package=<5> 48 | {{{ 49 | }}} 50 | 51 | Package=<3> 52 | {{{ 53 | }}} 54 | 55 | ############################################################################### 56 | 57 | -------------------------------------------------------------------------------- /EULA.TXT: -------------------------------------------------------------------------------- 1 | allSnap License 2 | ================================= 3 | 4 | Except where otherwise noted, all of the documentation and software included 5 | in allSnap is copyrighted by Ivan Heckman. 6 | 7 | Copyright (C) 2002-2004 Ivan Heckman. All rights reserved. 8 | 9 | USING THIS APPLICATION MAY POSSIBLY CAUSE OTHER RUNNING PROGRAMS TO CRASH 10 | 11 | This software is provided "as-is," without any express or implied warranty. 12 | In no event shall the author be held liable for any damages arising from the 13 | use of this software. 14 | 15 | 16 | Permission is granted to anyone to use this software for any purpose, and to 17 | alter and redistribute it, provided that the following conditions are met: 18 | 19 | 1. All redistributions in binary form must retain all occurrences of the above copyright notice and web site addresses that are currently in place (for example, in the About boxes). 20 | 21 | 2. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. 22 | 23 | 3. Modified versions must be plainly marked as such (e.g. Resource edits, source code not available), and must not be misrepresented as being the original software. 24 | 25 | 26 | Ivan Heckman 27 | ivanheckman@hotmail.com 28 | http://members.rogers.com/ivanheckman -------------------------------------------------------------------------------- /IE5.CSS: -------------------------------------------------------------------------------- 1 | 2 | 3 | BODY , table.clsComment 4 | { 5 | font-family: verdana; 6 | } 7 | 8 | 9 | table.clsNavLinks A , table.clsComment A , table.clsTeasers A 10 | { 11 | font-weight: bold; 12 | color: #003399; 13 | text-decoration: none; 14 | } 15 | 16 | table.clsNavLinks TD 17 | { 18 | border-bottom: solid #000000 1px; 19 | padding: 5px 10px; 20 | font-family: verdana; 21 | font-size: x-small; 22 | } 23 | 24 | table.clsNavLinks TD TD 25 | { 26 | border: 0px; 27 | padding: 0px; 28 | } 29 | 30 | DIV.clsError 31 | { 32 | font-size: 68%; 33 | } 34 | 35 | TABLE DIV.clsContainer 36 | { 37 | padding-top: 10px; 38 | padding-bottom: 10px; 39 | position: relative; 40 | font-size: 68%; 41 | width:100%; 42 | background-color: #CCCCCC; 43 | border-TOP: solid #FFFFFF 1px; 44 | } 45 | 46 | 47 | TABLE TABLE DIV.clsContainer 48 | { 49 | background-color: #FFFFFF; 50 | border-TOP: solid #CCCCCC 1px; 51 | } 52 | 53 | 54 | 55 | td.clsHDN table 56 | { 57 | display:none; 58 | } 59 | 60 | 61 | SPAN.clsRespond 62 | { 63 | text-align: right; 64 | padding-right: 10px; 65 | width: 50%; 66 | } 67 | 68 | SPAN.clsSig 69 | { 70 | width: 49%; 71 | } 72 | 73 | 74 | SPAN.clsToggle 75 | { 76 | position: absolute; 77 | left: 2; 78 | top: .65em; 79 | } 80 | 81 | 82 | -------------------------------------------------------------------------------- /StdAfx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) 7 | #define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ 8 | 9 | #if _MSC_VER > 1000 10 | #pragma once 11 | #endif // _MSC_VER > 1000 12 | 13 | #define STRICT 14 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 15 | //#define WINVER 0x0500 16 | #define _WIN32_WINNT 0x0501 17 | #define WINVER 0x0501 18 | 19 | 20 | #if defined( _MSC_VER ) && !defined( __STDC__ ) 21 | #define INLINE __inline 22 | #else 23 | #define INLINE 24 | #endif 25 | 26 | // Windows Header Files: 27 | #include 28 | 29 | // C RunTime Header Files 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #include "CmnHdr.h" 37 | #include "mydebug.h" 38 | 39 | #define MAX_LOADSTRING 100 40 | 41 | // Local Header Files 42 | 43 | // TODO: reference additional headers your program requires here 44 | 45 | //{{AFX_INSERT_LOCATION}} 46 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 47 | 48 | #endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) 49 | -------------------------------------------------------------------------------- /snap_TrackResults.c: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "snap_testers.h" 3 | #include "snap_MouseSpeed.h" 4 | #include "sides.h" 5 | #include "snap_lib_internal.h" 6 | #include "snap_mywm_msg.h" 7 | #include "snap_TrackResults.h" 8 | 9 | void PlaySounds(SNAP_RESULTS * p_snap_results,SNAP_RESULTS * p_last_results); 10 | static SNAP_RESULTS g_last_result={{SIDE_NONE,0,0,0},{SIDE_NONE,0,0,0}}; 11 | //static BOOL skipped_last_snap = FALSE; 12 | //static BOOL skipped_last_unsnap = FALSE; 13 | //static UINT last_canceled_message = WM_NULL; 14 | 15 | PSNAP_RESULTS TrackRslts_GetLast(void){ 16 | return &g_last_result; 17 | } 18 | 19 | 20 | void TrackRslts_Reset(void){ 21 | clear_snap_results(&g_last_result); 22 | } 23 | 24 | 25 | void TrackRslts_Track(PSNAP_RESULTS psnap_results){ 26 | PlaySounds(psnap_results,&g_last_result); 27 | g_last_result = *psnap_results; 28 | } 29 | 30 | 31 | INLINE void PlaySounds(SNAP_RESULTS * psr, 32 | SNAP_RESULTS * last_psr) 33 | { 34 | if ( isNoisy() 35 | && !(MouseSpeed_isFast()) 36 | ){ 37 | if( NEW_SNAP(psr,last_psr)){ 38 | PostThreadMessage(g_sounds_thread_id,MYWM_SNAPSOUND,0,0); 39 | //PostMessage(g_hWnd_app,MYWM_SNAPSOUND,(WPARAM)NULL,(LPARAM)NULL); 40 | } 41 | else if(NEW_UNSNAP(psr,last_psr)){ 42 | PostThreadMessage(g_sounds_thread_id,MYWM_UNSNAPSOUND,0,0); 43 | //PostMessage(g_hWnd_app,MYWM_UNSNAPSOUND,(WPARAM)NULL,(LPARAM)NULL); 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /knownproblems.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | allSnap - Known Problems 5 | 6 | 7 | 8 | 9 | 10 |

Known Problems

11 | 12 |

Performance/Stability

13 |

This program works through window hooking. Hooking is a technique that Microsoft suggest you only use in debugging because it can slow the system down, and interfere with any other program on your system (or even crash them!). So use at your own risk.

14 | 15 |

Cannot delete snap_libX.dll

16 |

When allSnap is closed in the middle of its uninstall, or in certain other situations, the library file 17 | (snap_libA.dll or snap_libW.dll) is not released correctly. 18 | This makes the uninstaller unable to delete the dll. If this occurs, restart the computer and delete the file and directory manually.

19 | 20 |

Window doesn't snap

21 |

Here is an incomplete list of windows allSnap cannot affect:

22 |

    23 |
  • Non top-level windows (e.g. floating toolbars)
  • 24 |
  • Programs with their own custom moving/sizing behaviour (e.g. Winamp, RealOne player)
  • 25 |
  • Windows 2000/XP command prompt window
  • 26 |
27 |

28 | This may cause the strange effect of windows that can be snapped to but not snap themselves.

29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /drguiquestion.txt: -------------------------------------------------------------------------------- 1 | BOOL WINAPI DllMain(HINSTANCE hinstDll, DWORD fdwReason, PVOID fImplLoad){ 2 | 3 | switch(fdwReason){ 4 | case DLL_PROCESS_ATTACH: 5 | //DLL is attaching to the address space of the current process 6 | g_hinstDll = hinstDll; 7 | break; 8 | } 9 | return(TRUE); 10 | } 11 | 12 | BOOL WINAPI SnapHookAll(){ 13 | g_hhook = SetWindowsHookEx(WH_GETMESSAGE,GetMsgProc,g_hinstDll,0); 14 | return (g_hhook!= NULL); 15 | } 16 | 17 | LRESULT WINAPI GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam){ 18 | LPMSG pmsg = (LPMSG)lParam; 19 | HWND edit; 20 | static BOOL fFirstTime = TRUE; 21 | 22 | if (fFirstTime){ 23 | fFirstTime = FALSE; 24 | //dll just got injected 25 | snapper_UpdateWorkArea(); 26 | } 27 | 28 | if (nCode < 0) // do not process message 29 | return CallNextHookEx(g_hhook, nCode, 30 | wParam, lParam); 31 | 32 | switch (nCode) 33 | { 34 | case HC_ACTION: 35 | switch(pmsg->message){ 36 | // case WM_MOUSEMOVE: 37 | // MessageBeep(-1); This one will work 38 | case WM_ENTERSIZEMOVE: 39 | snapper_OnEnterSizeMove(); 40 | break; 41 | case WM_MOVING: 42 | snapper_OnMoving((LPRECT)(pmsg->lParam)); 43 | break; 44 | case WM_SIZING: 45 | snapper_OnSizing(wParam,(LPRECT)(pmsg->lParam)); 46 | break; 47 | case WM_SETTINGCHANGE: 48 | snapper_UpdateWorkArea(); 49 | break; 50 | 51 | } 52 | } 53 | 54 | return(CallNextHookEx(g_hhook, nCode, wParam, lParam)); 55 | } 56 | -------------------------------------------------------------------------------- /snap_MultiSz.c: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "snap_lib_internal.h" 3 | #include "snap_MultiSz.h" 4 | 5 | void setMultiSz(TCHAR * p_target,TCHAR * p_source,int max_item_length,int max_total_length){ 6 | int count = 0; 7 | 8 | if (!(*p_target)){ 9 | p_target[0] = _T('\0'); 10 | p_target[1] = _T('\0'); 11 | return; 12 | } 13 | 14 | while ( *p_source && (count < max_total_length)){ 15 | int coppied_length; 16 | TCHAR * just_coppied; 17 | 18 | just_coppied = lstrcpyn(p_target,p_source,max_item_length); 19 | 20 | coppied_length = lstrlen(just_coppied) + 1; 21 | 22 | p_target += coppied_length; 23 | count += coppied_length; 24 | 25 | p_source += lstrlen(p_source) + 1; 26 | } 27 | 28 | *p_target = _T('\0'); //double null at the end 29 | 30 | } 31 | 32 | BOOL isStrInMulti(LPCTSTR str, TCHAR * multi_sz){ 33 | for(multi_sz; *multi_sz; multi_sz += lstrlen(multi_sz)+1){ 34 | if ((lstrcmp(str,multi_sz)==0)){ 35 | return TRUE; 36 | } 37 | } 38 | return FALSE; 39 | } 40 | 41 | BOOL is_name_in_classlist(LPCTSTR str,LPCTSTR class_list){ 42 | TCHAR * pch; 43 | TCHAR * next_token; 44 | TCHAR buffer[MAX_CLASSNAME_LIST_LENGTH + 2]; 45 | lstrcpyn(buffer,class_list,MAX_CLASSNAME_LIST_LENGTH); 46 | buffer[MAX_CLASSNAME_LIST_LENGTH] = 0; 47 | 48 | 49 | pch = _tcstok_s(buffer,_T(";"),&next_token); 50 | while (pch != NULL) 51 | { 52 | if ((lstrcmp(str,pch)==0)){ 53 | return TRUE; 54 | } 55 | pch = _tcstok_s(NULL,_T(";"),&next_token); 56 | } 57 | return FALSE; 58 | } -------------------------------------------------------------------------------- /SIDES.H: -------------------------------------------------------------------------------- 1 | #ifndef __SIDERECT_H__ 2 | #define __SIDERECT_H__ 3 | 4 | #include 5 | 6 | #define isVerticalSide(side) ( ((side) == SIDE_TOP) || ((side) == SIDE_BOTTOM)) 7 | #define isLargerSide(side) ( ((side) == SIDE_RIGHT) || ((side) == SIDE_BOTTOM)) 8 | #define rectWidth(rect) ((rect).right - (rect).left) 9 | #define rectHeight(rect) ((rect).bottom - (rect).top) 10 | 11 | enum SIDE {SIDE_NONE,SIDE_LEFT,SIDE_RIGHT,SIDE_TOP,SIDE_BOTTOM}; 12 | enum DIMENSION {DIM_NONE,DIM_VERT,DIM_HORZ}; 13 | 14 | enum SIDE OppositeSide(enum SIDE what_side); 15 | enum SIDE AdjacentSide(enum SIDE what_side); 16 | 17 | //Get and set side of Rect given a side 18 | int GetSideOfRect(enum SIDE what_side, const LPCRECT pRect); 19 | 20 | void SetSideOfRect(enum SIDE what_side, int new_val, LPRECT pRect); 21 | 22 | int GetSideSign(enum SIDE); 23 | 24 | TCHAR * SideToString(enum SIDE which_side); 25 | 26 | //align a side of my_rect to a certain position 27 | void AlignToSide 28 | ( 29 | LPRECT my_rect, 30 | enum SIDE align_side, 31 | int position 32 | ); 33 | 34 | //Align Alignee's AligneeSide 35 | //with Aligner's AlignerSide 36 | void AlignToRect 37 | ( 38 | LPCRECT Aligner, 39 | LPRECT Alignee, 40 | enum SIDE AlignerSide, 41 | enum SIDE AligneeSide 42 | ); 43 | 44 | 45 | //Take WPARAM from a WM_SIZING message which denotes what edge is being sized 46 | //and split it into two SIDE variables 47 | void split_edge(WPARAM which_edge, enum SIDE * vert_side, enum SIDE * horz_side); 48 | 49 | #endif //__SIDERECT_H__ -------------------------------------------------------------------------------- /snap_results.h: -------------------------------------------------------------------------------- 1 | //snap_results.h 2 | //definition of the struct used to 3 | //store results of individual and final snap tests 4 | 5 | #ifndef SNAP_RESULTS_INCLUDE 6 | #define SNAP_RESULTS_INCLUDE 7 | 8 | typedef struct SIDE_SNAP_RESULTS_TAG{ 9 | enum SIDE side; //what SIDE of the window got a snap 10 | enum SIDE to_side; //what SIDE did it snap to. 11 | int value; //what should the new position of that SIDE be 12 | int closeness; //how close to the snap line was it. 13 | int thresh; //threshold of the snap; 14 | BOOL from_oss; //this side was snapped because of a outside corner snap. 15 | }SIDE_SNAP_RESULTS; 16 | 17 | typedef struct SNAP_RESULTS_TAG{ 18 | SIDE_SNAP_RESULTS h; 19 | SIDE_SNAP_RESULTS v; 20 | }SNAP_RESULTS, *PSNAP_RESULTS; 21 | 22 | #define NO_SNAP(result)(((result).h.side == SIDE_NONE) && \ 23 | ((result).v.side == SIDE_NONE) ) 24 | 25 | #define BOTH_SNAP(result) (((result).h.side != SIDE_NONE) && \ 26 | ((result).v.side != SIDE_NONE) ) 27 | 28 | #define INSIDE_SNAP(srd)( (srd).side == (srd).to_side) 29 | 30 | #define NEW_SIDE_SNAP(sr_s,last_sr_s)( sr_s.side != SIDE_NONE \ 31 | && ( (sr_s.side != last_sr_s.side) \ 32 | ||(sr_s.value != last_sr_s.value))) 33 | 34 | #define NEW_SIDE_UNSNAP(sr_s,last_sr_s)( (sr_s.side==SIDE_NONE) \ 35 | && (last_sr_s.side!=SIDE_NONE)) 36 | 37 | #define NEW_SNAP(psr,last_psr)( NEW_SIDE_SNAP((psr)->h,(last_psr)->h) \ 38 | || NEW_SIDE_SNAP((psr)->v,(last_psr)->v)) 39 | 40 | #define NEW_UNSNAP(psr,last_psr)( NEW_SIDE_UNSNAP((psr)->h,(last_psr)->h) \ 41 | || NEW_SIDE_UNSNAP((psr)->v,(last_psr)->v)) 42 | 43 | 44 | #endif -------------------------------------------------------------------------------- /snap_testinfo.h: -------------------------------------------------------------------------------- 1 | //snap_TestInfo.h 2 | 3 | #ifndef SNAP_TESTINFO_INCLUDE 4 | #define SNAP_TESTINFO_INCLUDE 5 | 6 | #include "windef.h" 7 | #include "snap_ResultStack.h" 8 | 9 | #define IS_SIZABLE_SIDE(my_side,p_test_info)((!((p_test_info)->sizing)) \ 10 | || ((p_test_info)->centering) \ 11 | || \ 12 | (((p_test_info)->h_sizing_side != OppositeSide((my_side))) \ 13 | && ((p_test_info)->v_sizing_side != OppositeSide((my_side))) \ 14 | ))\ 15 | 16 | 17 | typedef WPARAM SIZING_MODE; 18 | 19 | typedef struct TEST_RECTS_INFO_TAG{ 20 | RECT * screens; 21 | int num_screens; 22 | 23 | RECT * hcenter_move_rects; //hcentered position 24 | int num_hcenter_move_rects; 25 | RECT * hcenter_size_rects; //hcentered position 26 | int num_hcenter_size_rects; 27 | 28 | RECT * vcenter_move_rects; //vcentered position 29 | int num_vcenter_move_rects; 30 | RECT * vcenter_size_rects; //vcentered position 31 | int num_vcenter_size_rects; 32 | 33 | RECT * win_rects; //windows to test against 34 | int num_win_rects; 35 | }TEST_RECTS, * PTEST_RECTS; 36 | 37 | typedef struct TEST_INFO_TAG{ 38 | BOOL sizing; //is this a snap test while sizing 39 | BOOL centering; //is the centersizing toggle enabled 40 | enum SIDE v_sizing_side; 41 | enum SIDE h_sizing_side;//which edge is being draged, (used to update results not chose which edges to test) 42 | LPCRECT mine; 43 | LPCRECT yours; 44 | int threshold; 45 | int side_threshold; 46 | BOOL snap_insides; 47 | ResultStack * p_h_rstck; 48 | ResultStack * p_v_rstck; 49 | }TEST_INFO; 50 | 51 | #endif -------------------------------------------------------------------------------- /snap_CropTop.c: -------------------------------------------------------------------------------- 1 | /snap_CropTop.c 2 | //fix for certain XP styles that are taller than they look. 3 | 4 | #include "stdafx.h" 5 | #include 6 | #include "snap_CropTop.h" 7 | #include "snap_lib_internal.h" 8 | #include "sides.h" 9 | #include "snap_MultiSz.h" 10 | 11 | #define MAX_SKINNEDAPP_CLASSNAME_SIZE 20 12 | #define num_skinnedAppClasses 7 13 | //THIS SHOULD BE IN THE REGISTRY 14 | // 15 | // and a dialog box where you can point/drag a target onto 16 | // the windows you want to add. 17 | // 18 | 19 | BOOL IsSkinnedAppClass(HWND our_hWnd); 20 | BOOL isStrInMulti(LPCTSTR str, TCHAR * multi_sz); 21 | 22 | BOOL should_we_crop_this(HWND hwnd){ 23 | return (!IsSkinnedAppClass(hwnd) && isCroppingTop()); 24 | 25 | } 26 | 27 | void snap_CropTop(LPRECT rcWindow){ 28 | int crop = getCropTop(); 29 | 30 | if (isCroppingTop()){ 31 | rcWindow->top = (rcWindow->top + crop); 32 | } 33 | } 34 | 35 | void snap_UnCropTop(LPRECT rcWindow){ 36 | int crop = getCropTop(); 37 | if (crop != 0){ 38 | rcWindow->top = (rcWindow->top - crop); 39 | } 40 | } 41 | 42 | void snap_UnCropResults(SNAP_RESULTS * psnap_results){ 43 | int crop = getCropTop(); 44 | if (isCroppingTop() 45 | && (psnap_results->v.side== SIDE_TOP)){ 46 | psnap_results->v.value = (psnap_results->v.value - crop); 47 | } 48 | 49 | } 50 | 51 | BOOL IsSkinnedAppClass(HWND our_hWnd){ 52 | TCHAR pszClassName[MAX_SKINNEDAPP_CLASSNAME_SIZE]; 53 | 54 | GetClassName(our_hWnd,pszClassName,MAX_CLASSNAME_LENGTH); 55 | 56 | return isStrInMulti(pszClassName,getSkinnedClasses()); 57 | /*for (i=0;itopRight_out; 9 | } 10 | else{ 11 | return pci->topLeft_out; 12 | } 13 | 14 | } 15 | else{ // (v_side == SIDE_BOTTOM) 16 | 17 | if (h_side == SIDE_RIGHT){ 18 | return pci->bottomRight_out; 19 | } 20 | else{ 21 | return pci->bottomLeft_out; 22 | } 23 | } 24 | } 25 | 26 | BOOL isSideOut (P_CORNER_INFO pci, enum SIDES side){ 27 | enum SIDES adj1 = AdjacentSide(side); 28 | enum SIDES adj2 = OppositeSide(adj1); 29 | 30 | if (isVerticalSide(side)){ 31 | return isCornerOut(pci,side,adj1) && 32 | isCornerOut(pci,side,adj2); 33 | } 34 | else{ 35 | return isCornerOut(pci,adj1,side) && 36 | isCornerOut(pci,adj2,side); 37 | } 38 | } 39 | 40 | BOOL isSideIn (P_CORNER_INFO pci, enum SIDES side){ 41 | enum SIDES adj1 = AdjacentSide(side); 42 | enum SIDES adj2 = OppositeSide(AdjacentSide(side)); 43 | 44 | if (isVerticalSide(side)){ 45 | return (!isCornerOut(pci,side,adj1)) 46 | && (!isCornerOut(pci,side,adj2)); 47 | } 48 | else{ 49 | return (!isCornerOut(pci,adj1,side)) 50 | && (!isCornerOut(pci,adj2,side)); 51 | } 52 | } 53 | 54 | #define XOR(x,y) (((x)||(y))&&!((x)&&(y))) 55 | 56 | BOOL isOnlyOneCornerOfSideOut (P_CORNER_INFO pci, enum SIDES side){ 57 | enum SIDES adj1 = AdjacentSide(side); 58 | enum SIDES adj2 = OppositeSide(adj1); 59 | 60 | if (isVerticalSide(side)){ 61 | return XOR(isCornerOut(pci,side,adj1),isCornerOut(pci,side,adj2)); 62 | } 63 | else{ 64 | return XOR(isCornerOut(pci,adj1,side),isCornerOut(pci,adj2,side)); 65 | } 66 | } -------------------------------------------------------------------------------- /snap_grid.c: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "snap_grid.h" 3 | 4 | #include "snap_lib.h" 5 | 6 | void WINAPI setHGridEnabled(BOOL enabled){ 7 | gridsnap_settings_t settings; 8 | getGridSnap(&settings); 9 | settings.h.enabled = enabled; 10 | setGridSnap(&settings); 11 | } 12 | 13 | void WINAPI setHGridType(int type){ 14 | gridsnap_settings_t settings; 15 | getGridSnap(&settings); 16 | settings.h.type = type; 17 | setGridSnap(&settings); 18 | } 19 | 20 | void WINAPI setHGridVal(int val){ 21 | gridsnap_settings_t settings; 22 | getGridSnap(&settings); 23 | settings.h.val = val; 24 | setGridSnap(&settings); 25 | } 26 | void WINAPI setVGridEnabled(BOOL enabled){ 27 | gridsnap_settings_t settings; 28 | getGridSnap(&settings); 29 | settings.v.enabled = enabled; 30 | setGridSnap(&settings); 31 | } 32 | 33 | void WINAPI setVGridType(int type){ 34 | gridsnap_settings_t settings; 35 | getGridSnap(&settings); 36 | settings.v.type = type; 37 | setGridSnap(&settings); 38 | } 39 | 40 | void WINAPI setVGridVal(int val){ 41 | gridsnap_settings_t settings; 42 | getGridSnap(&settings); 43 | settings.v.val = val; 44 | setGridSnap(&settings); 45 | } 46 | 47 | BOOL WINAPI isHGridEnabled(){ 48 | gridsnap_settings_t settings; 49 | getGridSnap(&settings); 50 | return settings.h.enabled; 51 | } 52 | int WINAPI getHGridType(){ 53 | gridsnap_settings_t settings; 54 | getGridSnap(&settings); 55 | return settings.h.type; 56 | } 57 | int WINAPI getHGridVal(){ 58 | gridsnap_settings_t settings; 59 | getGridSnap(&settings); 60 | return settings.h.val; 61 | } 62 | BOOL WINAPI isVGridEnabled(){ 63 | gridsnap_settings_t settings; 64 | getGridSnap(&settings); 65 | return settings.v.enabled; 66 | } 67 | int WINAPI getVGridType(){ 68 | gridsnap_settings_t settings; 69 | getGridSnap(&settings); 70 | return settings.v.type; 71 | } 72 | int WINAPI getVGridVal(){ 73 | gridsnap_settings_t settings; 74 | getGridSnap(&settings); 75 | return settings.v.val; 76 | } -------------------------------------------------------------------------------- /CTXHELP.TXT: -------------------------------------------------------------------------------- 1 | .topic IDH_SELF 2 | Snap to a window's old position. 3 | 4 | .topic IDH_OTHERS 5 | Snap to all other windows. 6 | 7 | .topic IDH_DESKTOP 8 | Snap to the edges of the screen(s). 9 | 10 | .topic IDH_VCENTER 11 | Snap to the vertical center of the sceen(s). 12 | 13 | .topic IDH_HCENTER 14 | Snap to the horizontal center of the screen(s). 15 | 16 | .topic IDH_ENABLED 17 | Enables window snapping. 18 | 19 | .topic IDH_PLAYSOUNDS 20 | Plays sounds when windows snap and unsnap. (May become annoying) 21 | 22 | .topic IDH_UNSNAP_FILE 23 | .wav file that is played when a window un-snaps. 24 | 25 | .topic IDH_BROWSE_UNSNAP 26 | Click to select a new .wav file for the un-snapping sound 27 | 28 | .topic IDH_SNAP_FILE 29 | .wav file that is played when a window snaps. 30 | 31 | .topic IDH_BROWSE_SNAP 32 | Click to select a new .wav file for the snapping sound 33 | 34 | .topic IDH_TOGGLEKEYS 35 | Lists keys you can use to temporarily disable window snapping. 36 | 37 | .topic IDH_SCREEN_THRESH 38 | Adjusts how close a window must be to the edge of the screen before it snaps. 39 | 40 | .topic IDH_WIN_THRESH 41 | Adjusts how close two windows must be before they snap. 42 | 43 | .topic IDH_SNAPTOL 44 | Choose what windows you can snap to. 45 | 46 | .topic IDH_GENERALL 47 | General settings 48 | 49 | .topic IDH_SOUNDS 50 | Sound settings 51 | 52 | .topic IDH_SNAPMDI 53 | Makes other applications' MDI windows snap. 54 | 55 | .topic IDH_QUIETFAST 56 | Don't play snap sounds when moving or sizing quickly across the screen. 57 | 58 | .topic IDH_INSIDES 59 | Don't snap windows to the inside edges of other windows. 60 | 61 | .topic IDH_INVTOGGLE 62 | Inverts the toggle key. (press to enable snapping) 63 | 64 | .topic IDH_ADVL 65 | Advanced settings 66 | 67 | .topic IDH_PLAY 68 | Play the selected sound. 69 | 70 | .topic IDH_CROPTOP 71 | Used to fix XP styles in which the windows are taller than they appear. 72 | 73 | .topic IDH_HIDEICON 74 | Hides the system tray icon. Run allSnap again to un-hide the icon. 75 | 76 | .topic IDH_KEPT 77 | Prevents windows from moving off the sides of the screen. 78 | -------------------------------------------------------------------------------- /snap_CenterSize.c: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "snap_WinRects.h" 3 | #include "snap_TestInfo.h" 4 | #include "snap_CornerInfo.h" 5 | #include "snap_InTests.h" 6 | #include "snap_lib_internal.h" 7 | #include 8 | 9 | #define MY_MIN_WIN_HEIGHT (16) 10 | #define MY_MIN_WIN_WIDTH (8) 11 | 12 | //globals to remeber middle of win at start of sizing 13 | static int g_x_center_at_start = 0; 14 | static int g_y_center_at_start = 0; 15 | 16 | BOOL isCentered(void){ 17 | return (GetAsyncKeyState(getCenterKey())!=0); 18 | } 19 | 20 | void CenterSize_Adjust(RECT * p_init_rect,enum SIDE v_side,enum SIDE h_side){ 21 | chASSERT( (h_side == SIDE_LEFT) || (h_side == SIDE_RIGHT) || (h_side == SIDE_NONE)); 22 | chASSERT( (v_side == SIDE_TOP) || (v_side == SIDE_BOTTOM) || (v_side == SIDE_NONE)); 23 | 24 | if (h_side != SIDE_NONE){ 25 | if (h_side == SIDE_RIGHT){ 26 | int drag_x = p_init_rect->right; 27 | if(drag_x > g_x_center_at_start){ 28 | p_init_rect->left = g_x_center_at_start - (drag_x - g_x_center_at_start); 29 | 30 | } 31 | 32 | } 33 | else{ 34 | int drag_x = p_init_rect->left; 35 | if(drag_x < g_x_center_at_start){ 36 | p_init_rect->right = g_x_center_at_start + (g_x_center_at_start - drag_x); 37 | } 38 | } 39 | } 40 | 41 | if (v_side != SIDE_NONE){ 42 | if (v_side == SIDE_BOTTOM){ 43 | int drag_y = p_init_rect->bottom; 44 | if (drag_y > g_y_center_at_start){ 45 | p_init_rect->top = g_y_center_at_start - (drag_y - g_y_center_at_start); 46 | } 47 | } 48 | else{ 49 | int drag_y = p_init_rect->top; 50 | if(drag_y < g_y_center_at_start){ 51 | p_init_rect->bottom = g_y_center_at_start + (g_y_center_at_start - drag_y); 52 | } 53 | } 54 | } 55 | 56 | } 57 | 58 | 59 | void CenterSize_Init(HWND hWnd){ 60 | RECT start_rect; 61 | int win_height,win_width; 62 | 63 | GetWindowRect(hWnd,&start_rect); 64 | 65 | win_height = start_rect.bottom - start_rect.top +1; 66 | win_width = start_rect.right - start_rect.left +1; 67 | 68 | g_y_center_at_start = start_rect.top + (win_height/2); 69 | g_x_center_at_start = start_rect.left + (win_width/2); 70 | } -------------------------------------------------------------------------------- /snap_sounds.c: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include 3 | #include 4 | #include "snap_sounds.h" 5 | #include "snap_lib.h" 6 | #include "snap_mywm_msg.h" 7 | 8 | 9 | TCHAR aszSoundPaths[NUM_SOUNDS][MAX_PATH]; 10 | static LPCTSTR g_file_path; 11 | 12 | DWORD WINAPI MessageLoop(void); 13 | 14 | void SnapSounds_setPath (enum SNAP_SOUNDS which_sound, LPCTSTR file_path){ 15 | lstrcpy(aszSoundPaths[which_sound],file_path); 16 | } 17 | 18 | LPTSTR SnapSounds_getPath (enum SNAP_SOUNDS which_sound){ 19 | return aszSoundPaths[which_sound]; 20 | } 21 | 22 | void WINAPI setSnapSound(LPCTSTR file_path,int len){ 23 | SnapSounds_setPath(SOUND_SNAP,file_path); 24 | } 25 | LPTSTR WINAPI getSnapSound(){ 26 | return SnapSounds_getPath(SOUND_SNAP); 27 | } 28 | void WINAPI setUnsnapSound(LPCTSTR file_path, int len){ 29 | SnapSounds_setPath(SOUND_UNSNAP,file_path); 30 | } 31 | LPTSTR WINAPI getUnsnapSound(){ 32 | return SnapSounds_getPath(SOUND_UNSNAP); 33 | } 34 | 35 | 36 | void SnapSounds_Play (enum SNAP_SOUNDS which_sound){ 37 | //#ifndef NOHTMLHELP 38 | if (isNoisy()){ 39 | //PlaySound(aszSoundPaths[which_sound],NULL,SND_FILENAME | SND_ASYNC); 40 | } 41 | //#endif 42 | } 43 | 44 | void SnapSounds_Test(LPCTSTR file_path){ 45 | //#ifndef NOHTMLHELP 46 | PlaySound(file_path,NULL,SND_FILENAME | SND_ASYNC); 47 | //#endif 48 | } 49 | 50 | void SnapSounds_StopTest(void){ 51 | //#ifndef NOHTMLHELP 52 | PlaySound(NULL,NULL,SND_ASYNC); 53 | //#endif 54 | } 55 | 56 | DWORD WINAPI MessageLoop(void){ 57 | MSG msg; 58 | BOOL running = TRUE; 59 | 60 | SnapSounds_Play(SOUND_SNAP); 61 | 62 | while(running && GetMessage(&msg,NULL,0,0)){ 63 | switch(msg.message){ 64 | case MYWM_CLOSETHREAD: 65 | running = FALSE; 66 | break; 67 | case MYWM_SNAPSOUND: 68 | SnapSounds_Play(SOUND_SNAP); 69 | break; 70 | case MYWM_UNSNAPSOUND: 71 | SnapSounds_Play(SOUND_UNSNAP); 72 | break; 73 | } 74 | } 75 | return(0); 76 | } 77 | UINT SnapSounds_BeginThread(void){ 78 | UINT thread_id = 0; 79 | //#ifndef NOHTMLHELP 80 | 81 | HANDLE hThread = chBEGINTHREADEX( NULL, 0, &MessageLoop, NULL, 0, 82 | &thread_id ); 83 | 84 | CloseHandle(hThread); 85 | //#endif 86 | 87 | return thread_id; 88 | } -------------------------------------------------------------------------------- /snap_EqualSize.c: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "snap_WinRects.h" 3 | #include "snap_TestInfo.h" 4 | #include "snap_CornerInfo.h" 5 | #include "snap_InTests.h" 6 | #include "snap_lib_internal.h" 7 | #include 8 | 9 | RECT g_initial_rect; 10 | double g_aspect_ratio; 11 | double g_inv_ratio; 12 | 13 | BOOL isEqualing(void){ 14 | #ifdef SIZINGTOGGLE_ENABLED 15 | return (GetAsyncKeyState(getEqualKey())!=0); 16 | #else 17 | return 0; 18 | #endif 19 | } 20 | 21 | void EqualSize_Init(HWND hwnd){ 22 | GetWindowRect(hwnd,&g_initial_rect); 23 | g_aspect_ratio = (double)(rectWidth(g_initial_rect)) / 24 | (double)(rectHeight(g_initial_rect)); 25 | g_inv_ratio = (double)(rectHeight(g_initial_rect))/ 26 | (double)(rectWidth(g_initial_rect)); 27 | } 28 | 29 | 30 | void EqualSize_Adjust(RECT * p_init_rect,enum SIDE v_side,enum SIDE h_side){ 31 | //adjust the sizing of the window so that when dragged from corner v_side,h_side 32 | //it keeps the same aspect ration as the original 33 | if(v_side == SIDE_BOTTOM){ 34 | int dy = p_init_rect->bottom - g_initial_rect.bottom; 35 | if(h_side == SIDE_RIGHT){ 36 | int dx = p_init_rect->right - g_initial_rect.right; 37 | if (dx > dy){ 38 | //make height proportional to width by extending out the bottom 39 | int new_height = (int)( (double)rectWidth(*p_init_rect) * g_inv_ratio); 40 | p_init_rect->bottom = 41 | p_init_rect->top + new_height; 42 | } 43 | else{///dy <=dx 44 | //make width proportional to height by extending out the right 45 | int new_width = (int)( (double)rectHeight(*p_init_rect) * g_aspect_ratio); 46 | p_init_rect->right = p_init_rect->left + new_width; 47 | } 48 | } 49 | else{ //h_side == SIDE_LEFT 50 | int dx = g_initial_rect.left - p_init_rect->left; 51 | if (dx > dy){ 52 | //make height proportional to width by extending out the bottom 53 | int new_height = (int)( (double)rectWidth(*p_init_rect) * g_inv_ratio); 54 | p_init_rect->bottom = 55 | p_init_rect->top + new_height; 56 | } 57 | else{ 58 | //make width proportional to height by extending out the left 59 | int new_width = (int)( (double)rectHeight(*p_init_rect) * g_aspect_ratio); 60 | p_init_rect->left = p_init_rect->right - new_width; 61 | } 62 | 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /snap_CropTop.c.bak.c: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include 3 | #include "snap_CropTop.h" 4 | /* 5 | static TCHAR *ignoreClassList[]={ _T("Progman"), //entire screen (just want work area) 6 | _T("Shell_TrayWnd"), //task bar 7 | _T("IDEOwner")}; 8 | */ 9 | 10 | typedef HTHEME (WINAPI *PFNOPENTHEMEDATA)( 11 | HWND hwnd, 12 | LPCWSTR pszClassList 13 | ); 14 | 15 | static BOOL tried_and_failed = FALSE; 16 | HMODULE hinstUxthemeDll = NULL; 17 | PFNOPENTHEMEDATA pfnOpenThemeData = NULL; 18 | 19 | BOOL should_we_crop_this(HWND hwnd){ 20 | // HRGN hrgn = GetWindowRgn(hwnd); 21 | // RECT rcRgnBox; 22 | // GetRgnBox(hrgn,&rcRgnBox); 23 | /*if ( (g_os.dwMajorVersion >= 5) && (g_os.dwMinorVersion >= 1) 24 | && (getCropTop()!= 0)){ 25 | HTHEME hthm; 26 | if (hinstUxthemeDll == NULL && !tried_and_failed){ 27 | //DMB(_T("loading uxtheme.dll")); 28 | hinstUxthemeDll = LoadLibrary(_T("uxtheme.dll")); 29 | if (hinstUxthemeDll != NULL){ 30 | //DMB(_T("loaded dll, and now getting proc address")); 31 | pfnOpenThemeData = (PFNOPENTHEMEDATA)GetProcAddress(hinstUxthemeDll,"OpenThemeData"); 32 | 33 | if (pfnOpenThemeData == NULL){ 34 | FreeLibrary(hinstUxthemeDll); 35 | tried_and_failed = TRUE; 36 | return FALSE; 37 | } 38 | } 39 | else{ 40 | DMB(_T("couldn't load dll")); 41 | tried_and_failed = TRUE; 42 | } 43 | } 44 | 45 | if (pfnOpenThemeData!=NULL){ 46 | hthm = pfnOpenThemeData(hwnd,L"Window, WINDOW"); 47 | if (hthm==NULL){ 48 | MessageBeep(-1); 49 | } 50 | return (hthm != NULL); 51 | } 52 | else{ 53 | return FALSE; 54 | } 55 | } 56 | else{ 57 | return FALSE; 58 | }*/ 59 | return FALSE; 60 | 61 | } 62 | 63 | void snap_CropTop(LPRECT rcWindow){ 64 | int crop = getCropTop(); 65 | //maybe we should get the hWnd and check for ownerdraw style. 66 | 67 | if (crop != 0){ 68 | rcWindow->top = (rcWindow->top + crop); 69 | } 70 | } 71 | 72 | void snap_UnCropTop(LPRECT rcWindow){ 73 | int crop = getCropTop(); 74 | //maybe we should get the hWnd and check for ownerdraw style. 75 | 76 | if (crop != 0){ 77 | rcWindow->top = (rcWindow->top - crop); 78 | } 79 | } 80 | 81 | void snap_UnCropResults(SNAP_RESULTS * psnap_results){ 82 | int crop = getCropTop(); 83 | 84 | if ( (crop != 0) 85 | && (psnap_results->v.side== SIDE_TOP)){ 86 | psnap_results->v.value = (psnap_results->v.value - crop); 87 | } 88 | 89 | } -------------------------------------------------------------------------------- /snap_InTests.c: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "snap_InTests.h" 3 | #include "snap_WinRects.h" 4 | 5 | 6 | BOOL InTests_GetClosestScreenToPt(POINT pt, enum SIDES side, int * p_dist,LPRECT pScreen){ 7 | RECT pt_in_rect_form = {pt.x,pt.y,pt.x,pt.y}; 8 | *p_dist = InTests_GetClosestScreenToSide(side,&pt_in_rect_form,pScreen); 9 | return (*p_dist != -1); 10 | } 11 | 12 | int InTests_GetClosestScreenToSide(enum SIDES side,LPCRECT pRect, LPRECT pScreen){ 13 | int delta = 9999; 14 | int screen_index = -1; 15 | int i; 16 | int test_val = GetSideOfRect(side,pRect); 17 | enum SIDES op_side_low,op_side_high; 18 | int op_val_low,op_val_high; 19 | BOOL is_larger = isLargerSide(side); 20 | 21 | int num_screens = WinRects_GetNumScreens(); 22 | RECT * screens = WinRects_GetScreens(); 23 | 24 | 25 | op_side_high = (is_larger)?AdjacentSide(side):OppositeSide(AdjacentSide(side)); 26 | op_side_low = OppositeSide(op_side_high); 27 | 28 | op_val_low = GetSideOfRect(op_side_low,pRect); 29 | op_val_high = GetSideOfRect(op_side_high,pRect); 30 | 31 | for (i=0;i= GetSideOfRect(op_side_low,ps)) 36 | && (op_val_low <= GetSideOfRect(op_side_high,ps))) 37 | { 38 | new_delta = abs(is_larger? 39 | (test_val - GetSideOfRect(side,ps)) 40 | : (GetSideOfRect(side,ps) - test_val)); 41 | 42 | if ( (new_delta < delta)){ 43 | delta = new_delta; 44 | screen_index = i; 45 | } 46 | } 47 | } 48 | 49 | if (screen_index != -1){ 50 | *pScreen = screens[screen_index]; 51 | return delta; 52 | } 53 | else{ 54 | return -1; 55 | } 56 | } 57 | 58 | 59 | 60 | BOOL isPtInRect(LPCRECT pRect,POINT pt){ 61 | return ( ( (pt.x >= pRect->left) && (pt.x <= pRect->right)) 62 | && ( (pt.y >= pRect->top) && (pt.y <= pRect->bottom))); 63 | } 64 | 65 | BOOL InTests_isPtInMonitors(int x, int y){ 66 | int i=0; 67 | POINT pt = {x,y}; 68 | int num_screens = WinRects_GetNumScreens(); 69 | RECT * screens = WinRects_GetScreens(); 70 | 71 | for (i = 0;itopLeft_out = !InTests_isPtInMonitors(pRect->left ,pRect->top ); 82 | pci->topRight_out = !InTests_isPtInMonitors(pRect->right ,pRect->top ); 83 | pci->bottomLeft_out = !InTests_isPtInMonitors(pRect->left ,pRect->bottom ); 84 | pci->bottomRight_out= !InTests_isPtInMonitors(pRect->right ,pRect->bottom ); 85 | } 86 | -------------------------------------------------------------------------------- /resource.hm: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated Help ID include file. 2 | // Used by Snapit.rc 3 | // 4 | #define HIDC_BROWSE_SNAP 0x80a90408 // 169 [English (Canada)] 5 | #define HIDC_BROWSE_UNSNAP 0x80a90406 // 169 [English (Canada)] 6 | #define HIDC_CHOSEL 0x80a80420 // 168 [English (Canada)] 7 | #define HIDC_CROPTOP 0x80d30435 // 211 [English (Canada)] 8 | #define HIDC_CROPTOPC 0x80d30439 // 211 [English (Canada)] 9 | #define HIDC_CROPTOPL 0x80d30436 // 211 [English (Canada)] 10 | #define HIDC_CROP_RGN 0x80d3043d // 211 [English (Canada)] 11 | #define HIDC_DESKTOP 0x80a803f5 // 168 [English (Canada)] 12 | #define HIDC_ENABLED 0x80a803f8 // 168 [English (Canada)] 13 | #define HIDC_GENERALL 0x80a8041c // 168 [English (Canada)] 14 | #define HIDC_HIDEICON 0x80d30438 // 211 [English (Canada)] 15 | #define HIDC_INSIDES 0x80d30432 // 211 [English (Canada)] 16 | #define HIDC_INVTOGGLE 0x80d30433 // 211 [English (Canada)] 17 | #define HIDC_KEPT 0x80d3043b // 211 [English (Canada)] 18 | #define HIDC_OTHERS 0x80a803f7 // 168 [English (Canada)] 19 | #define HIDC_PIXELSL 0x80a8041a // 168 [English (Canada)] 20 | #define HIDC_PIXELSL2 0x80a80428 // 168 [English (Canada)] 21 | #define HIDC_PLAYSOUNDS 0x80a90402 // 169 [English (Canada)] 22 | #define HIDC_SCREEN_THRESH_SPIN 0x80a80418 // 168 [English (Canada)] 23 | #define HIDC_SELF 0x80a803f6 // 168 [English (Canada)] 24 | #define HIDC_SNAPATL 0x80a80419 // 168 [English (Canada)] 25 | #define HIDC_SNAPATL2 0x80a8041d // 168 [English (Canada)] 26 | #define HIDC_SNAPFILEL 0x80a9041e // 169 [English (Canada)] 27 | #define HIDC_SNAPMDI 0x80d3042d // 211 [English (Canada)] 28 | #define HIDC_SNAP_FILE 0x80a90407 // 169 [English (Canada)] 29 | #define HIDC_STATIC 0x80a8ffff // 168 [English (Canada)] 30 | #define HIDC_TOGGLEKEYL 0x80a8041b // 168 [English (Canada)] 31 | #define HIDC_TOGGLEKEYS 0x80a8040f // 168 [English (Canada)] 32 | #define HIDC_UNSNAPFILEL 0x80a9041f // 169 [English (Canada)] 33 | #define HIDC_UNSNAP_FILE 0x80a90405 // 169 [English (Canada)] 34 | #define HIDC_WIN_THRESH_SPIN 0x80a80417 // 168 [English (Canada)] 35 | -------------------------------------------------------------------------------- /snapTo.iss: -------------------------------------------------------------------------------- 1 | ;--snapTo Install 2 | ; 3 | ; 4 | 5 | [Setup] 6 | OutputBaseFilename=snapto100 7 | OutputDir=I:\IVAN\snapTo\site 8 | AppName=snapTo 9 | AppVerName=snapTo version 1.0 10 | AppMutex=IVAN_HECKMAN_SNAPTO_MUTEX 11 | AppCopyright=Copyright (C) 2002 Ivan Heckman 12 | DefaultDirName={pf}\snapTo 13 | DefaultGroupName=snapTo 14 | UninstallDisplayIcon={app}\snapTo.exe 15 | AlwaysCreateUninstallIcon=yes 16 | AllowNoIcons=yes 17 | ; uncomment the following line if you want your installation to run on NT 3.51 too. 18 | ; MinVersion=4,3.51 19 | 20 | [Files] 21 | Source: "snapTo\Release\snapTo.exe"; DestDir: "{app}" 22 | Source: "Release\snapToA.exe"; DestDir: "{app}" 23 | Source: "Release\snap_libA.dll"; DestDir: "{app}" 24 | Source: "Release_UNICODE\snapToW.exe"; DestDir: "{app}" 25 | Source: "Release_UNICODE\snap_libW.dll"; DestDir: "{app}" 26 | Source: "snap.wav"; DestDir: "{app}" 27 | Source: "unsnap.wav"; DestDir: "{app}" 28 | Source: "ReadMe.txt"; DestDir: "{app}"; Flags: isreadme 29 | 30 | [Tasks] 31 | Name: startup; Description: "Run snapTo on &startup"; Flags: unchecked; 32 | Name: desktopicon; Description: "Create a &desktop icon"; Flags: unchecked 33 | Name: quicklaunchicon; Description: "Create a &quick launch icon"; Flags: unchecked 34 | 35 | 36 | [Icons] 37 | Name: "{group}\snapTo"; Filename: "{app}\snapTo.EXE"; WorkingDir: "{app}" 38 | Name: "{userdesktop}\snapTo"; Filename: "{app}\snapTo.exe"; WorkingDir: "{app}"; Tasks: desktopicon 39 | Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\snapTo"; Filename: "{app}\snapTo.exe";WorkingDir: "{app}"; Tasks: quicklaunchicon 40 | Name: "{userstartup}\snapTo"; Filename: "{app}\snapTo.exe"; WorkingDir: "{app}"; Tasks: startup 41 | ; NOTE: Most apps do not need registry entries to be pre-created. If you 42 | ; don't know what the registry is or if you need to use it, then chances are 43 | ; you don't need a [Registry] section. 44 | 45 | [Registry] 46 | ; Start "Software\My Company\My Program" keys under HKEY_CURRENT_USER 47 | ; and HKEY_LOCAL_MACHINE. The flags tell it to always delete the 48 | ; "My Program" keys upon uninstall, and delete the "My Company" keys 49 | ; if there is nothing left in them. 50 | Root: HKCU; Subkey: "Software\ICH"; Flags: uninsdeletekeyifempty 51 | Root: HKCU; Subkey: "Software\ICH\snapTo"; Flags: uninsdeletekey 52 | Root: HKCU; Subkey: "Software\ICH\snapTo\Settings"; ValueType: string; ValueName: "snap_sound_file"; ValueData: "{app}\snap.wav" 53 | Root: HKCU; Subkey: "Software\ICH\snapTo\Settings"; ValueType: string; ValueName: "unsnap_sound_file"; ValueData: "{app}\unsnap.wav" 54 | 55 | [Run] 56 | Filename: "{app}\snapTo.EXE"; Description: "Launch application"; Flags: postinstall nowait skipifsilent unchecked 57 | -------------------------------------------------------------------------------- /help.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | allSnap 1.0 help 5 | 6 | 7 | 8 | 9 | 10 |

allSnap 1.0 help

11 | 12 |

13 | allSnap is a small system tray app that makes every window snap like they do in programs such as Winamp or Photoshop. 14 |

15 | 16 |

Running

17 | 18 |

19 |

    20 |
  • 21 | Once run, all windows will snap to each other and the screen 22 |
  • 23 |
  • 24 | Hold down the selected toggle key (default:ALT) while sizing/moving to toggle off snapping. 25 |
  • 26 |
  • 27 | Right click on the little icon in the system tray to change settings or exit. 28 |
  • 29 |
30 |

31 | 32 |

Performance/Stability

33 |

This program works through window hooking. Hooking is a technique that Microsoft suggest you only use in debugging because it can slow the system down, and mess around with any other program on your system. So use at your own risk.

34 | 35 |

Settings

36 |

A property sheet provides a way to change the following settings

37 |

Preferences/General:

38 |
39 |
Snap at x pixels
40 |
Adjusts how close two windows must be before they snap
41 |
Toggle key
42 |
Selects key to temporarily disable window snapping
43 |
44 |

Preferences/Snap to:

45 |

Choses which windows to snap to:

46 |

47 |
Desktop
48 |
Snap to the edges of the screen(s).
49 |
50 | Other Windows
51 |
Snap to all other top level windows.
52 |
53 | Old Position
54 |
Snap to a window's old position.
55 |
(makes more sense when 'Display Properties/Effects/show contents while dragging' is turned off)
56 |
57 | 58 |

Sounds:

59 |

Allows you to add sound effects to the snapping.

60 |
61 |
Snap sound file
62 |
.wav file that is played when a window snaps.
63 | 64 |
Unsnap sound file
65 |
.wav file that is played when a window un-snaps.
66 | 67 |
Play Sounds
68 |
Turn on/off sound effects. (sounds may become annoying do they are turned off by default)
69 |
70 | 71 |

Author

72 |

Ivan Heckman

73 |

mail: ivanheckman@hotmail.com

74 |

website: http://members.rogers.com/ivanheckman

75 | 76 | 77 |

Copyright

78 |

79 | copyright © 2002 Ivan Heckman

80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /sides_old.c: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "sides.h" 3 | 4 | 5 | SIDES OppositeSide(SIDES what_side){ 6 | return oppositeSides[(int)what_side]; 7 | } 8 | 9 | 10 | // get the top,bottom,left or right value of a rect, deppending on 11 | // what side we ask for 12 | int GetSideOfRect(SIDES what_side, LPRECT pRect) const 13 | { 14 | switch(what_side) 15 | { 16 | case SIDE_LEFT: 17 | return pRect->left; 18 | case SIDE_RIGHT: 19 | return pRect->right; 20 | case SIDE_TOP: 21 | return pRect->top; 22 | case SIDE_BOTTOM: 23 | return pRect->bottom; 24 | default: 25 | ASSERT(true);//not a valid side 26 | return 0; 27 | } 28 | 29 | /*** other possible way to do GetSideOfRect 30 | 31 | #define RECT_SIDE(side) (pRect->(side)) 32 | 33 | but that way doesn't use the SIDES enumeration 34 | */ 35 | } 36 | 37 | //Set the given side of a rect structure 38 | 39 | void SetSideOfRect(SIDES what_side, int new_val, LPRECT pRect) 40 | { 41 | switch(what_side) 42 | { 43 | case SIDE_LEFT: 44 | pRect->left = new_val; 45 | break; 46 | case SIDE_RIGHT: 47 | pRect->right = new_val; 48 | break; 49 | case SIDE_TOP: 50 | pRect->top = new_val; 51 | break; 52 | case SIDE_BOTTOM: 53 | pRect->bottom = new_val; 54 | break; 55 | default: 56 | ASSERT(true);//not a valid side 57 | } 58 | } 59 | 60 | //Align a side of the Alignee rect with a side of the Aligner rect 61 | // 62 | void AlignRects 63 | ( 64 | const LPRECT Aligner, 65 | LPRECT Alignee, 66 | SIDES AlignerSide, 67 | SIDES AligneeSide 68 | ) 69 | { // aligneeSideVal 70 | // ^ 71 | // ++++++++++++++++ --------------- 72 | // + Alignee + | Aligner | 73 | // ++++++++++++++++ --------------- 74 | // ^ ^ 75 | // aligneeOpSideVal alignedSideVal 76 | // ^ 77 | // | 78 | // ++++++++++++++++-------------- 79 | // --> + Alignee + Aligner | 80 | // ++++++++++++++++-------------- 81 | 82 | 83 | //Can't align vertical side with a horizontal side or vice versa 84 | ASSERT ( (AlignerSide == OppositeSide(AligneeSide)) || 85 | (AlignerSide == AligneeSide) ); 86 | 87 | int aligneeSideVal = GetSideOfRect(AligneeSide,Alignee); 88 | int aligneeOpSideVal = GetSideOfRect(OppositeSide(AligneeSide),Alignee); 89 | 90 | int size = aligneeOpSideVal - aligneeSideVal; // may be negative 91 | 92 | 93 | int alignedSideVal = GetSideOfRect(AlignerSide,Aligner); 94 | int alignedOpSideVal = alignedSideVal + size; //may be negative 95 | 96 | SetSideOfRect(AligneeSide,alignedSideVal,Alignee); 97 | SetSideOfRect(OppositeSide(AligneeSide),alignedOpSideVal,Alignee); 98 | } -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /SNAP_LIB.H: -------------------------------------------------------------------------------- 1 | // snap_lib.h 2 | 3 | #ifndef SNAPLIBAPI 4 | #define SNAPLIBAPI __declspec(dllimport) 5 | #endif 6 | 7 | #include "snap_types.h" 8 | #include "snap_grid.h" 9 | 10 | extern HWND g_hWnd_app; 11 | extern UINT g_sounds_thread_id; 12 | extern OSVERSIONINFO g_os; 13 | 14 | #define MAX_CLASSNAME_LENGTH 20 //assuming if the first 20 chars are the same that they are related enough to treat the same 15 | #define MAX_NUM_CLASS_NAMES 20 16 | #define MAX_MULTISZ_LENGTH (MAX_NUM_CLASS_NAMES * MAX_CLASSNAME_LENGTH) 17 | #define MAX_CLASSNAME_LIST_LENGTH (MAX_NUM_CLASS_NAMES * MAX_CLASSNAME_LENGTH) 18 | 19 | #ifndef INTERNAL_INCLUDE 20 | /// functions called from other files within lib 21 | SNAPLIBAPI BOOL WINAPI SnapCanUnHook(void); 22 | SNAPLIBAPI BOOL WINAPI SnapHookAll(HWND hwnd,UINT thread_id,OSVERSIONINFO os); 23 | SNAPLIBAPI BOOL WINAPI SnapUnHookAll(void); 24 | 25 | SNAPLIBAPI void WINAPI setGridSnap(gridsnap_settings_t const * p_grid_settings); 26 | SNAPLIBAPI void WINAPI setEnabled(BOOL enabled); 27 | SNAPLIBAPI void WINAPI setCroppingTop(BOOL enabled); 28 | SNAPLIBAPI void WINAPI setNoisy(BOOL noisy); 29 | SNAPLIBAPI void WINAPI setSnapMdi(BOOL snap_mdi); 30 | SNAPLIBAPI void WINAPI setDisableToggle(BOOL is_disable_toggle); 31 | SNAPLIBAPI void WINAPI setWinThresh(int thresh); 32 | SNAPLIBAPI void WINAPI setScreenThresh(int thresh); 33 | SNAPLIBAPI void WINAPI setCropTop(int crop_top); 34 | SNAPLIBAPI void WINAPI setSnapType(UINT snap_self); 35 | SNAPLIBAPI void WINAPI setToggleKey(UINT toggle_key); 36 | SNAPLIBAPI void WINAPI setCenterKey(UINT center_key); 37 | SNAPLIBAPI void WINAPI setEqualKey(UINT equal_key); 38 | SNAPLIBAPI void WINAPI setSnappingInsides(BOOL snap_insides); 39 | SNAPLIBAPI void WINAPI setOveridingAppSnap(BOOL overide_app_snap); 40 | SNAPLIBAPI void WINAPI setKeptToScreen(BOOL kept_to_screen); 41 | SNAPLIBAPI void WINAPI setSkinnedClasses(TCHAR * sz,int len); 42 | SNAPLIBAPI void WINAPI setIgnoredClasses(TCHAR * sz,int len); 43 | SNAPLIBAPI void WINAPI setCroppingRgn(BOOL cropping_rgn); 44 | #endif 45 | 46 | //functions shared by lib and app 47 | SNAPLIBAPI TCHAR * getSkinnedClasses(void); 48 | SNAPLIBAPI TCHAR * getIgnoredClasses(void); 49 | 50 | SNAPLIBAPI BOOL WINAPI isEnabled(void); 51 | SNAPLIBAPI BOOL WINAPI isCroppingTop(void); 52 | SNAPLIBAPI BOOL WINAPI isNoisy(void); 53 | SNAPLIBAPI BOOL WINAPI isSnapMdi(void); 54 | SNAPLIBAPI BOOL WINAPI isDisableToggle(void); 55 | SNAPLIBAPI int WINAPI getWinThresh(void); 56 | SNAPLIBAPI int WINAPI getScreenThresh(void); 57 | SNAPLIBAPI int WINAPI getCropTop(void); 58 | SNAPLIBAPI UINT WINAPI getSnapType(void); 59 | SNAPLIBAPI UINT WINAPI getToggleKey(void); 60 | SNAPLIBAPI UINT WINAPI getCenterKey(void); 61 | SNAPLIBAPI UINT WINAPI getEqualKey(void); 62 | SNAPLIBAPI BOOL WINAPI isSnappingInsides(void); 63 | SNAPLIBAPI BOOL WINAPI isOveridingAppSnap(void); 64 | SNAPLIBAPI BOOL WINAPI isKeptToScreen(void); 65 | SNAPLIBAPI BOOL WINAPI isCroppingRgn(void); 66 | 67 | SNAPLIBAPI void WINAPI getGridSnap(gridsnap_settings_t *p_grid_settings); 68 | -------------------------------------------------------------------------------- /mydebug.c: -------------------------------------------------------------------------------- 1 | #ifdef _DEBUG 2 | #include "mydebug.h" 3 | #include 4 | 5 | #include "sides.h" 6 | #include "snap_results.h" 7 | #include "stdio.h" 8 | 9 | //message strings 10 | const TCHAR * const DBG_MSG_NAMES[DBGMSG_LAST] = 11 | { 12 | _T("PLAIN"), 13 | _T("HWND"), 14 | _T("SUBCLASS"), 15 | _T("UNSUBLCASS"), 16 | _T("OUTSIDECORNERFOUND"), 17 | _T("OUTSIDECORNERLOST"), 18 | _T("KEPTTOPBOTTOM"), 19 | _T("KEPTLEFTRIGHT"), 20 | _T("KEPTSINGLECORNER"), 21 | _T("KEPTTOPLEFT"), 22 | _T("MOVING"), 23 | _T("SIZING"), 24 | _T("UNSNAP"), 25 | _T("RESIZE"), 26 | _T("UNSNAP_SIDE"), 27 | _T("REPOS"), 28 | _T("FOUND_BETTER_V"), 29 | _T("FOUND_BETTER_H"), 30 | _T("INSIDECORNERREMOVED"), 31 | _T("NONSIZINGSIDEREMOVED"), 32 | _T("BETTERSIDEFOUND"), 33 | _T("SIZING_TOGGLEDOFF"), 34 | _T("MOVING_TOGGLEDOFF"), 35 | _T("OSSREJECTED"), 36 | _T("CROPPING"), 37 | _T("CROPPING_TOP"), 38 | _T("CROPPING_HREGION"), 39 | _T("CROPPING_HREGION_T"), 40 | _T("CROPPING_HREGION_L"), 41 | _T("CROPPING_HREGION_B"), 42 | _T("CROPPING_HREGION_R"), 43 | _T("UNCROPPING"), 44 | _T("BEFORE_KEEP"), 45 | _T("AFTER_KEEP"), 46 | _T("BEFORE_CROP"), 47 | _T("AFTER_CROP"), 48 | _T("FOUND_HRGN"), 49 | _T("ADJUST_HRGN"), 50 | _T("INITSIZINGCROP") 51 | }; 52 | 53 | const TCHAR * const get_msg_name(DBGMSGTYPE_T msg){ 54 | return DBG_MSG_NAMES[(int)msg]; 55 | } 56 | 57 | void send_str(HWND hwnd,DBGMSGTYPE_T msg,PCTSTR str){ 58 | SendMessage((hwnd),WM_SETTEXT,(WPARAM)msg,(LPARAM)str); 59 | } 60 | 61 | void msg_ssr(HWND hwnd,DBGMSGTYPE_T msg,const SIDE_SNAP_RESULTS * p_ssr) { 62 | TCHAR msgbuffer[DBG_MSG_MAX_SIZE]; 63 | int msgsize=0; 64 | if( p_ssr->side != SIDE_NONE){ 65 | msgsize = _sntprintf(msgbuffer,DBG_MSG_MAX_SIZE, 66 | _T("[%s] %s to %s; v:%d,c:%d,t:%d,oss:%d"), 67 | SideToString(p_ssr->side), 68 | SideToString(p_ssr->to_side), 69 | p_ssr->value, 70 | p_ssr->closeness, 71 | p_ssr->thresh, 72 | p_ssr->from_oss); 73 | send_str(hwnd,msg,msgbuffer); 74 | } 75 | } 76 | 77 | void msg_sr(HWND hwnd,DBGMSGTYPE_T msg,const SNAP_RESULTS * p_ssr){ 78 | msg_ssr(hwnd,msg,&(p_ssr->h)); 79 | msg_ssr(hwnd,msg,&(p_ssr->v)); 80 | } 81 | 82 | void msg_rect(HWND hwnd,DBGMSGTYPE_T msg,const RECT * pRect){ 83 | if (pRect){ 84 | TCHAR msgbuffer[DBG_MSG_MAX_SIZE]; 85 | _sntprintf(msgbuffer,DBG_MSG_MAX_SIZE,_T("(%4d,%4d) (%4d,%4d)"), 86 | (pRect)->left, 87 | (pRect)->top, 88 | (pRect)->right, 89 | (pRect)->bottom); 90 | send_str(hwnd,msg,msgbuffer); 91 | } 92 | } 93 | 94 | 95 | void send_side_val(HWND hwnd,DBGMSGTYPE_T msg,enum SIDE side,int val) 96 | { 97 | TCHAR msgbuffer[DBG_MSG_MAX_SIZE]; 98 | wsprintf(msgbuffer,_T("%s \t%s\t%d"), 99 | get_msg_name(msg), 100 | SideToString(side), 101 | val); 102 | send_str(hwnd,msg,msgbuffer); 103 | } 104 | 105 | void send_2vals(HWND hwnd,DBGMSGTYPE_T msg,int val1,int val2) 106 | { 107 | TCHAR msgbuffer[DBG_MSG_MAX_SIZE]; 108 | wsprintf(msgbuffer,_T("%s \t%d\t%d"), 109 | get_msg_name(msg), 110 | val1, 111 | val2); 112 | send_str(hwnd,msg,msgbuffer); 113 | } 114 | #endif 115 | -------------------------------------------------------------------------------- /SNAP_LIB.RC: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource1.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "afxres.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // English (U.S.) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 19 | #ifdef _WIN32 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | #pragma code_page(1252) 22 | #endif //_WIN32 23 | 24 | #ifdef APSTUDIO_INVOKED 25 | ///////////////////////////////////////////////////////////////////////////// 26 | // 27 | // TEXTINCLUDE 28 | // 29 | 30 | 1 TEXTINCLUDE 31 | BEGIN 32 | "resource1.h\0" 33 | END 34 | 35 | 2 TEXTINCLUDE 36 | BEGIN 37 | "#include ""afxres.h""\r\n" 38 | "\0" 39 | END 40 | 41 | 3 TEXTINCLUDE 42 | BEGIN 43 | "\r\n" 44 | "\0" 45 | END 46 | 47 | #endif // APSTUDIO_INVOKED 48 | 49 | #endif // English (U.S.) resources 50 | ///////////////////////////////////////////////////////////////////////////// 51 | 52 | 53 | ///////////////////////////////////////////////////////////////////////////// 54 | // English (Canada) resources 55 | 56 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENC) 57 | #ifdef _WIN32 58 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN 59 | #pragma code_page(1252) 60 | #endif //_WIN32 61 | 62 | ///////////////////////////////////////////////////////////////////////////// 63 | // 64 | // Version 65 | // 66 | 67 | VS_VERSION_INFO VERSIONINFO 68 | FILEVERSION 1,3,0,4 69 | PRODUCTVERSION 1,3,0,4 70 | FILEFLAGSMASK 0x17L 71 | #ifdef _DEBUG 72 | FILEFLAGS 0x1L 73 | #else 74 | FILEFLAGS 0x0L 75 | #endif 76 | FILEOS 0x4L 77 | FILETYPE 0x2L 78 | FILESUBTYPE 0x0L 79 | BEGIN 80 | BLOCK "StringFileInfo" 81 | BEGIN 82 | BLOCK "100904b0" 83 | BEGIN 84 | VALUE "Comments", "allSnap hooking library" 85 | VALUE "CompanyName", "Ivan Heckman" 86 | VALUE "FileDescription", "snap_lib Dynamic Link Library" 87 | VALUE "FileVersion", "1, 3, 0, 4" 88 | VALUE "InternalName", "snap_lib" 89 | VALUE "LegalCopyright", "Copyright (C) 2002" 90 | VALUE "OriginalFilename", "snap_lib.dll" 91 | VALUE "ProductName", " snap_lib Dynamic Link Library" 92 | VALUE "ProductVersion", "1, 3, 0, 4" 93 | END 94 | END 95 | BLOCK "VarFileInfo" 96 | BEGIN 97 | VALUE "Translation", 0x1009, 1200 98 | END 99 | END 100 | 101 | #endif // English (Canada) resources 102 | ///////////////////////////////////////////////////////////////////////////// 103 | 104 | 105 | 106 | #ifndef APSTUDIO_INVOKED 107 | ///////////////////////////////////////////////////////////////////////////// 108 | // 109 | // Generated from the TEXTINCLUDE 3 resource. 110 | // 111 | 112 | 113 | ///////////////////////////////////////////////////////////////////////////// 114 | #endif // not APSTUDIO_INVOKED 115 | 116 | -------------------------------------------------------------------------------- /snap_lib1.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource2.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "afxres.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // English (U.S.) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 19 | #ifdef _WIN32 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | #pragma code_page(1252) 22 | #endif //_WIN32 23 | 24 | #ifdef APSTUDIO_INVOKED 25 | ///////////////////////////////////////////////////////////////////////////// 26 | // 27 | // TEXTINCLUDE 28 | // 29 | 30 | 1 TEXTINCLUDE 31 | BEGIN 32 | "resource2.h\0" 33 | END 34 | 35 | 2 TEXTINCLUDE 36 | BEGIN 37 | "#include ""afxres.h""\r\n" 38 | "\0" 39 | END 40 | 41 | 3 TEXTINCLUDE 42 | BEGIN 43 | "\r\n" 44 | "\0" 45 | END 46 | 47 | #endif // APSTUDIO_INVOKED 48 | 49 | #endif // English (U.S.) resources 50 | ///////////////////////////////////////////////////////////////////////////// 51 | 52 | 53 | ///////////////////////////////////////////////////////////////////////////// 54 | // English (Canada) resources 55 | 56 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENC) 57 | #ifdef _WIN32 58 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN 59 | #pragma code_page(1252) 60 | #endif //_WIN32 61 | 62 | ///////////////////////////////////////////////////////////////////////////// 63 | // 64 | // Version 65 | // 66 | 67 | VS_VERSION_INFO VERSIONINFO 68 | FILEVERSION 1,4,2,0 69 | PRODUCTVERSION 1,4,2,0 70 | FILEFLAGSMASK 0x17L 71 | #ifdef _DEBUG 72 | FILEFLAGS 0x1L 73 | #else 74 | FILEFLAGS 0x0L 75 | #endif 76 | FILEOS 0x4L 77 | FILETYPE 0x2L 78 | FILESUBTYPE 0x0L 79 | BEGIN 80 | BLOCK "StringFileInfo" 81 | BEGIN 82 | BLOCK "100904b0" 83 | BEGIN 84 | VALUE "Comments", "http://ivanheckman.com/allsnap" 85 | VALUE "CompanyName", "Ivan Heckman" 86 | VALUE "FileDescription", "allSnap hooking Library" 87 | VALUE "FileVersion", "1, 5, 0, 0" 88 | VALUE "InternalName", "snap_lib" 89 | VALUE "LegalCopyright", "Copyright (C) 2002-2008" 90 | VALUE "OriginalFilename", "snap_libA.dll or snap_libW.dll" 91 | VALUE "ProductName", "allSnap" 92 | VALUE "ProductVersion", "1, 5, 0, 0" 93 | END 94 | END 95 | BLOCK "VarFileInfo" 96 | BEGIN 97 | VALUE "Translation", 0x1009, 1200 98 | END 99 | END 100 | 101 | #endif // English (Canada) resources 102 | ///////////////////////////////////////////////////////////////////////////// 103 | 104 | 105 | 106 | #ifndef APSTUDIO_INVOKED 107 | ///////////////////////////////////////////////////////////////////////////// 108 | // 109 | // Generated from the TEXTINCLUDE 3 resource. 110 | // 111 | 112 | 113 | ///////////////////////////////////////////////////////////////////////////// 114 | #endif // not APSTUDIO_INVOKED 115 | 116 | -------------------------------------------------------------------------------- /snap_taskbar.c: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include 3 | #include "snap_taskbar.h" 4 | #include "snap_App.h" 5 | #include "snap_lib.h" 6 | #include "snap_mywm_msg.h" 7 | 8 | UINT g_uTaskbarRestart; 9 | static BOOL g_isHidden = FALSE; 10 | 11 | BOOL WINAPI isIconHidden(void){ 12 | return g_isHidden; 13 | } 14 | 15 | void RestartTaskbarIcon(void){ 16 | if (!g_isHidden){ 17 | AddTaskbarIcon(); 18 | } 19 | } 20 | 21 | void WINAPI setIconHidden(BOOL hidden){ 22 | if (hidden && !g_isHidden){ 23 | DeleteTaskbarIcon(); 24 | g_isHidden = TRUE; 25 | } 26 | else if(!hidden && g_isHidden){ 27 | g_isHidden = FALSE; 28 | AddTaskbarIcon(); 29 | } 30 | } 31 | 32 | VOID RegisterTaskbarCreatedMsg(void){ 33 | g_uTaskbarRestart = RegisterWindowMessage(TEXT("TaskbarCreated")); 34 | } 35 | 36 | BOOL AddTaskbarIcon(void){ 37 | BOOL fOK; 38 | 39 | if(g_isHidden){ 40 | return FALSE; 41 | } 42 | 43 | fOK = AddEmptyTaskbarIcon(); 44 | if (fOK){ 45 | fOK = ResetTaskbarIcon(); 46 | } 47 | return fOK; 48 | } 49 | 50 | BOOL AddEmptyTaskbarIcon(void){ 51 | BOOL fOK; 52 | NOTIFYICONDATA tnid; 53 | 54 | tnid.cbSize = sizeof(NOTIFYICONDATA); 55 | tnid.hWnd = g_hWnd; 56 | tnid.uID = IDT_MYTRAY; 57 | tnid.uFlags = NIF_MESSAGE; 58 | tnid.uCallbackMessage = MYWM_NOTIFYICON; 59 | 60 | fOK = Shell_NotifyIcon(NIM_ADD, &tnid); 61 | return fOK; 62 | } 63 | 64 | BOOL DeleteTaskbarIcon(void) 65 | { 66 | BOOL res; 67 | NOTIFYICONDATA tnid; 68 | 69 | if (g_isHidden){ 70 | return FALSE; 71 | } 72 | 73 | tnid.cbSize = sizeof(NOTIFYICONDATA); 74 | tnid.hWnd = g_hWnd; 75 | tnid.uID = IDT_MYTRAY; 76 | 77 | res = Shell_NotifyIcon(NIM_DELETE, &tnid); 78 | return res; 79 | } 80 | 81 | BOOL ResetTaskbarIcon(void) 82 | { 83 | BOOL res; 84 | NOTIFYICONDATA tnid; 85 | HICON hIcon; 86 | TCHAR szTrayTip[MAX_LOADSTRING]; 87 | UINT icon_id; 88 | UINT tip_id; 89 | 90 | if (g_isHidden){ 91 | return FALSE; 92 | } 93 | 94 | 95 | if(isEnabled()){ 96 | tip_id = IDS_ENABLED_TIP; 97 | icon_id = 98 | #ifdef DBG_NO_SIZING 99 | IDI_XPENABLED1; 100 | #else 101 | (g_isXP)?IDI_XPENABLED:IDI_ENABLED; 102 | #endif 103 | } 104 | else{ 105 | tip_id = IDS_DISABLED_TIP; 106 | icon_id = (g_isXP)?IDI_XPDISABLED:IDI_DISABLED; 107 | } 108 | 109 | LoadString(g_hInst, tip_id, szTrayTip, MAX_LOADSTRING); 110 | hIcon=LoadImage(g_hInst,MAKEINTRESOURCE(icon_id),IMAGE_ICON,16,16,LR_DEFAULTCOLOR); 111 | 112 | tnid.cbSize = sizeof(NOTIFYICONDATA); 113 | tnid.hWnd = g_hWnd; 114 | tnid.uID = IDT_MYTRAY; 115 | tnid.uFlags = NIF_ICON | NIF_TIP; 116 | tnid.hIcon = hIcon; 117 | if (szTrayTip) 118 | lstrcpyn(tnid.szTip, szTrayTip, sizeof(tnid.szTip)); 119 | else 120 | tnid.szTip[0] = '\0'; 121 | 122 | res = Shell_NotifyIcon(NIM_MODIFY , &tnid); 123 | 124 | if (hIcon) 125 | DestroyIcon(hIcon); 126 | 127 | return res; 128 | } 129 | 130 | //In my dialog-based application in the OnInitDialog() method, I have the 131 | //following code to properly set the two icon images (16x16 and 32x32): 132 | // 133 | //// Set the 32x32 icon 134 | //SetIcon(m_hIcon, TRUE); 135 | // 136 | // Set the 16x16 icon 137 | //SetIcon( 138 | // 139 | // 140 | // -------------------------------------------------------------------------------- /snap_tips.c: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "ctxhelp.h" 3 | #include "snap_tips.h" 4 | #include "snap_App.h" //for hinst 5 | #include "Htmlhelp.h" 6 | #include "resource.h" 7 | #include "snap_settings.h" 8 | 9 | 10 | DWORD mapID(DWORD ctrlid); 11 | 12 | static DWORD tiptable[]={IDC_STATIC ,0 13 | ,IDC_SOUNDSL ,IDS_SOUNDS 14 | ,IDC_MYHAND ,0 15 | ,IDC_SNAPIT ,0 16 | ,IDC_DESKTOP ,IDS_DESKTOP 17 | ,IDC_SELF ,IDS_SELF 18 | ,IDC_OTHERS ,IDS_OTHERS 19 | ,IDC_ENABLED ,IDS_ENABLED 20 | ,IDC_PLAYSOUNDS ,IDS_PLAYSOUNDS 21 | ,IDC_UNSNAP_FILE ,IDS_UNSNAP_FILE 22 | ,IDC_BROWSE_UNSNAP ,IDS_BROWSE_UNSNAP 23 | ,IDC_SNAP_FILE ,IDS_SNAP_FILE 24 | ,IDC_BROWSE_SNAP ,IDS_BROWSE_SNAP 25 | ,IDC_TOGGLEKEYS ,IDS_TOGGLEKEYS 26 | ,IDC_LINK ,0 27 | ,IDC_WIN_THRESH ,IDS_WIN_THRESH 28 | ,IDC_WIN_THRESH_SPIN ,IDS_WIN_THRESH 29 | ,IDC_SNAPATL ,IDS_WIN_THRESH 30 | ,IDC_PIXELSL ,IDS_WIN_THRESH 31 | 32 | ,IDC_SCREEN_THRESH ,IDS_SCREEN_THRESH 33 | ,IDC_SCREEN_THRESH_SPIN ,IDS_SCREEN_THRESH 34 | ,IDC_SNAPATL2 ,IDS_SCREEN_THRESH 35 | ,IDC_PIXELSL2 ,IDS_SCREEN_THRESH 36 | ,IDC_SNAPFILEL ,IDS_SNAP_FILE 37 | ,IDC_TOGGLEKEYL ,IDS_TOGGLEKEYS 38 | ,IDC_GENERALL ,IDS_GENERALL 39 | 40 | ,IDC_UNSNAPFILEL ,IDS_UNSNAP_FILE 41 | ,IDC_CHOSEL ,IDS_SNAPTOL 42 | ,IDC_SNAPMDI ,IDS_SNAPMDI 43 | ,IDC_QUIETFAST ,IDS_QUIETFAST 44 | ,IDC_INSIDES ,IDS_INSIDES 45 | ,IDC_INVTOGGLE ,IDS_INVTOGGLE 46 | ,IDC_ADVL ,IDS_ADVL 47 | ,IDC_PLAY_UNSNAP ,IDS_PLAY 48 | ,IDC_PLAY_SNAP ,IDS_PLAY 49 | ,IDC_CROPTOP ,IDS_CROPTOP 50 | ,IDC_CROPTOPL ,IDS_CROPTOP 51 | ,IDC_CROPTOPC ,IDS_CROPTOP 52 | ,IDC_HIDEICON ,IDS_HIDEICON 53 | ,IDC_HCENTER ,IDS_HCENTER 54 | ,IDC_VCENTER ,IDS_VCENTER 55 | ,IDC_KEPT ,IDS_KEPT 56 | ,IDC_CROP_RGN ,IDS_CROP_RGN 57 | ,IDC_AUTOLINEUP ,IDS_AUTOLINEUP 58 | ,IDC_CHECK_HORIZONTAL ,IDS_CHECK_HORIZONTAL 59 | ,IDC_CHECK_VERTICAL ,IDS_CHECK_VERTICAL 60 | 61 | /* 62 | ,IDC_H_NUM_EVEN ,IDS_H_NUM_EVEN 63 | ,IDC_H_PIXELS_BTWN ,IDS_H_PIXELS_BTWN 64 | ,IDC_H_PIXELS_FROM_TOP,IDS_H_PIXELS_FROM_TOP 65 | ,IDC_V_NUM_EVEN ,IDS_V_NUM_EVEN 66 | ,IDC_V_PIXELS_BTWN ,IDS_V_PIXELS_BTWN 67 | ,IDC_V_PIXELS_FROM_TOP,IDS_V_PIXELS_FROM_TOP 68 | */ 69 | 70 | ,0 ,0}; 71 | 72 | 73 | DWORD mapID(DWORD ctrlid){ 74 | int i=0; 75 | while(tiptable[i]!=0){ 76 | if (tiptable[i] == ctrlid){ 77 | return tiptable[i+1]; 78 | } 79 | i+=2; 80 | } 81 | return 0; 82 | } 83 | 84 | void tips_show(HWND hwndCtl){ 85 | #ifdef NOHTMLHELP 86 | return; 87 | #else 88 | HH_POPUP hPop; 89 | UINT idString = -1; 90 | TCHAR HelpString[MAX_LOADSTRING]; 91 | 92 | memset(&hPop, 0, sizeof (HH_POPUP)); 93 | hPop.cbStruct = sizeof (HH_POPUP); 94 | hPop.clrBackground = -1; 95 | hPop.clrForeground = -1; 96 | hPop.rcMargins.left = 8; 97 | hPop.rcMargins.right = 8; 98 | hPop.rcMargins.bottom = 8; 99 | hPop.rcMargins.top = 8; 100 | hPop.idString = 0;//mapID(GetDlgCtrlID(hwndCtl)); 101 | hPop.pszText=_T("No help for this item."); 102 | //GetWindowRect(hwndCtl,&rect); 103 | hPop.pt.x = -1;//rect.right; 104 | hPop.pt.y = -1;//rect.bottom; 105 | 106 | //InvalidateRect(g_hwndPropSheet,NULL,TRUE); 107 | idString = mapID(GetDlgCtrlID(hwndCtl)); 108 | if (idString != 0){ //???? why -1 UINT is unsigned 109 | LoadString(g_hInst,idString,HelpString,MAX_LOADSTRING); 110 | hPop.pszText = HelpString; 111 | } 112 | 113 | 114 | HtmlHelp(hwndCtl, 115 | NULL,//_T("allSnap.chm::/ctxhelp.txt"), 116 | HH_DISPLAY_TEXT_POPUP , 117 | (DWORD)&hPop) ; 118 | #endif 119 | } -------------------------------------------------------------------------------- /MYDEBUG.H: -------------------------------------------------------------------------------- 1 | 2 | #ifndef SNAP_MYDEBUG_INCLUDE 3 | #define SNAP_MYDEBUG_INCLUDE 4 | 5 | #include "snap_mywm_msg.h" 6 | #include "sides.h" 7 | 8 | //#define DBGMSGTYPE_ERROR 1 9 | //#define DBGMSGTYPE_STARTSTOP 2 10 | //#define DBGMSGTYPE_EACHTIME 3 11 | #define DBGMSGTYPE_PLAIN 0 12 | #define DBGMSGTYPE_SIDE_VAL 1 13 | #define DBGMSGTYPE_HWND 2 14 | #define DBGMSGTYPE_2SIDES 3 15 | #define DBGMSGTYPE_2VALS 4 16 | #define DBGMSGTYPE_PTR 5 17 | 18 | typedef enum{ 19 | DBGMSG_SUBCLASS_OLD, 20 | DBGMSG_SUBCLASS_NEW, 21 | DBGMSG_UNSUBCLASS_OLD, 22 | DBGMSG_UNSUBCLASS_NEW, 23 | DBGMSG_OUTSIDECORNERFOUND, 24 | DBGMSG_OUTSIDECORNERLOST, 25 | DBGMSG_KEPTTOPBOTTOM, 26 | DBGMSG_KEPTLEFTRIGHT, 27 | DBGMSG_KEPTSINGLECORNER, 28 | DBGMSG_KEPTTOPLEFT, 29 | DBGMSG_MOVING, 30 | DBGMSG_SIZING, 31 | DBGMSG_UNSNAP, 32 | DBGMSG_RESIZE, 33 | DBGMSG_UNSNAP_SIDE, 34 | DBGMSG_REPOS, 35 | DBGMSG_FOUND_BETTER_V, 36 | DBGMSG_FOUND_BETTER_H, 37 | DBGMSG_INSIDECORNERREMOVED, 38 | DBGMSG_NONSIZINGSIDEREMOVED, 39 | DBGMSG_BETTERSIDEFOUND, 40 | DBGMSG_SIZING_TOGGLEDOFF, 41 | DBGMSG_MOVING_TOGGLEDOFF, 42 | DBGMSG_OSSREJECTED, 43 | DGBMSG_CROPPING, 44 | DBGMSG_CROPPING_TOP, 45 | DBGMSG_CROPPING_HREGION, 46 | DBGMSG_CROPPING_HREGION_T, 47 | DBGMSG_CROPPING_HREGION_L, 48 | DBGMSG_CROPPING_HREGION_B, 49 | DBGMSG_CROPPING_HREGION_R, 50 | DBGMSG_UNCROPPING, 51 | DBGMSG_BEFORE_KEEP, 52 | DBGMSG_AFTER_KEEP, 53 | DBGMSG_BEFORE_CROP, 54 | DBGMSG_AFTER_CROP, 55 | DBGMSG_FOUND_HRGN, 56 | DBGMSG_ADJUST_HRGN, 57 | DBGMSG_INITSIZINGCROP, 58 | DBGMSG_WNDTHREAD, 59 | DBGMSG_THISTHREAD, 60 | DBGMSG_PROCESS, 61 | DBGMSG_IS64, 62 | DBGMSG_NCLBDOWN, 63 | DBGMSG_LBUP, 64 | DBGMSG_EXITSIZEMOVE, 65 | DBGMSG_LAST 66 | } DBGMSG_T; 67 | 68 | #ifdef _DEBUG 69 | 70 | #define DMB(x)MessageBox(NULL,(x),_T("DEBUG"),MB_OK) 71 | #define MB_PRINTF(format){ TCHAR debug[100]; wsprintf(debug,format);MB(debug);} 72 | #define DBEEP {MessageBeep(-1);} 73 | #define DBG_MSG(hwnd,msg){PostMessage((hwnd),MYWM_DEBUG1,MAKEWPARAM(DBGMSGTYPE_PLAIN,msg),0L);} 74 | #define DBG_MSG_COND(hwnd,msg,cond) if((x))DBG_MSG((hwnd),(msg)) 75 | #define DBG_MSG_SIDE_VAL(hwnd,msg,side,val){PostMessage((hwnd),MYWM_DEBUG1,MAKEWPARAM(DBGMSGTYPE_SIDE_VAL,msg),MAKELPARAM((WORD)side,(WORD)val));} 76 | #define DBG_MSG_PTR(hwnd,msg,ptr){PostMessage((hwnd),MYWM_DEBUG1,MAKEWPARAM(DBGMSGTYPE_PTR,msg),(LPARAM)ptr);} 77 | #define DBG_MSG_HWND(hwnd,msg,hwndp){PostMessage((hwnd),MYWM_DEBUG1,MAKEWPARAM(DBGMSGTYPE_HWND,msg),(LPARAM)hwndp);} 78 | #define DBG_MSG_2SIDES(hwnd,msg,side1,side2){PostMessage((hwnd),MYWM_DEBUG1,MAKEWPARAM(DBGMSGTYPE_2SIDES,msg),MAKELPARAM((WORD)side1,(WORD)side2));} 79 | #define DBG_MSG_2VALS(hwnd,msg,val1,val2){PostMessage((hwnd),MYWM_DEBUG1,MAKEWPARAM(DBGMSGTYPE_2VALS,msg),MAKELPARAM((WORD)val1,(WORD)val2));} 80 | #define DBG_MSG_SR(hwnd,msg,sr){DBG_MSG_SSR((hwnd),(msg),(sr).h);DBG_MSG_SSR((hwnd),(msg),(sr).v)} 81 | #define DBG_MSG_SSR(hwnd,msg,ssr) { \ 82 | if( (ssr).side != SIDE_NONE){ \ 83 | DBG_MSG_SIDE_VAL((hwnd),(msg),(ssr).side,(ssr).value);\ 84 | }\ 85 | } 86 | #define DBG_MSG_PRECT(hwnd,msg,pRect){\ 87 | if (pRect){\ 88 | DBG_MSG_SIDE_VAL((hwnd),(msg),SIDE_TOP,(pRect)->top);\ 89 | DBG_MSG_SIDE_VAL((hwnd),(msg),SIDE_LEFT,(pRect)->left);\ 90 | DBG_MSG_SIDE_VAL((hwnd),(msg),SIDE_BOTTOM,(pRect)->bottom);\ 91 | DBG_MSG_SIDE_VAL((hwnd),(msg),SIDE_RIGHT,(pRect)->right);\ 92 | }\ 93 | } 94 | #else 95 | #define DMB(x)((void)0) 96 | #define MB_PRINTF(format)((void)0) 97 | #define DBEEP ((void)0) 98 | #define DBG_MSG(hwnd,msg)((void)0) 99 | #define DBG_MSG_COND(hwnd,msg,cond) ((void)0) 100 | #define DBG_MSG_SIDE_VAL(hwnd,msg,side,val)((void)0) 101 | #define DBG_MSG_HWND(hwnd,msg,side,val,hwndp)((void)0) 102 | #define DBG_MSG_2SIDES(hwnd,msg,side1,side2)((void)0) 103 | #define DBG_MSG_2VALS(hwnd,msg,val1,val2)((void)0) 104 | #define DBG_MSG_SSR(hwnd,msg,ssr) ((void)0) 105 | #define DBG_MSG_RECT(hwnd,msg,pRect) ((void)0) 106 | #define DBG_MSG_PRECT(hwnd,msg,pRect)((void)0) 107 | #define DBG_MSG_SR(hwnd,msg,sr) ((void)0) 108 | #define DBG_MSG_PTR(hwnd,msg,ptr) ((void)0) 109 | #endif 110 | 111 | #endif -------------------------------------------------------------------------------- /ALLSNAPB.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 14 3 | VisualStudioVersion = 14.0.23107.0 4 | MinimumVisualStudioVersion = 10.0.40219.1 5 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{FE56C0FE-FEE4-4F0C-9A6B-A36070F2E076}" 6 | ProjectSection(SolutionItems) = preProject 7 | about.html = about.html 8 | EULA.TXT = EULA.TXT 9 | help.html = help.html 10 | introducing.html = introducing.html 11 | knownproblems.html = knownproblems.html 12 | performance.html = performance.html 13 | running.html = running.html 14 | settings.html = settings.html 15 | EndProjectSection 16 | EndProject 17 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "snap_lib", "snap_lib.vcxproj", "{01723DEC-96CD-490C-905E-E96B08685A52}" 18 | EndProject 19 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "allsnap", "snapit.vcxproj", "{8A3B79DB-00A7-4612-B6CA-A25A29441EB1}" 20 | EndProject 21 | Global 22 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 23 | Debug UNICODE|Win32 = Debug UNICODE|Win32 24 | Debug UNICODE|x64 = Debug UNICODE|x64 25 | Debug|Win32 = Debug|Win32 26 | Debug|x64 = Debug|x64 27 | Release UNICODE|Win32 = Release UNICODE|Win32 28 | Release UNICODE|x64 = Release UNICODE|x64 29 | Release|Win32 = Release|Win32 30 | Release|x64 = Release|x64 31 | EndGlobalSection 32 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 33 | {01723DEC-96CD-490C-905E-E96B08685A52}.Debug UNICODE|Win32.ActiveCfg = Debug UNICODE|Win32 34 | {01723DEC-96CD-490C-905E-E96B08685A52}.Debug UNICODE|Win32.Build.0 = Debug UNICODE|Win32 35 | {01723DEC-96CD-490C-905E-E96B08685A52}.Debug UNICODE|x64.ActiveCfg = Debug UNICODE|x64 36 | {01723DEC-96CD-490C-905E-E96B08685A52}.Debug UNICODE|x64.Build.0 = Debug UNICODE|x64 37 | {01723DEC-96CD-490C-905E-E96B08685A52}.Debug|Win32.ActiveCfg = Debug|Win32 38 | {01723DEC-96CD-490C-905E-E96B08685A52}.Debug|Win32.Build.0 = Debug|Win32 39 | {01723DEC-96CD-490C-905E-E96B08685A52}.Debug|x64.ActiveCfg = Debug|x64 40 | {01723DEC-96CD-490C-905E-E96B08685A52}.Debug|x64.Build.0 = Debug|x64 41 | {01723DEC-96CD-490C-905E-E96B08685A52}.Release UNICODE|Win32.ActiveCfg = Release UNICODE|Win32 42 | {01723DEC-96CD-490C-905E-E96B08685A52}.Release UNICODE|Win32.Build.0 = Release UNICODE|Win32 43 | {01723DEC-96CD-490C-905E-E96B08685A52}.Release UNICODE|x64.ActiveCfg = Release UNICODE|x64 44 | {01723DEC-96CD-490C-905E-E96B08685A52}.Release UNICODE|x64.Build.0 = Release UNICODE|x64 45 | {01723DEC-96CD-490C-905E-E96B08685A52}.Release|Win32.ActiveCfg = Release|Win32 46 | {01723DEC-96CD-490C-905E-E96B08685A52}.Release|Win32.Build.0 = Release|Win32 47 | {01723DEC-96CD-490C-905E-E96B08685A52}.Release|x64.ActiveCfg = Release|x64 48 | {01723DEC-96CD-490C-905E-E96B08685A52}.Release|x64.Build.0 = Release|x64 49 | {8A3B79DB-00A7-4612-B6CA-A25A29441EB1}.Debug UNICODE|Win32.ActiveCfg = Debug UNICODE|Win32 50 | {8A3B79DB-00A7-4612-B6CA-A25A29441EB1}.Debug UNICODE|Win32.Build.0 = Debug UNICODE|Win32 51 | {8A3B79DB-00A7-4612-B6CA-A25A29441EB1}.Debug UNICODE|x64.ActiveCfg = Debug UNICODE|x64 52 | {8A3B79DB-00A7-4612-B6CA-A25A29441EB1}.Debug UNICODE|x64.Build.0 = Debug UNICODE|x64 53 | {8A3B79DB-00A7-4612-B6CA-A25A29441EB1}.Debug|Win32.ActiveCfg = Debug|Win32 54 | {8A3B79DB-00A7-4612-B6CA-A25A29441EB1}.Debug|Win32.Build.0 = Debug|Win32 55 | {8A3B79DB-00A7-4612-B6CA-A25A29441EB1}.Debug|x64.ActiveCfg = Debug|x64 56 | {8A3B79DB-00A7-4612-B6CA-A25A29441EB1}.Debug|x64.Build.0 = Debug|x64 57 | {8A3B79DB-00A7-4612-B6CA-A25A29441EB1}.Release UNICODE|Win32.ActiveCfg = Release UNICODE|Win32 58 | {8A3B79DB-00A7-4612-B6CA-A25A29441EB1}.Release UNICODE|Win32.Build.0 = Release UNICODE|Win32 59 | {8A3B79DB-00A7-4612-B6CA-A25A29441EB1}.Release UNICODE|x64.ActiveCfg = Release UNICODE|x64 60 | {8A3B79DB-00A7-4612-B6CA-A25A29441EB1}.Release UNICODE|x64.Build.0 = Release UNICODE|x64 61 | {8A3B79DB-00A7-4612-B6CA-A25A29441EB1}.Release|Win32.ActiveCfg = Release|Win32 62 | {8A3B79DB-00A7-4612-B6CA-A25A29441EB1}.Release|Win32.Build.0 = Release|Win32 63 | {8A3B79DB-00A7-4612-B6CA-A25A29441EB1}.Release|x64.ActiveCfg = Release|x64 64 | {8A3B79DB-00A7-4612-B6CA-A25A29441EB1}.Release|x64.Build.0 = Release|x64 65 | EndGlobalSection 66 | GlobalSection(SolutionProperties) = preSolution 67 | HideSolutionNode = FALSE 68 | EndGlobalSection 69 | EndGlobal 70 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | 28 | # MSTest test Results 29 | [Tt]est[Rr]esult*/ 30 | [Bb]uild[Ll]og.* 31 | 32 | # NUNIT 33 | *.VisualState.xml 34 | TestResult.xml 35 | 36 | # Build Results of an ATL Project 37 | [Dd]ebugPS/ 38 | [Rr]eleasePS/ 39 | dlldata.c 40 | 41 | # DNX 42 | project.lock.json 43 | artifacts/ 44 | 45 | *_i.c 46 | *_p.c 47 | *_i.h 48 | *.ilk 49 | *.meta 50 | *.obj 51 | *.pch 52 | *.pdb 53 | *.pgc 54 | *.pgd 55 | *.rsp 56 | *.sbr 57 | *.tlb 58 | *.tli 59 | *.tlh 60 | *.tmp 61 | *.tmp_proj 62 | *.log 63 | *.vspscc 64 | *.vssscc 65 | .builds 66 | *.pidb 67 | *.svclog 68 | *.scc 69 | 70 | # Chutzpah Test files 71 | _Chutzpah* 72 | 73 | # Visual C++ cache files 74 | ipch/ 75 | *.aps 76 | *.ncb 77 | *.opensdf 78 | *.sdf 79 | *.cachefile 80 | 81 | # Visual Studio profiler 82 | *.psess 83 | *.vsp 84 | *.vspx 85 | 86 | # TFS 2012 Local Workspace 87 | $tf/ 88 | 89 | # Guidance Automation Toolkit 90 | *.gpState 91 | 92 | # ReSharper is a .NET coding add-in 93 | _ReSharper*/ 94 | *.[Rr]e[Ss]harper 95 | *.DotSettings.user 96 | 97 | # JustCode is a .NET coding add-in 98 | .JustCode 99 | 100 | # TeamCity is a build add-in 101 | _TeamCity* 102 | 103 | # DotCover is a Code Coverage Tool 104 | *.dotCover 105 | 106 | # NCrunch 107 | _NCrunch_* 108 | .*crunch*.local.xml 109 | 110 | # MightyMoose 111 | *.mm.* 112 | AutoTest.Net/ 113 | 114 | # Web workbench (sass) 115 | .sass-cache/ 116 | 117 | # Installshield output folder 118 | [Ee]xpress/ 119 | 120 | # DocProject is a documentation generator add-in 121 | DocProject/buildhelp/ 122 | DocProject/Help/*.HxT 123 | DocProject/Help/*.HxC 124 | DocProject/Help/*.hhc 125 | DocProject/Help/*.hhk 126 | DocProject/Help/*.hhp 127 | DocProject/Help/Html2 128 | DocProject/Help/html 129 | 130 | # Click-Once directory 131 | publish/ 132 | 133 | # Publish Web Output 134 | *.[Pp]ublish.xml 135 | *.azurePubxml 136 | ## TODO: Comment the next line if you want to checkin your 137 | ## web deploy settings but do note that will include unencrypted 138 | ## passwords 139 | #*.pubxml 140 | 141 | *.publishproj 142 | 143 | # NuGet Packages 144 | *.nupkg 145 | # The packages folder can be ignored because of Package Restore 146 | **/packages/* 147 | # except build/, which is used as an MSBuild target. 148 | !**/packages/build/ 149 | # Uncomment if necessary however generally it will be regenerated when needed 150 | #!**/packages/repositories.config 151 | 152 | # Windows Azure Build Output 153 | csx/ 154 | *.build.csdef 155 | 156 | # Windows Store app package directory 157 | AppPackages/ 158 | 159 | # Visual Studio cache files 160 | # files ending in .cache can be ignored 161 | *.[Cc]ache 162 | # but keep track of directories ending in .cache 163 | !*.[Cc]ache/ 164 | 165 | # Others 166 | ClientBin/ 167 | [Ss]tyle[Cc]op.* 168 | ~$* 169 | *~ 170 | *.dbmdl 171 | *.dbproj.schemaview 172 | *.pfx 173 | *.publishsettings 174 | node_modules/ 175 | orleans.codegen.cs 176 | 177 | # RIA/Silverlight projects 178 | Generated_Code/ 179 | 180 | # Backup & report files from converting an old project file 181 | # to a newer Visual Studio version. Backup files are not needed, 182 | # because we have git ;-) 183 | _UpgradeReport_Files/ 184 | Backup*/ 185 | UpgradeLog*.XML 186 | UpgradeLog*.htm 187 | 188 | # SQL Server files 189 | *.mdf 190 | *.ldf 191 | 192 | # Business Intelligence projects 193 | *.rdl.data 194 | *.bim.layout 195 | *.bim_*.settings 196 | 197 | # Microsoft Fakes 198 | FakesAssemblies/ 199 | 200 | # Node.js Tools for Visual Studio 201 | .ntvs_analysis.dat 202 | 203 | # Visual Studio 6 build log 204 | *.plg 205 | 206 | # Visual Studio 6 workspace options file 207 | *.opt 208 | 209 | # LightSwitch generated files 210 | GeneratedArtifacts/ 211 | _Pvt_Extensions/ 212 | ModelManifest.xml 213 | ALLSNAPB.VC.db 214 | snap_lib___Win32_Debug/ 215 | Win32/ 216 | -------------------------------------------------------------------------------- /COUA.CSS: -------------------------------------------------------------------------------- 1 | /* Cascading Style Sheet for HTML Help Workshop */ 2 | 3 | body { 4 | font-size: 75%; 5 | line-height: 125%; 6 | background: white; 7 | font-family: Verdana, Arial, Helvetica, } 8 | 9 | 10 | a:link { color: #0000FF; } 11 | 12 | a:active { color: #FF33CC; } 13 | 14 | a:visited { color: #800080; } 15 | 16 | a:hover {color: #800080; } 17 | 18 | a:sidebar {color: #339900; } 19 | 20 | h1 { font-family: Helvetica; 21 | font-size: 175%; 22 | margin-bottom: .5em; 23 | line-height: 125%; } 24 | 25 | h2 { font-size: 115%; 26 | margin-top: 1.5em; 27 | margin-bottom: .5em; } 28 | 29 | h3 { font-size: 100%; 30 | margin-top: 1.2em; 31 | margin-bottom: .5em; } 32 | 33 | h4 { font-size: 100%; 34 | color: darkmagenta; 35 | margin-top: 1.2em; 36 | margin-bottom: .5em; } 37 | 38 | p { margin-top:6pt; margin-bottom: 6pt; } 39 | 40 | p.margin { 41 | margin-left: 57pt; 42 | margin-top: -47pt; } 43 | 44 | p.margin2 { 45 | margin-left: 57pt; } 46 | 47 | li p { margin-top: .6em; 48 | margin-bottom: 0em; } 49 | 50 | big { font-weight: bold; 51 | font-size: 105%; } 52 | 53 | ol {margin-top: .5em; 54 | margin-bottom: 0em } 55 | 56 | ul {margin-top: .6em; 57 | margin-bottom: 0em; 58 | margin-left: 2.75em; } 59 | 60 | ol ul { list-style: disc; margin-top: 2em; } 61 | 62 | li {padding-bottom: .3em; 63 | margin-left: -1.25em; } 64 | 65 | dl ul { margin-top: 2em; 66 | margin-bottom: 0em; } /*list item inside a def/term*/ 67 | 68 | dl { margin-top: -1em; } 69 | 70 | ol dl { margin-top: -1.5em; 71 | margin-left: 0em; } /*term/def list inside a numbered list*/ 72 | 73 | ol dl dl { margin-top: 0em; 74 | margin-left: .2em; } /*term/def list inside a term/def list*/ 75 | 76 | dd { margin-bottom: 0em; /*not currently working*/ 77 | margin-left: 1.5em; } 78 | 79 | dt { padding-top: 2em; 80 | font-weight: bold; 81 | margin-left: 1.5em; } 82 | 83 | code {font-family: Courier; } 84 | 85 | pre { margin-top: 0em; 86 | margin-bottom: 1.5em; 87 | font-family: Courier; 88 | } 89 | 90 | TABLE { 91 | Background-color : white; 92 | font-size : 10.0pt; 93 | color : black; 94 | margin-top : 6.0pt; 95 | width:200px: 96 | margin-bottom : auto;} 97 | TH { 98 | text-align : left; 99 | color : black; 100 | Background-color : #DDDDDD; 101 | padding : 2px; 102 | } 103 | TD { 104 | color : black; 105 | Background-color : #EEEEEE; 106 | vertical-align : top; 107 | padding : 2px; 108 | padding-right:4px; 109 | } 110 | 111 | /* Only use this for sidebars that ARE in a list */ 112 | DIV.sidebartext { 113 | position: relative; 114 | left: -22px; 115 | height: 72px; 116 | width: 300px; 117 | margin-top: .6em; 118 | margin-right: 3em; 119 | margin-left: 0; 120 | margin-bottom: .6em; 121 | padding-top: .75em; 122 | padding-right: 6px; 123 | padding-left: .75em; 124 | padding-bottom: .75em; 125 | cursor: hand; 126 | border-left: 4pt solid #339900; 127 | background-color: #F0F0F0; } 128 | 129 | /* Only use this for sidebars that are NOT in a list */ 130 | DIV.sidebartbl { 131 | height: 72px; 132 | width: 300px; 133 | margin-top: .6em; 134 | margin-right: 3em; 135 | margin-left: 0; 136 | margin-bottom: .6em; 137 | padding-top: .75em; 138 | padding-right: 8em; 139 | padding-left: .75em; 140 | padding-bottom: .75em; 141 | cursor: hand; 142 | border-left: 4pt solid #339900; 143 | background-color: #F0F0F0; } 144 | 145 | a:visited.sidebar: { 146 | color: #339900; 147 | text-decoration: none; } 148 | 149 | a:hover.sidebar: { 150 | text-decoration: underline; } 151 | 152 | .banner { 153 | padding:3px; 154 | padding-left:50px; 155 | margin:0px; 156 | margin-bottom:10px; 157 | background: #6699CC; 158 | height:25px; 159 | } 160 | .all {font-size:20px; color: #666666;font-family: Impact,Verdana, Arial, Helvetica, 161 | } 162 | .snap {font-size:20px; color: #eeeeee;font-family: Impact,Verdana, Arial, Helvetica,} 163 | .newbody {margin:20px; 164 | padding:0px;} 165 | 166 | .note {font-size:80%; 167 | font-weight:normal; 168 | font-style:italic;} 169 | 170 | .date {font-size:80%; 171 | margin-left:200px; 172 | font-weight:normal; 173 | font-style:italic;} -------------------------------------------------------------------------------- /IE4.CSS: -------------------------------------------------------------------------------- 1 | 2 | /*** BASIC STYLES ***/ 3 | 4 | BODY 5 | { 6 | font-family:verdana,arial,helvetica; 7 | margin:0; 8 | } 9 | 10 | TABLE.clsContainer 11 | { 12 | height:78%; 13 | } 14 | 15 | A:link { color:#003399; } 16 | A:visited { color:#660099; } 17 | A:hover { color:#FF3300; } 18 | 19 | H1 20 | { 21 | font-size:165%; 22 | margin:0; 23 | } 24 | 25 | H2 26 | { 27 | font-size:125%; 28 | margin-top:1em; margin-bottom:0px; 29 | } 30 | 31 | H3 32 | { 33 | font-size:115%; 34 | margin-bottom:0px; 35 | } 36 | 37 | H4, H5, H6 38 | { 39 | font-size:100%; 40 | margin-bottom:0px; 41 | } 42 | 43 | 44 | DIV.clsDocBody 45 | { 46 | margin-left:10px; 47 | margin-right:10px; 48 | } 49 | 50 | TD, TH { font-size:68%; } 51 | 52 | P 53 | { 54 | line-height:1.5em; 55 | margin-top:0.5em; margin-bottom:1.0em; 56 | } 57 | 58 | PRE 59 | { 60 | background:#EEEEEE; 61 | margin-top:1em; margin-bottom:1em; margin-left:0px; 62 | padding:5pt; 63 | } 64 | 65 | SPAN.db PRE, SPAN.ci PRE, SPAN.di PRE 66 | { 67 | background:#EEEEEE; 68 | padding-top: 0pt; 69 | padding-bottom: 0pt; 70 | } 71 | 72 | PRE.clsCode, CODE.clsText { font-size:110%; font-family:'courier new',courier,serif; } 73 | 74 | PRE.clsCCCode { font-size:120%; font-family:'courier new',courier,serif;background:none } 75 | 76 | PRE.clsSyntax { font-size:100%; font-family:verdana,arial,helvetica,sans-serif; } 77 | 78 | HR 79 | { 80 | color:#CCCCCC; 81 | height:1px; 82 | } 83 | 84 | UL { margin-left:25px; margin-top:10px; margin-bottom:10px; } 85 | 86 | OL { margin-left:25px; margin-top:10px; margin-bottom:10px; } 87 | 88 | UL LI 89 | { 90 | line-height:1.5em; 91 | margin-bottom:0.5em; 92 | } 93 | 94 | UL LI LI { list-style-type: disc; } 95 | 96 | 97 | OL LI { margin-bottom:0.7em; } 98 | 99 | INPUT.clsButton { font-weight: bold; color: #ffffff; background-color: #6699cc; margin-top: 10px; margin-left: 5px; } 100 | 101 | 102 | /*** CUSTOM STYLES ***/ 103 | 104 | P.small 105 | { 106 | font:normal 95%; 107 | } 108 | 109 | P.smallWhite 110 | { 111 | font:normal 95%; 112 | color:#FFFFFF; 113 | } 114 | 115 | P.author 116 | { 117 | font:italic 95%; 118 | } 119 | 120 | p.NoLeftMar 121 | { 122 | margin-left:-15px; 123 | } 124 | 125 | A.small 126 | { 127 | font:normal 95%; 128 | text-decoration:underline; 129 | } 130 | 131 | A.smallWhite 132 | { 133 | font:normal 95%; 134 | text-decoration:underline; 135 | color:#FFFFFF; 136 | } 137 | 138 | .CODE 139 | { 140 | font:normal courier; 141 | } 142 | 143 | .CODE2 144 | { 145 | background-color:#CCCCCC; 146 | font:normal courier; 147 | } 148 | 149 | .DATE 150 | { 151 | color:#999999; 152 | } 153 | 154 | .VRULE 155 | { 156 | border-left:#CCCCCC 1px solid; 157 | } 158 | 159 | TITLE.open 160 | { 161 | font:95%; 162 | color:#FFFFFF; 163 | } 164 | 165 | TITLE.closed 166 | { 167 | font:95%; 168 | color:#000000; 169 | } 170 | 171 | TABLE.DATA 172 | { 173 | border-collapse:collapse; 174 | border-left:solid 1 #CCCCCC; border-top:solid 1 #CCCCCC; 175 | padding:5px; 176 | } 177 | 178 | TH.DATA 179 | { 180 | border-right:solid 1 #CCCCCC; border-bottom:solid 1 #CCCCCC; 181 | background-color:#EEEEEE; 182 | } 183 | 184 | TD.DATA 185 | { 186 | font:normal; 187 | border-right:solid 1 #CCCCCC; border-bottom:solid 1 #CCCCCC; 188 | background-color:#FFFFFFF; 189 | } 190 | 191 | table.clsCCDCInfo 192 | { 193 | background-color:#EEEEEE; 194 | } 195 | 196 | .LOCATION 197 | { 198 | font:normal 24px; 199 | color:#CCCCCC; 200 | } 201 | 202 | /*** HACK ***/ 203 | 204 | .footer 205 | { 206 | font: bold xx-small Verdana; 207 | } 208 | 209 | .footer:link { color:#FFFFFF; text-decoration:none;} 210 | .footer:hover { color:#FF3300; } 211 | 212 | /* 213 | table#idFooter 214 | { 215 | position:expression( (document.body.scrollHeight < document.body.offsetHeight) ? "absolute" : "relative" ); 216 | top:expression( (document.body.scrollHeight < document.body.offsetHeight) ? (document.body.offsetHeight - idFooter.offsetHeight - 0) : 0 ); 217 | } 218 | */ 219 | 220 | /* Biztalk & Commerce Server styles */ 221 | div.artstyle { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 7pt; color: #000000; font-style: normal; line-height: normal; font-weight: normal} 222 | 223 | /* Inetsdk styles */ 224 | TABLE.clsStd TH { 225 | 226 | text-align:left; vertical-align:top; 227 | 228 | background-color:#DDD; 229 | 230 | padding:2px; 231 | 232 | } 233 | TABLE.clsStd TD { 234 | 235 | vertical-align:top; 236 | 237 | background-color:#EEE; 238 | 239 | padding:2px; 240 | 241 | } 242 | P.clsRef { 243 | 244 | font-weight:bold; 245 | 246 | margin-top:12pt; margin-bottom:0em; 247 | 248 | } 249 | 250 | -------------------------------------------------------------------------------- /snap_XP.c: -------------------------------------------------------------------------------- 1 | //stupid icon button 2 | #include 3 | typedef HTHEME (WINAPI *PFNOPENTHEMEDATA)( 4 | HWND hwnd, 5 | LPCWSTR pszClassList 6 | ); 7 | typedef HRESULT (WINAPI *PFNDRAWTHEMEBACKGROUND)( 8 | HTHEME hTheme, 9 | HDC hdc, 10 | int iPartId, 11 | int iStateId, 12 | const RECT *pRect, 13 | const RECT *pClipRect 14 | ); 15 | 16 | typedef BOOL (WINAPI *PFNBOOL)(VOID); 17 | typedef BOOL (WINAPI *PFNCLOSETHEMEDATA)(HTHEME hTheme); 18 | 19 | //====================================================================== 20 | //stupid windows XP can't draw a BS_ICON button right 21 | LRESULT CALLBACK MyIconButtonProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); 22 | //======================================================================== 23 | 24 | 25 | 26 | PFNOPENTHEMEDATA pfnOpenThemeData = NULL; 27 | PFNBOOL pfnIsThemeActive = NULL; 28 | PFNBOOL pfnIsAppThemed = NULL; 29 | PFNDRAWTHEMEBACKGROUND pfnDrawThemeBackground = NULL; 30 | PFNCLOSETHEMEDATA pfnCloseThemeData = NULL; 31 | 32 | 33 | HINSTANCE hinstUxthemeDll = NULL; 34 | 35 | 36 | //I wish I could delay load but I don't have the lib. 37 | 38 | BOOL LoadXPCrap(){ 39 | static tried_and_failed = FALSE; 40 | if (hinstUxthemeDll == NULL && !tried_and_failed){ 41 | //DMB(_T("loading uxtheme.dll")); 42 | hinstUxthemeDll = LoadLibrary(_T("uxtheme.dll")); 43 | if (hinstUxthemeDll != NULL){ 44 | //DMB(_T("loaded dll, and now getting proc addresses")); 45 | pfnOpenThemeData = (PFNOPENTHEMEDATA) GetProcAddress(hinstUxthemeDll,"OpenThemeData"); 46 | pfnIsThemeActive = (PFNBOOL) GetProcAddress(hinstUxthemeDll,"IsThemeActive"); 47 | pfnIsAppThemed = (PFNBOOL) GetProcAddress(hinstUxthemeDll,"IsAppThemed"); 48 | pfnCloseThemeData = (PFNCLOSETHEMEDATA) GetProcAddress(hinstUxthemeDll,"CloseThemeData"); 49 | pfnDrawThemeBackground = (PFNDRAWTHEMEBACKGROUND) GetProcAddress(hinstUxthemeDll,"DrawThemeBackground"); 50 | 51 | 52 | if ( 53 | (pfnOpenThemeData == NULL) 54 | || (pfnIsThemeActive == NULL) 55 | || (pfnIsAppThemed == NULL) 56 | || (pfnCloseThemeData == NULL) 57 | || (pfnDrawThemeBackground == NULL) 58 | ){ 59 | FreeLibrary(hinstUxthemeDll); 60 | chFAIL("Failed to get requested functions from uxtheme.dll"); 61 | tried_and_failed = TRUE; 62 | return FALSE; 63 | } 64 | else{ 65 | tried_and_failed = FALSE; 66 | return TRUE; 67 | } 68 | 69 | } 70 | else{ 71 | chFAIL(_T("couldn't load uxtheme.dll")); 72 | tried_and_failed = TRUE; 73 | return FALSE; 74 | } 75 | } 76 | else{ 77 | return (hinstUxthemeDll!= NULL && !tried_and_failed); 78 | } 79 | 80 | } 81 | 82 | BOOL XP_IsXpThemed(){ 83 | return isXP && 84 | ((pfnIsThemeActive != NULL) && pfnIsThemeActive()) 85 | && 86 | ((pfnIsAppThemed != NULL) && pfnIsAppThemed()) 87 | 88 | } 89 | 90 | BOOL XP_DrawButtonBackground(HWND hWnd){ 91 | HRESULT hr; 92 | HTHEME htheme; 93 | 94 | 95 | if (LoadXPCrap() && XP_IsXpThemed()){ 96 | htheme = pfnOpenThemeData(NULL, L"BUTTON"); 97 | if (htheme) 98 | { 99 | HDC hdc = GetDC(hWnd); 100 | 101 | LRESULT state = SendMessage(hWnd, 102 | BM_GETSTATE, // message to send 103 | 0, 104 | 0); 105 | if(state & BST_PUSHED) 106 | hr = pfnDrawThemeBackground(htheme, hdc, BP_PUSHBUTTON, PBS_PRESSED, &rc, NULL); 107 | else if(state & 0x200) 108 | hr = pfnDrawThemeBackground(htheme, hdc, BP_PUSHBUTTON, PBS_HOT, &rc, NULL); 109 | else 110 | hr = pfnDrawThemeBackground(htheme, hdc, BP_PUSHBUTTON, PBS_NORMAL, &rc, NULL); 111 | 112 | pfnCloseThemeData(htheme); 113 | return TRUE; 114 | } 115 | } 116 | else{ 117 | return FALSE; 118 | } 119 | } 120 | 121 | 122 | 123 | void XP_SubclassIconButton( HWND hButton); 124 | { 125 | ULONG ulOriginalProc; 126 | 127 | // Get the original window procedure address and replace 128 | // it by our own 129 | ulOriginalProc = SetWindowLong( 130 | hButton, 131 | GWL_WNDPROC, 132 | (ULONG)MyButtonProc ); 133 | 134 | // Store the original window procedure address in 135 | // the user data of the button 136 | SetWindowLong( 137 | hButton, 138 | GWL_USERDATA, 139 | ulOriginalProc ); 140 | } 141 | 142 | LRESULT CALLBACK MyIconButtonProc( 143 | HWND hWnd, 144 | UINT uMsg, 145 | WPARAM wParam, 146 | LPARAM lParam ) 147 | { 148 | WNDPROC pfProc; 149 | TCHAR szLink[MAX_LOADSTRING]; 150 | 151 | 152 | switch (uMsg){ 153 | 154 | case WM_GETTEXT: 155 | if (XP_DrawButtonBackground(hWnd)) 156 | break; 157 | 158 | default: 159 | pfProc = (WNDPROC)GetWindowLong(hWnd, GWL_USERDATA ); 160 | return CallWindowProc( pfProc, hWnd,uMsg, wParam, lParam ); 161 | } 162 | } 163 | 164 | 165 | -------------------------------------------------------------------------------- /snap_lib.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {466d67e1-059e-4baa-bf82-be7337c31ae5} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | {55a0c0ba-2528-42bd-9476-4f16854d5c55} 10 | h;hpp;hxx;hm;inl 11 | 12 | 13 | {352999b8-ba63-4113-adc7-6c7a3d24e03a} 14 | ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | Source Files 41 | 42 | 43 | Source Files 44 | 45 | 46 | Source Files 47 | 48 | 49 | Source Files 50 | 51 | 52 | Source Files 53 | 54 | 55 | Source Files 56 | 57 | 58 | Source Files 59 | 60 | 61 | Source Files 62 | 63 | 64 | 65 | 66 | Header Files 67 | 68 | 69 | Header Files 70 | 71 | 72 | Header Files 73 | 74 | 75 | Header Files 76 | 77 | 78 | Header Files 79 | 80 | 81 | Header Files 82 | 83 | 84 | Header Files 85 | 86 | 87 | Header Files 88 | 89 | 90 | Header Files 91 | 92 | 93 | Header Files 94 | 95 | 96 | Header Files 97 | 98 | 99 | Header Files 100 | 101 | 102 | Header Files 103 | 104 | 105 | Header Files 106 | 107 | 108 | Header Files 109 | 110 | 111 | Header Files 112 | 113 | 114 | Header Files 115 | 116 | 117 | Header Files 118 | 119 | 120 | Header Files 121 | 122 | 123 | Header Files 124 | 125 | 126 | 127 | 128 | Resource Files 129 | 130 | 131 | -------------------------------------------------------------------------------- /settings.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | allSnap - Settings 5 | 6 | 7 | 8 | 9 |

Settings

10 |

A property sheet provides a way to change the following settings. 11 |

12 |

(you can also right click on the property sheet itself to get 13 | help)

14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 |
17 | Preferences/General:
Snap to windows at x pixelsAdjusts how close two windows must be before they snap
Snap to desktop at x pixelsAdjusts how close a window must be to the edge of the screen before it snaps. 26 |
27 | also used for the center snap items 28 | described below 29 |
Toggle keySelects key to temporarily disable window snapping
36 | 37 | 38 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 48 | 49 | 50 | 51 | 53 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 |
39 | Preferences/Snap to: Chooses which windows to snap to:
DesktopSnap to the edges of the screen(s).
47 | Other WindowsSnap to all other windows.
52 | Old PositionSnap to a window's old position.
54 | makes more sense when 'Display Properties/Effects/show contents 55 | while dragging' is turned off 56 |
Vertical centerSnap to the vertical center of the screen(s).
Horizontal centerSnap to the horizontal center of the screen(s).
67 | 68 | 69 | 71 | 72 | 73 | 74 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 86 | 87 |
70 | Sounds: Allows you to add sound effects to the snapping.
Snap sound file 75 | .wav file that is played when a window snaps.
Unsnap sound file.wav file that is played when a window un-snaps.
Play SoundsTurn on/off sound effects.
84 | sounds may become annoying so they are turned off by default 85 |
88 | 89 | 90 | 92 | 93 | 94 | 95 | 97 | 98 | 99 | 100 | 103 | 104 | 105 | 106 | 108 | 109 | 110 | 111 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 127 | 128 | 129 | 131 | 132 | 133 | 135 | 137 | 138 |
91 | Advanced:
Desktop icons 'Align to Grid'Automatically line up desktop icons after moving them as in XP.  (not 96 | needed in XP)
Snap MDI windowsMakes other applications' MDI windows snap.
101 | MDI windows are document windows that are contained within an 102 | application's main window.
Don't snap to inside edgesDiables windows from snapping to the inside edges of other windows.
107 | e.g. snapping the top of one window to the top of another window
Invert toggle keyInverts the toggle key function.
112 | When selected, windows will not snap unless the toggle 113 | key is held down.
Hide iconHides the system tray icon. To show the icon again re-run allSnap.exe.
Crop top of windows by x pixelsUsing allSnap with certain XP styles (e.g. Watercolor) will leave a thin space 122 | at the top of the windows. This option fixes this by making allSnap think all 123 | windows are x pixels shorter.
124 | This fix is not smart enough to detect which windows are using 125 | the problem style, so it is bound to make certain custom-skinned apps snap 126 | incorrectly.
Constrain windows to the screenPrevents windows from moving off the sides of the screen. 130 |
Ignore window clipping regions 134 | Some applications set a visible clipping region of a window.  This option 136 | ignores this setting and snaps to the actual hidden widow size.
139 | 140 | 141 | -------------------------------------------------------------------------------- /allSnap.iss: -------------------------------------------------------------------------------- 1 | ;--allSnap Install 2 | ; 3 | ; 4 | 5 | [Setup] 6 | OutputBaseFilename=asnp1314 7 | AppName=allSnap 8 | AppVerName=allSnap version 1.34 Beta 4 [Non Debug] 9 | AppMutex=IVAN_HECKMAN_ALLSNAP_MUTEX,IVAN_HECKMAN_ALLSNAP_MUTEXB 10 | AppCopyright=Copyright (C) 2002-2004 Ivan Heckman 11 | AppPublisher=Ivan Heckman 12 | AppPublisherURL=http://members.rogers.com/ivanheckman 13 | AppUpdatesURL=http://members.rogers.com/ivanheckman 14 | AppVersion=1.31.4 15 | DefaultDirName={pf}\allSnap 16 | DefaultGroupName=allSnap 17 | UninstallDisplayIcon={app}\allSnap.exe 18 | LicenseFile=EULA.txt 19 | AllowNoIcons=yes 20 | ; uncomment the following line if you want your installation to run on NT 3.51 too. 21 | ; MinVersion=4,3.51 22 | 23 | [Files] 24 | Source: "Release\snapToA.exe"; DestDir: "{app}"; DestName: "allSnap.exe"; MinVersion: 1, 0 25 | Source: "Release\snap_libA.dll"; DestDir: "{app}"; MinVersion: 1, 0 26 | Source: "Release_UNICODE\snapToW.exe"; DestDir: "{app}"; DestName: "allSnap.exe"; MinVersion: 0, 1 27 | Source: "Release_UNICODE\snap_libW.dll"; DestDir: "{app}"; MinVersion: 0, 1 28 | Source: "Release\auto_lineup.dll"; DestDir: "{app}"; 29 | Source: "snap.wav"; DestDir: "{app}" 30 | Source: "unsnap.wav"; DestDir: "{app}" 31 | Source: "allSnap.chm"; DestDir: "{app}" 32 | 33 | [Tasks] 34 | Name: startup; Description: "Run allSnap on &startup"; Flags: unchecked; 35 | Name: desktopicon; Description: "Create a &desktop icon"; Flags: unchecked 36 | Name: quicklaunchicon; Description: "Create a &quick launch icon"; Flags: unchecked 37 | 38 | 39 | [Code] 40 | function MessageBox(hWnd: Integer; lpText, lpCaption: String; uType: Cardinal): Integer; 41 | external 'MessageBoxA@user32.dll stdcall'; 42 | { 43 | function InitializeSetup(): Boolean; 44 | begin 45 | if (RegKeyExists(HKCU,'Software\IvanHeckman\allSnap')) then begin 46 | Result := IDYES = MsgBox('A pre-existing version of allSnap was detected on your computer.' #13#13 47 | 'It is suggested that you uninstall any old version before installing this one.' #13 48 | 'Do you still want to continue installing this version?', mbInformation, MB_YESNO); 49 | end else 50 | Result := True; 51 | end; 52 | } 53 | function GetPathInstalled( AppID: String ): String; 54 | var 55 | sPrevPath: String; 56 | begin 57 | sPrevPath := ''; 58 | if not RegQueryStringValue( HKLM, 59 | 'Software\Microsoft\Windows\CurrentVersion\Uninstall\'+AppID+'_is1', 60 | 'Inno Setup: App Path', sPrevpath) then 61 | RegQueryStringValue( HKCU, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\'+AppID+'_is1' , 62 | 'Inno Setup: App Path', sPrevpath); 63 | 64 | Result := sPrevPath; 65 | end; 66 | 67 | 68 | function InitializeSetup(): Boolean; 69 | var 70 | sPrevPath: String; 71 | sPrevID: String; 72 | begin 73 | sPrevID := 'allSnap'; 74 | sPrevPath := GetPathInstalled( sprevID ); 75 | 76 | if ( Length(sPrevPath) > 0 ) then begin 77 | Result := IDYES = MsgBox('A pre-existing version of allSnap was detected on your computer.' #13#13 78 | 'It is suggested that you uninstall any old version before installing this one.' #13 79 | 'Do you still want to continue installing this version?', mbInformation, MB_YESNO); 80 | end else 81 | Result := True; 82 | end; 83 | 84 | 85 | [Icons] 86 | Name: "{group}\allSnap"; Filename: "{app}\allSnap.EXE"; WorkingDir: "{app}" 87 | Name: "{group}\allSnap Help"; Filename: "{app}\allSnap.chm"; WorkingDir: "{app}" 88 | Name: "{userdesktop}\allSnap"; Filename: "{app}\allSnap.exe"; WorkingDir: "{app}"; Tasks: desktopicon 89 | Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\allSnap"; Filename: "{app}\allSnap.exe";WorkingDir: "{app}"; Tasks: quicklaunchicon 90 | Name: "{userstartup}\allSnap"; Filename: "{app}\allSnap.exe"; WorkingDir: "{app}"; Tasks: startup 91 | ; NOTE: Most apps do not need registry entries to be pre-created. If you 92 | ; don't know what the registry is or if you need to use it, then chances are 93 | ; you don't need a [Registry] section. 94 | 95 | [Registry] 96 | ; Start "Software\My Company\My Program" keys under HKEY_CURRENT_USER 97 | ; and HKEY_LOCAL_MACHINE. The flags tell it to always delete the 98 | ; "My Program" keys upon uninstall, and delete the "My Company" keys 99 | ; if there is nothing left in them. 100 | Root: HKCU; Subkey: "Software\IvanHeckman"; Flags: uninsdeletekeyifempty 101 | Root: HKCU; Subkey: "Software\IvanHeckman\allSnap"; Flags: uninsdeletekey 102 | Root: HKCU; Subkey: "Software\IvanHeckman\allSnap\Settings"; ValueType: string; ValueName: "snap_sound_file"; ValueData: "{app}\snap.wav" 103 | Root: HKCU; Subkey: "Software\IvanHeckman\allSnap\Settings"; ValueType: string; ValueName: "unsnap_sound_file"; ValueData: "{app}\unsnap.wav" 104 | Root: HKCU; Subkey: "Software\IvanHeckman\allSnap\Settings"; ValueType: multisz; ValueName: "skinned_windows"; ValueData: "Shell_TrayWnd{break}icoCTactTrilly{break}ConsoleWindowClass{break}Winamp PE{break}Winamp EQ{break}Winamp MB{break}Winamp v1.x{break}BaseWindow_RootWnd" 105 | Root: HKCU; Subkey: "Software\IvanHeckman\allSnap\Settings"; ValueType: multisz; ValueName: "ignored_windows"; ValueData: "Progman{break}IDEOwner{break}NeilShadow" 106 | 107 | [Run] 108 | Filename: "{app}\allSnap.EXE"; Description: "Launch application"; Flags: postinstall nowait skipifsilent unchecked 109 | -------------------------------------------------------------------------------- /allSnapDebug.iss: -------------------------------------------------------------------------------- 1 | ;--allSnap Install 2 | ; 3 | ; 4 | 5 | [Setup] 6 | OutputBaseFilename=asnp132 7 | AppName=allSnapBeta 8 | AppVerName=allSnap version 1.32.0 Beta 9 | AppMutex=IVAN_HECKMAN_ALLSNAP_MUTEX,IVAN_HECKMAN_ALLSNAP_MUTEXB 10 | AppCopyright=Copyright (C) 2002-2005 Ivan Heckman 11 | AppPublisher=Ivan Heckman 12 | AppPublisherURL=http://members.rogers.com/ivanheckman 13 | AppUpdatesURL=http://members.rogers.com/ivanheckman 14 | AppVersion=1.32 15 | DefaultDirName={pf}\allSnapBeta 16 | DefaultGroupName=allSnapBeta 17 | UninstallDisplayIcon={app}\allSnap.exe 18 | LicenseFile=EULA.txt 19 | AllowNoIcons=yes 20 | PrivilegesRequired=admin 21 | ; uncomment the following line if you want your installation to run on NT 3.51 too. 22 | ; MinVersion=4,3.51 23 | 24 | [Files] 25 | Source: "Debug\snapToA.exe"; DestDir: "{app}"; DestName: "allSnap.exe"; MinVersion: 1, 0 26 | Source: "Debug\snap_libA.dll"; DestDir: "{app}"; MinVersion: 1, 0; Flags: restartreplace 27 | Source: "Debug_UNICODE\snapToW.exe"; DestDir: "{app}"; DestName: "allSnap.exe"; MinVersion: 0, 1 28 | Source: "Debug_UNICODE\snap_libW.dll"; DestDir: "{app}"; MinVersion: 0, 1; Flags: restartreplace 29 | Source: "auto_lineup\Debug\auto_lineup.dll"; DestDir: "{app}"; Flags: restartreplace 30 | Source: "snap.wav"; DestDir: "{app}" 31 | Source: "unsnap.wav"; DestDir: "{app}" 32 | Source: "allSnap.chm"; DestDir: "{app}" 33 | 34 | [Tasks] 35 | Name: startup; Description: "Run allSnap on &startup"; Flags: unchecked; 36 | Name: desktopicon; Description: "Create a &desktop icon"; Flags: unchecked 37 | Name: quicklaunchicon; Description: "Create a &quick launch icon"; Flags: unchecked 38 | 39 | [Code] 40 | function MessageBox(hWnd: Integer; lpText, lpCaption: String; uType: Cardinal): Integer; 41 | external 'MessageBoxA@user32.dll stdcall'; 42 | { 43 | function InitializeSetup(): Boolean; 44 | begin 45 | if (RegKeyExists(HKCU,'Software\IvanHeckman\allSnap')) then begin 46 | Result := IDYES = MsgBox('A pre-existing version of allSnap was detected on your computer.' #13#13 47 | 'It is suggested that you uninstall any old version before installing this one.' #13 48 | 'Do you still want to continue installing this version?', mbInformation, MB_YESNO); 49 | end else 50 | Result := True; 51 | end; 52 | } 53 | function GetPathInstalled( AppID: String ): String; 54 | var 55 | sPrevPath: String; 56 | begin 57 | sPrevPath := ''; 58 | if not RegQueryStringValue( HKLM, 59 | 'Software\Microsoft\Windows\CurrentVersion\Uninstall\'+AppID+'_is1', 60 | 'Inno Setup: App Path', sPrevpath) then 61 | RegQueryStringValue( HKCU, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\'+AppID+'_is1' , 62 | 'Inno Setup: App Path', sPrevpath); 63 | 64 | Result := sPrevPath; 65 | end; 66 | 67 | 68 | function InitializeSetup(): Boolean; 69 | var 70 | sPrevPath: String; 71 | sPrevID: String; 72 | begin 73 | sPrevID := 'allSnap'; 74 | sPrevPath := GetPathInstalled( sprevID ); 75 | 76 | if ( Length(sPrevPath) > 0 ) then begin 77 | Result := IDYES = MsgBox('A pre-existing version of allSnap was detected on your computer.' #13#13 78 | 'It is suggested that you uninstall any old version before installing this one.' #13 79 | 'Do you still want to continue installing this version?', mbInformation, MB_YESNO); 80 | end else 81 | Result := True; 82 | end; 83 | 84 | 85 | [Icons] 86 | Name: "{group}\allSnap Beta"; Filename: "{app}\allSnap.EXE"; WorkingDir: "{app}" 87 | Name: "{group}\allSnap Help"; Filename: "{app}\allSnap.chm"; WorkingDir: "{app}" 88 | Name: "{userdesktop}\allSnap Beta"; Filename: "{app}\allSnap.exe"; WorkingDir: "{app}"; Tasks: desktopicon 89 | Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\allSnap Beta"; Filename: "{app}\allSnap.exe";WorkingDir: "{app}"; Tasks: quicklaunchicon 90 | Name: "{userstartup}\allSnap"; Filename: "{app}\allSnap.exe"; WorkingDir: "{app}"; Tasks: startup 91 | ; NOTE: Most apps do not need registry entries to be pre-created. If you 92 | ; don't know what the registry is or if you need to use it, then chances are 93 | ; you don't need a [Registry] section. 94 | 95 | [Registry] 96 | ; Start "Software\My Company\My Program" keys under HKEY_CURRENT_USER 97 | ; and HKEY_LOCAL_MACHINE. The flags tell it to always delete the 98 | ; "My Program" keys upon uninstall, and delete the "My Company" keys 99 | ; if there is nothing left in them. 100 | Root: HKCU; Subkey: "Software\IvanHeckman"; Flags: uninsdeletekeyifempty 101 | Root: HKCU; Subkey: "Software\IvanHeckman\allSnap"; Flags: uninsdeletekey 102 | Root: HKCU; Subkey: "Software\IvanHeckman\allSnap\Settings"; ValueType: string; ValueName: "snap_sound_file"; ValueData: "{app}\snap.wav" 103 | Root: HKCU; Subkey: "Software\IvanHeckman\allSnap\Settings"; ValueType: string; ValueName: "unsnap_sound_file"; ValueData: "{app}\unsnap.wav" 104 | Root: HKCU; Subkey: "Software\IvanHeckman\allSnap\Settings"; ValueType: string; ValueName: "skinned_classes"; ValueData: "Shell_TrayWnd;icoCTactTrilly;CabinetWClass;ConsoleWindowClass;Winamp PE;Winamp EQ;Winamp MB;Winamp v1.x;BaseWindow_RootWnd" 105 | Root: HKCU; Subkey: "Software\IvanHeckman\allSnap\Settings"; ValueType: string; ValueName: "ignored_classes"; ValueData: "Progman;IDEOwner;NeilShadow;DockItemClass;ODIndicator" 106 | 107 | [Run] 108 | Filename: "{app}\allSnap.EXE"; Description: "Launch application"; Flags: postinstall nowait skipifsilent unchecked 109 | -------------------------------------------------------------------------------- /SIDES.C: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "SIDES.H" 3 | #include 4 | 5 | TCHAR * g_side_names[]={ 6 | _T("NO SIDE"), 7 | _T("LEFT"), 8 | _T("RIGHT"), 9 | _T("TOP"), 10 | _T("BOTTOM")}; 11 | 12 | const enum SIDE OPPOSITE_SIDES[]={ 13 | SIDE_NONE, 14 | SIDE_RIGHT, SIDE_LEFT, 15 | SIDE_BOTTOM,SIDE_TOP 16 | }; 17 | 18 | const enum SIDE ADJACENT_SIDES[]={ 19 | SIDE_NONE, 20 | SIDE_TOP, 21 | SIDE_BOTTOM, 22 | SIDE_LEFT, 23 | SIDE_RIGHT 24 | }; 25 | 26 | enum SIDE OppositeSide(enum SIDE what_side){ 27 | chASSERT(what_side != SIDE_NONE); 28 | return OPPOSITE_SIDES[what_side]; 29 | } 30 | 31 | enum SIDE AdjacentSide(enum SIDE what_side){ 32 | chASSERT(what_side != SIDE_NONE); 33 | return ADJACENT_SIDES[what_side]; 34 | } 35 | // get the top,bottom,left or right value of a rect, deppending on 36 | // what SIDE we ask for 37 | int GetSideOfRect(enum SIDE what_side, const LPCRECT pRect) 38 | { 39 | switch(what_side) 40 | { 41 | case SIDE_LEFT: 42 | return pRect->left; 43 | case SIDE_RIGHT: 44 | return pRect->right; 45 | case SIDE_TOP: 46 | return pRect->top; 47 | case SIDE_BOTTOM: 48 | return pRect->bottom; 49 | default: 50 | chFAIL(_T("not a valid side")); 51 | return 0; 52 | } 53 | } 54 | 55 | TCHAR * SideToString(enum SIDE which_side){ 56 | chASSERT(chINRANGE(SIDE_NONE,which_side,SIDE_BOTTOM)); 57 | return g_side_names[(int)which_side]; 58 | } 59 | 60 | //Set the given SIDE of a rect structure 61 | 62 | void SetSideOfRect(enum SIDE what_side, int new_val, LPRECT pRect) 63 | { 64 | switch(what_side) 65 | { 66 | case SIDE_LEFT: 67 | pRect->left = new_val; 68 | break; 69 | case SIDE_RIGHT: 70 | pRect->right = new_val; 71 | break; 72 | case SIDE_TOP: 73 | pRect->top = new_val; 74 | break; 75 | case SIDE_BOTTOM: 76 | pRect->bottom = new_val; 77 | break; 78 | default: 79 | chFAIL(_T("not a valid side")); 80 | } 81 | } 82 | 83 | //GetSideSign 84 | //return the direction moving out from side 85 | //would move the screen coords 86 | int GetSideSign(enum SIDE side) 87 | { 88 | switch(side){ 89 | case SIDE_LEFT: //fallthrough 90 | case SIDE_TOP: 91 | return -1; 92 | case SIDE_RIGHT: //fallthrough 93 | case SIDE_BOTTOM: 94 | return 1; 95 | default: 96 | chFAIL(_T("not a valid side")); 97 | return 0; //never gets here? 98 | } 99 | } 100 | 101 | void ExtendOut(RECT * p_rect,enum SIDE side,int new_width){ 102 | int new_val = GetSideOfRect(OppositeSide(side),p_rect) + 103 | (GetSideSign(side) * new_width); 104 | SetSideOfRect(side,new_val,p_rect); 105 | } 106 | 107 | void AlignToSide 108 | ( 109 | LPRECT my_rect, 110 | enum SIDE align_side, 111 | int position 112 | ) 113 | { // side_val 114 | // ^ 115 | // ---------------- | 116 | // - my_rect - | 117 | // ---------------- | 118 | // ^ ^ 119 | // opp_side_Val position 120 | // ^ 121 | // | 122 | // ---------------+ 123 | // --> - my_rect + 124 | // ---------------+ 125 | int side_val = GetSideOfRect(align_side,my_rect); 126 | int opp_side_val = GetSideOfRect(OppositeSide(align_side),my_rect); 127 | 128 | int size = opp_side_val - side_val; // may be negative 129 | 130 | int aligned_side_val = position; 131 | int aligned_opp_side_val = aligned_side_val + size; //may be negative 132 | 133 | SetSideOfRect(align_side, aligned_side_val ,my_rect); 134 | SetSideOfRect(OppositeSide(align_side), aligned_opp_side_val,my_rect); 135 | 136 | } 137 | //Align a SIDE of the Alignee rect with a SIDE of the Aligner rect 138 | // 139 | void AlignToRect 140 | ( 141 | LPCRECT Aligner, 142 | LPRECT Alignee, 143 | enum SIDE AlignerSide, 144 | enum SIDE AligneeSide 145 | ) 146 | { // aligneeSideVal 147 | // ^ 148 | // ++++++++++++++++ --------------- 149 | // + Alignee + | Aligner | 150 | // ++++++++++++++++ --------------- 151 | // ^ ^ 152 | // aligneeOpSideVal alignedSideVal 153 | // ^ 154 | // | 155 | // ++++++++++++++++-------------- 156 | // --> + Alignee + Aligner | 157 | // ++++++++++++++++-------------- 158 | 159 | 160 | //Can't align vertical SIDE with a horizontal SIDE or vice versa 161 | 162 | 163 | int aligneeSideVal = GetSideOfRect(AligneeSide,Alignee); 164 | int aligneeOpSideVal = GetSideOfRect(OppositeSide(AligneeSide),Alignee); 165 | 166 | int size = aligneeOpSideVal - aligneeSideVal; // may be negative 167 | 168 | 169 | int alignedSideVal = GetSideOfRect(AlignerSide,Aligner); 170 | int alignedOpSideVal = alignedSideVal + size; //may be negative 171 | 172 | chASSERT((AlignerSide == OppositeSide(AligneeSide)) || (AlignerSide == AligneeSide) ); 173 | 174 | SetSideOfRect(AligneeSide,alignedSideVal,Alignee); 175 | SetSideOfRect(OppositeSide(AligneeSide),alignedOpSideVal,Alignee); 176 | } 177 | 178 | 179 | //Take WPARAM from a WM_SIZING message (which is what edge is being sized) 180 | //and split it into two SIDE variables 181 | // 182 | // ??turn into table deal like thing?? 183 | // 184 | void split_edge(WPARAM which_edge, enum SIDE * vert_side, enum SIDE * horz_side){ 185 | switch(which_edge){ 186 | case WMSZ_BOTTOM: 187 | *vert_side = SIDE_BOTTOM; 188 | *horz_side = SIDE_NONE; 189 | return; 190 | case WMSZ_BOTTOMLEFT: 191 | *vert_side = SIDE_BOTTOM; 192 | *horz_side = SIDE_LEFT; 193 | return; 194 | case WMSZ_BOTTOMRIGHT: 195 | *vert_side = SIDE_BOTTOM; 196 | *horz_side = SIDE_RIGHT; 197 | return; 198 | case WMSZ_LEFT: 199 | *vert_side = SIDE_NONE; 200 | *horz_side = SIDE_LEFT; 201 | return; 202 | case WMSZ_RIGHT: 203 | *vert_side = SIDE_NONE; 204 | *horz_side = SIDE_RIGHT; 205 | return; 206 | case WMSZ_TOP: 207 | *vert_side = SIDE_TOP; 208 | *horz_side = SIDE_NONE; 209 | return; 210 | case WMSZ_TOPLEFT: 211 | *vert_side = SIDE_TOP; 212 | *horz_side = SIDE_LEFT; 213 | return; 214 | case WMSZ_TOPRIGHT: 215 | *vert_side = SIDE_TOP; 216 | *horz_side = SIDE_RIGHT; 217 | return; 218 | default: 219 | chFAIL(_T("WM_SIZING contains bad value")); 220 | } 221 | } -------------------------------------------------------------------------------- /snap_Crop.c: -------------------------------------------------------------------------------- 1 | //snap_CropTop.c 2 | //fix for certain XP styles that are taller than they look. 3 | 4 | #include "stdafx.h" 5 | //#include 6 | #include "snap_Crop.h" 7 | #include "snap_lib_internal.h" 8 | #include "sides.h" 9 | #include "snap_MultiSz.h" 10 | #include "snap_WinRects.h" 11 | 12 | #define MAX_SKINNEDAPP_CLASSNAME_SIZE 20 13 | #define num_skinnedAppClasses 7 14 | 15 | //remebers region other cropping info from when the window was first clicked. 16 | //store here??? no 17 | CROP_SIZING_INFO g_sizing_crop_info = {0}; 18 | 19 | BOOL IsSkinnedAppClass(HWND our_hWnd); 20 | void CropToRgn( LPCRECT pRgnBox, LPRECT pRect); 21 | void UnCropSideResults(PCROP_INFO p_crop,SIDE_SNAP_RESULTS * p_ssnap); 22 | void CropTop(HWND hwnd,PCROP_INFO p_crop,LPRECT pTempRect); 23 | void CropRgn(HWND hwnd,PCROP_INFO p_crop,LPRECT pTempRect); 24 | 25 | isTopCroppable(HWND hwnd){ 26 | return (!IsSkinnedAppClass(hwnd) && isCroppingTop()); 27 | } 28 | 29 | LPCRECT Crop_GetPCroppedRect(PCROP_INFO p_crop){ 30 | return &(p_crop->cropped_rect); 31 | } 32 | LPCRECT Crop_GetPUncroppedRect(PCROP_INFO p_crop){ 33 | return &(p_crop->uncropped_rect); 34 | } 35 | 36 | 37 | void CropTop(HWND hWnd,PCROP_INFO p_crop,LPRECT pTempRect){ 38 | int cropAmount = getCropTop(); 39 | 40 | if (p_crop->has_rgn){ 41 | cropAmount -= p_crop->rcRgn.top; 42 | } 43 | if (isTopCroppable(hWnd)){ 44 | if (cropAmount > 0){ 45 | p_crop->cropping_top = TRUE; 46 | pTempRect->top += cropAmount; 47 | } 48 | else{ 49 | p_crop->cropping_top = FALSE; 50 | } 51 | }else{ 52 | p_crop->cropping_top = FALSE; 53 | } 54 | } 55 | 56 | void CropRgn(HWND hWnd,PCROP_INFO p_crop,LPRECT pTempRect){ 57 | RECT rcRgn; 58 | 59 | if (isCroppingRgn()){ 60 | p_crop->has_rgn = WinRects_GetRgnBox(hWnd,&rcRgn); 61 | 62 | if (p_crop->has_rgn){ 63 | p_crop->rcRgn = rcRgn; 64 | 65 | //DBG_MSG_PRECT(g_hWnd_app,DBGMSG_FOUND_HRGN,(&rcRgn)); 66 | CropToRgn(&rcRgn,pTempRect); 67 | } 68 | } 69 | else{ 70 | p_crop->has_rgn = FALSE; 71 | } 72 | } 73 | 74 | 75 | void InitializeCropInfo(PCROP_INFO p_crop,LPCRECT pRect){ 76 | int width = pRect->right - pRect->left; 77 | int height = pRect->bottom - pRect->top; 78 | RECT blank_rgn = {0,0,width,height}; 79 | 80 | p_crop->cropped_rect = *pRect; 81 | p_crop->uncropped_rect = *pRect; 82 | p_crop->has_rgn = FALSE; 83 | p_crop->rcRgn = blank_rgn; 84 | p_crop->cropping_top = FALSE; 85 | } 86 | 87 | void Crop_LoadMovingCropInfo(PCROP_INFO p_crop,HWND hWnd,LPCRECT pRect){ 88 | RECT temp_rect = *pRect; 89 | 90 | InitializeCropInfo(p_crop,pRect); 91 | 92 | //THIS MUST HAPPEN FIRST (maybe only/all windows with rgns don't need croptop) 93 | CropRgn(hWnd,p_crop,&temp_rect); 94 | CropTop(hWnd,p_crop,&temp_rect); 95 | 96 | p_crop->cropped_rect = temp_rect; 97 | } 98 | 99 | void Crop_offset_sizing_side(enum SIDE the_side,RECT * p_temp_rect){ 100 | if (the_side != SIDE_NONE){ 101 | SetSideOfRect( 102 | the_side, 103 | ( GetSideOfRect(the_side,p_temp_rect) 104 | + GetSideOfRect(the_side,&(g_sizing_crop_info.offsets)) 105 | ), 106 | p_temp_rect); 107 | } 108 | } 109 | 110 | void Crop_CropSizingRect( 111 | RECT const * prect, 112 | enum SIDE v_side, 113 | enum SIDE h_side, 114 | RECT * p_cropped_rect 115 | ) 116 | { 117 | RECT temp_rect = * prect; 118 | 119 | if (g_sizing_crop_info.has_rgn){ 120 | Crop_offset_sizing_side(v_side,&temp_rect); 121 | Crop_offset_sizing_side(h_side,&temp_rect); 122 | } 123 | 124 | *p_cropped_rect = temp_rect; 125 | } 126 | 127 | 128 | void Crop_LoadSizingInfo(HWND hwnd){ 129 | DBG_MSG(g_hWnd_app,DBGMSG_INITSIZINGCROP); 130 | g_sizing_crop_info.has_rgn = FALSE; 131 | g_sizing_crop_info.offsets.top = 0; 132 | g_sizing_crop_info.offsets.left = 0; 133 | g_sizing_crop_info.offsets.bottom = 0; 134 | g_sizing_crop_info.offsets.right = 0; 135 | 136 | if (isCroppingRgn()){ 137 | RECT plain_rect = {0}; 138 | RECT rcRgn = {0}; 139 | int height,width; 140 | 141 | GetWindowRect(hwnd,&plain_rect); 142 | g_sizing_crop_info.has_rgn = WinRects_GetRgnBox(hwnd,&rcRgn); 143 | 144 | height = plain_rect.bottom - plain_rect.top; 145 | width = plain_rect.right - plain_rect.left; 146 | 147 | if (g_sizing_crop_info.has_rgn){ 148 | g_sizing_crop_info.offsets.top = rcRgn.top; 149 | g_sizing_crop_info.offsets.left = rcRgn.left; 150 | g_sizing_crop_info.offsets.bottom = height - rcRgn.bottom; 151 | g_sizing_crop_info.offsets.right = width - rcRgn.right; 152 | 153 | DBG_MSG_PRECT(g_hWnd_app,DBGMSG_ADJUST_HRGN,&g_sizing_crop_info.offsets); 154 | 155 | } 156 | } 157 | else{ 158 | g_sizing_crop_info.has_rgn = FALSE; 159 | } 160 | } 161 | 162 | void UnCropSizingSideResults(SIDE_SNAP_RESULTS * p_ssnap){ 163 | enum SIDES side = p_ssnap->side; 164 | 165 | if (side != SIDE_NONE){ 166 | int offset = GetSideOfRect(side,&(g_sizing_crop_info.offsets)); 167 | DBG_MSG_SIDE_VAL(g_hWnd_app,DBGMSG_ADJUST_HRGN,side,offset); 168 | p_ssnap->value -= offset; 169 | } 170 | } 171 | void Crop_UnCropSizingResults(SNAP_RESULTS * p_snap){ 172 | if (g_sizing_crop_info.has_rgn){ 173 | UnCropSizingSideResults(&(p_snap->h)); 174 | UnCropSizingSideResults(&(p_snap->v)); 175 | } 176 | } 177 | 178 | void UnCropSideResults(PCROP_INFO p_crop,SIDE_SNAP_RESULTS * p_ssnap){ 179 | enum SIDES side = p_ssnap->side; 180 | 181 | if (side != SIDE_NONE){ 182 | int offset = GetSideOfRect(side,&(p_crop->cropped_rect)) - 183 | GetSideOfRect(side,&(p_crop->uncropped_rect)); 184 | DBG_MSG_SIDE_VAL(g_hWnd_app,DBGMSG_ADJUST_HRGN,side,offset); 185 | p_ssnap->value -= offset; 186 | } 187 | } 188 | 189 | 190 | void Crop_UnCropMovingResults(PCROP_INFO p_crop,SNAP_RESULTS * p_snap){ 191 | if ((p_crop->cropping_top) || p_crop->has_rgn){ 192 | UnCropSideResults(p_crop,&(p_snap->h)); 193 | UnCropSideResults(p_crop,&(p_snap->v)); 194 | } 195 | } 196 | 197 | void CropToRgn( LPCRECT pRgnBox, LPRECT pRect){ 198 | int offsetLeft = pRgnBox->left; 199 | int offsetTop = pRgnBox->top; 200 | 201 | int width = pRect->right - pRect->left; 202 | int height= pRect->bottom - pRect->top; 203 | 204 | int offsetRight = width - pRgnBox->right; 205 | int offsetBottom = height - pRgnBox->bottom; 206 | 207 | //??? 208 | pRect->left += max(offsetLeft,0); 209 | pRect->top += max(offsetTop,0); 210 | 211 | pRect->right -= max(offsetRight,0); 212 | pRect->bottom -= max(offsetBottom,0); 213 | } 214 | 215 | BOOL IsSkinnedAppClass(HWND our_hWnd){ 216 | TCHAR pszClassName[MAX_CLASSNAME_LENGTH]; 217 | 218 | GetClassName(our_hWnd,pszClassName,MAX_CLASSNAME_LENGTH); 219 | 220 | return is_name_in_classlist(pszClassName,getSkinnedClasses()); 221 | /*for (i=0;i MAX_PATH ){ 151 | return 0; 152 | } 153 | wsprintf(INI_PATH,_T("%s\\%s"),workdir,INI_NAME); 154 | loaded_it = TRUE; 155 | return INI_PATH; 156 | } 157 | } 158 | 159 | BOOL LoadSettingsFromINI (void){ 160 | int temp = 0; 161 | DWORD dwSize=sizeof(DWORD); 162 | int reg_index = 0; 163 | BOOL fOK = FALSE; 164 | LPCTSTR inipath = get_ini_path(); 165 | 166 | if (!inipath){ 167 | return FALSE; 168 | } 169 | 170 | for (reg_index = 0; ini_items[reg_index].rt!=REGT_EMPTY; reg_index++){ 171 | temp = 0; 172 | switch(ini_items[reg_index].rt){ 173 | 174 | case REGT_BOOL: 175 | if (getInt(ini_items[reg_index].value_name,&temp,inipath)){ 176 | ((PF_SET_BOOL)(ini_items[reg_index].pfv_setter))((BOOL)temp); 177 | } 178 | break; 179 | 180 | case REGT_INT: 181 | if (getInt(ini_items[reg_index].value_name,&temp,inipath)){ 182 | ((PF_SET_INT)(ini_items[reg_index].pfv_setter))(temp); 183 | } 184 | break; 185 | 186 | case REGT_UINT: 187 | if (getInt(ini_items[reg_index].value_name,&temp,inipath)){ 188 | ((PF_SET_UINT)(ini_items[reg_index].pfv_setter))((UINT)temp); 189 | } 190 | break; 191 | 192 | case REGT_SZ: 193 | { 194 | TCHAR path_buffer[MAX_STRING_SIZE]; 195 | int ret_len = 0; 196 | 197 | if (INIgetStringVal(ini_items[reg_index].value_name,path_buffer,&ret_len,MAX_STRING_SIZE,inipath)){ 198 | (*(PF_SET_SZ)(ini_items[reg_index].pfv_setter))((LPCTSTR)path_buffer,ret_len); 199 | } 200 | } 201 | break; 202 | case REGT_MULTI: 203 | break; 204 | 205 | case REGT_EMPTY: 206 | default: 207 | goto LoadSettingsFromRegistry_END; 208 | } 209 | } 210 | fOK = TRUE; 211 | LoadSettingsFromRegistry_END: 212 | return TRUE; 213 | } 214 | 215 | 216 | BOOL SaveSettingsToINI (void){ 217 | int temp_int; 218 | BOOL fOK=FALSE; 219 | int reg_index = 0; 220 | 221 | LPCTSTR inipath = get_ini_path(); 222 | 223 | if (!inipath){ 224 | return FALSE; 225 | } 226 | 227 | while (ini_items[reg_index].rt!=REGT_EMPTY){ 228 | LPCTSTR val_name = ini_items[reg_index].value_name; 229 | PFV_GET pfvGet = ini_items[reg_index].pfv_getter; 230 | 231 | switch(ini_items[reg_index].rt){ 232 | case REGT_BOOL: 233 | temp_int = (int) ((PF_GET_BOOL)(pfvGet))(); 234 | goto SAVE_INT; 235 | case REGT_INT: 236 | temp_int = (int) ((PF_GET_INT)(pfvGet))(); 237 | goto SAVE_INT; 238 | case REGT_UINT: 239 | temp_int = (int) ((PF_GET_UINT)(pfvGet))(); 240 | SAVE_INT: 241 | if (!setInt(val_name,temp_int,inipath)){ 242 | goto SSTR_ERROR; 243 | } 244 | break; 245 | 246 | 247 | case REGT_MULTI: 248 | break; 249 | 250 | case REGT_SZ: 251 | if (!INIsetStringVal (val_name,((PF_GET_SZ)pfvGet)(),inipath)){ 252 | goto SSTR_ERROR; 253 | } 254 | break; 255 | 256 | 257 | 258 | case REGT_EMPTY: 259 | default: 260 | _RPT0(_CRT_ERROR,"bad regitem"); 261 | goto SSTR_ERROR; 262 | 263 | }//switch 264 | reg_index++; 265 | }//while 266 | 267 | fOK = TRUE; 268 | SSTR_ERROR: 269 | //RegCloseKey(myKey); 270 | return fOK; 271 | } -------------------------------------------------------------------------------- /snapit.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {c75057d0-b133-4890-aff1-e9e1b1a7c468} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | {950a1fa7-5565-45b5-ab92-bf443905559d} 10 | h;hpp;hxx;hm;inl 11 | 12 | 13 | {a3196f62-1bb2-496a-8d3b-5e65a68afe2d} 14 | ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | Source Files 41 | 42 | 43 | Source Files 44 | 45 | 46 | Source Files 47 | 48 | 49 | 50 | 51 | Header Files 52 | 53 | 54 | Header Files 55 | 56 | 57 | Header Files 58 | 59 | 60 | Header Files 61 | 62 | 63 | Header Files 64 | 65 | 66 | Header Files 67 | 68 | 69 | Header Files 70 | 71 | 72 | Header Files 73 | 74 | 75 | Header Files 76 | 77 | 78 | Header Files 79 | 80 | 81 | Header Files 82 | 83 | 84 | Header Files 85 | 86 | 87 | Header Files 88 | 89 | 90 | Header Files 91 | 92 | 93 | Header Files 94 | 95 | 96 | Header Files 97 | 98 | 99 | 100 | 101 | Header Files 102 | 103 | 104 | Resource Files 105 | 106 | 107 | Resource Files 108 | 109 | 110 | Resource Files 111 | 112 | 113 | Resource Files 114 | 115 | 116 | Resource Files 117 | 118 | 119 | Resource Files 120 | 121 | 122 | Resource Files 123 | 124 | 125 | Resource Files 126 | 127 | 128 | Resource Files 129 | 130 | 131 | Resource Files 132 | 133 | 134 | Resource Files 135 | 136 | 137 | Resource Files 138 | 139 | 140 | 141 | 142 | Resource Files 143 | 144 | 145 | Resource Files 146 | 147 | 148 | Resource Files 149 | 150 | 151 | Resource Files 152 | 153 | 154 | Resource Files 155 | 156 | 157 | Resource Files 158 | 159 | 160 | Resource Files 161 | 162 | 163 | Resource Files 164 | 165 | 166 | Resource Files 167 | 168 | 169 | Resource Files 170 | 171 | 172 | Resource Files 173 | 174 | 175 | Resource Files 176 | 177 | 178 | Resource Files 179 | 180 | 181 | Resource Files 182 | 183 | 184 | Resource Files 185 | 186 | 187 | Resource Files 188 | 189 | 190 | Resource Files 191 | 192 | 193 | Resource Files 194 | 195 | 196 | Resource Files 197 | 198 | 199 | Resource Files 200 | 201 | 202 | Resource Files 203 | 204 | 205 | Resource Files 206 | 207 | 208 | Resource Files 209 | 210 | 211 | Resource Files 212 | 213 | 214 | Resource Files 215 | 216 | 217 | Resource Files 218 | 219 | 220 | Resource Files 221 | 222 | 223 | Resource Files 224 | 225 | 226 | Resource Files 227 | 228 | 229 | Resource Files 230 | 231 | 232 | Resource Files 233 | 234 | 235 | Resource Files 236 | 237 | 238 | Resource Files 239 | 240 | 241 | Resource Files 242 | 243 | 244 | Resource Files 245 | 246 | 247 | 248 | 249 | Resource Files 250 | 251 | 252 | 253 | 254 | 255 | -------------------------------------------------------------------------------- /Snapper.c: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "sides.h" 3 | #include "snapper.h" 4 | #include "snap_lib_internal.h" 5 | #include "snap_testers.h" 6 | #include "snap_WinRects.h" 7 | #include "snap_MouseSpeed.h" 8 | #include "snap_TrackResults.h" 9 | #include "snap_Crop.h" 10 | #include "snap_CenterSize.h" 11 | #include "snap_EqualSize.h" 12 | #include "snap_mywm_msg.h" 13 | 14 | 15 | static int g_threshold=10; 16 | BOOL g_movingSnapped = FALSE; 17 | BOOL g_sizingSnapped = FALSE; 18 | BOOL g_justStarted = TRUE; 19 | 20 | 21 | 22 | static int g_fast_speed = 10; 23 | static int g_x_offset_at_snap = 0; 24 | static int g_y_offset_at_snap = 0; 25 | static RECT g_rect_at_snap={0,0,0,0}; 26 | static POINT g_cursor_at_snap={0,0}; 27 | 28 | 29 | //forward declarations 30 | 31 | void capture_state_at_snap (LPCRECT p_unsnapped); 32 | void calc_unsnapped_pos(LPCRECT pcurrent_rect, LPRECT pRect); 33 | void DoMovingOrSizing(HWND hWnd, WPARAM which_edge,LPRECT pRect,BOOL is_sizing); 34 | BOOL isToggled(void); 35 | void reposition(LPCRECT p_unsnapped, SNAP_RESULTS * p_snap, LPRECT pRect); 36 | void resize(SNAP_RESULTS * p_snap, LPRECT pRect); 37 | BOOL isMovingSnapped(void); 38 | void setMovingSnapped(BOOL snapped); 39 | 40 | 41 | void capture_state_at_snap (LPCRECT p_unsnapped) 42 | { 43 | POINT cursor_at_snap; 44 | GetCursorPos(&cursor_at_snap); 45 | 46 | g_cursor_at_snap = cursor_at_snap; 47 | g_x_offset_at_snap = p_unsnapped->left - cursor_at_snap.x; 48 | g_y_offset_at_snap = p_unsnapped->top - cursor_at_snap.y; 49 | } 50 | 51 | 52 | 53 | void calc_unsnapped_pos(LPCRECT pcurrent_rect,LPRECT pRect){ 54 | int nWidth; 55 | int nHeight; 56 | RECT temp_rect; 57 | POINT cursor_now; 58 | 59 | if (isMovingSnapped()){ 60 | //move the rect that we are going to test for 61 | //snap to where it would be if it wasn't snapped 62 | 63 | temp_rect = *pcurrent_rect; 64 | GetCursorPos(&cursor_now); 65 | 66 | nWidth = temp_rect.right - temp_rect.left; 67 | nHeight = temp_rect.bottom - temp_rect.top; 68 | 69 | temp_rect.top = cursor_now.y + g_y_offset_at_snap; 70 | temp_rect.left = cursor_now.x + g_x_offset_at_snap; 71 | temp_rect.bottom = cursor_now.y + g_y_offset_at_snap + nHeight; 72 | temp_rect.right = cursor_now.x + g_x_offset_at_snap + nWidth; 73 | 74 | *pRect = temp_rect; 75 | } 76 | else{ 77 | *pRect = *pcurrent_rect; 78 | } 79 | } 80 | 81 | INLINE BOOL isToggled(void){ 82 | //#ifdef ALLSNAP_TOGGLEMODE 83 | return ( (GetAsyncKeyState(getToggleKey())==0) == isDisableToggle()); 84 | //#else 85 | // return ( GetAsyncKeyState(getToggleKey())==0); 86 | //#endif 87 | } 88 | 89 | 90 | 91 | void snapper_OnMoving(HWND hWnd, LPRECT pRect) 92 | { 93 | TEST_RECTS test_rects; 94 | RECT unsnapped_position; 95 | SNAP_RESULTS snap_results; 96 | CROP_INFO crop_info; 97 | 98 | calc_unsnapped_pos(pRect,&unsnapped_position); 99 | 100 | if (isToggled()){ 101 | 102 | WinRects_getRects(& test_rects); 103 | 104 | Crop_LoadMovingCropInfo(&crop_info,hWnd,&unsnapped_position); 105 | 106 | moving_test_all( 107 | Crop_GetPCroppedRect(&crop_info), 108 | getWinThresh(), 109 | getScreenThresh(), 110 | &test_rects, 111 | &snap_results 112 | ); 113 | 114 | Crop_UnCropMovingResults(&crop_info,&snap_results); 115 | 116 | reposition(&unsnapped_position,&snap_results,pRect); 117 | } 118 | else{ 119 | DBG_MSG(g_hWnd_app,DBGMSG_MOVING_TOGGLEDOFF); 120 | clear_snap_results (&snap_results); 121 | reposition(&unsnapped_position,&snap_results,pRect); 122 | } 123 | 124 | MouseSpeed_Track(); 125 | TrackRslts_Track(&snap_results); 126 | 127 | //DBG_MSG(g_hWnd_app,DBGMSG_MOVING_END); 128 | } 129 | 130 | 131 | 132 | void snapper_OnSizing(HWND hWnd, WPARAM which_edge,LPRECT pRect){ 133 | TEST_RECTS test_rects; 134 | SNAP_RESULTS snap_results; 135 | BOOL was_center_sizing = isCentered(); 136 | BOOL was_equal_sizing = isEqualing(); 137 | 138 | 139 | MouseSpeed_Track(); 140 | 141 | if (isToggled()){ 142 | RECT cropped_rect; 143 | //RECT alt_sizing_pos; 144 | 145 | enum SIDE v_side = SIDE_NONE; 146 | enum SIZE h_side = SIDE_NONE; 147 | 148 | split_edge(which_edge,&v_side,&h_side); 149 | WinRects_getRects(& test_rects); 150 | 151 | Crop_CropSizingRect(pRect,v_side,h_side,&cropped_rect); 152 | 153 | 154 | if (was_equal_sizing){ 155 | EqualSize_Adjust(&cropped_rect,v_side,h_side); 156 | } 157 | if (was_center_sizing){ 158 | CenterSize_Adjust(&cropped_rect,v_side,h_side); 159 | } 160 | 161 | 162 | sizing_test_all( 163 | v_side, 164 | h_side, 165 | &cropped_rect, 166 | getWinThresh(), 167 | getScreenThresh(), 168 | &test_rects, 169 | &snap_results, 170 | was_center_sizing 171 | ); 172 | 173 | DBG_MSG_SR(g_hWnd_app,DBGMSG_BEFORE_CROP,snap_results); 174 | Crop_UnCropSizingResults(&snap_results); 175 | DBG_MSG_SR(g_hWnd_app,DBGMSG_AFTER_CROP,snap_results); 176 | 177 | resize(&snap_results,pRect); 178 | 179 | if (was_center_sizing || was_equal_sizing){ 180 | if(snap_results.h.side != SIDE_NONE){ 181 | h_side = snap_results.h.side; 182 | } 183 | if(snap_results.v.side != SIDE_NONE){ 184 | v_side = snap_results.v.side; 185 | } 186 | } 187 | if(was_center_sizing){ 188 | CenterSize_Adjust(pRect,v_side,h_side); 189 | } 190 | if(was_equal_sizing){ 191 | EqualSize_Adjust(pRect,v_side,h_side); 192 | } 193 | } 194 | else{ 195 | DBG_MSG(g_hWnd_app,DBGMSG_SIZING_TOGGLEDOFF); 196 | clear_snap_results (&snap_results); 197 | } 198 | 199 | MouseSpeed_Track(); 200 | TrackRslts_Track(&snap_results); 201 | //DBG_MSG(g_hWnd_app,DBGMSG_SIZING_END); 202 | } 203 | 204 | 205 | void reposition_side(LPCRECT p_unsnapped, SIDE_SNAP_RESULTS * p_ssnap, 206 | SIDE_SNAP_RESULTS * p_last_ssnap, LPRECT pRect){ 207 | 208 | enum SIDES side = p_ssnap->side; 209 | enum SIDES last_side = p_last_ssnap->side; 210 | 211 | if (side != SIDE_NONE){ 212 | AlignToSide(pRect,side,p_ssnap->value); 213 | DBG_MSG_SIDE_VAL(g_hWnd_app,DBGMSG_REPOS,p_ssnap->side,p_ssnap->value); 214 | } 215 | else if (last_side != SIDE_NONE) // unsnap 216 | { 217 | DBG_MSG_SIDE_VAL(g_hWnd_app,DBGMSG_UNSNAP_SIDE,last_side,GetSideOfRect(last_side, p_unsnapped)); 218 | AlignToSide( 219 | pRect, 220 | last_side, 221 | GetSideOfRect(last_side, p_unsnapped) 222 | ); 223 | 224 | } 225 | } 226 | 227 | 228 | 229 | void reposition(LPCRECT p_unsnapped, SNAP_RESULTS * p_snap, LPRECT pRect){ 230 | PSNAP_RESULTS p_last_snap = TrackRslts_GetLast(); 231 | 232 | if (NO_SNAP(*p_snap)){ 233 | 234 | if (isMovingSnapped()){ //if just unsnapped reset to unsnapped position 235 | setMovingSnapped(FALSE); 236 | *pRect = *p_unsnapped; 237 | 238 | DBG_MSG(g_hWnd_app,DBGMSG_UNSNAP); 239 | } 240 | } 241 | else{ // at least one side got snapped 242 | 243 | if(!isMovingSnapped()) 244 | { 245 | capture_state_at_snap(p_unsnapped); 246 | setMovingSnapped(TRUE); 247 | } 248 | 249 | reposition_side(p_unsnapped,&(p_snap->h),&(p_last_snap->h),pRect); 250 | reposition_side(p_unsnapped,&(p_snap->v),&(p_last_snap->v),pRect); 251 | } 252 | } 253 | 254 | 255 | void resize(SNAP_RESULTS * p_snap, LPRECT pRect){ 256 | 257 | if (p_snap->v.side != SIDE_NONE){ 258 | DBG_MSG_SIDE_VAL(g_hWnd_app,DBGMSG_RESIZE,p_snap->v.side,p_snap->v.value); 259 | SetSideOfRect((p_snap->v.side),(p_snap->v.value),pRect); 260 | } 261 | 262 | if (p_snap->h.side != SIDE_NONE){ 263 | DBG_MSG_SIDE_VAL(g_hWnd_app,DBGMSG_RESIZE,p_snap->h.side,p_snap->h.value); 264 | SetSideOfRect((p_snap->h.side),(p_snap->h.value),pRect); 265 | } 266 | } 267 | 268 | BOOL isMovingSnapped(void){ 269 | return g_movingSnapped; 270 | } 271 | 272 | void setMovingSnapped(BOOL snapped){ 273 | g_movingSnapped=snapped; 274 | } 275 | 276 | 277 | void snapper_OnEnterSizeMove(HWND hWnd){ 278 | 279 | WinRects_Refresh(getSnapType(),hWnd); 280 | setMovingSnapped(FALSE); 281 | 282 | Crop_LoadSizingInfo(hWnd); 283 | CenterSize_Init(hWnd); 284 | EqualSize_Init(hWnd); 285 | 286 | MouseSpeed_Reset(); 287 | TrackRslts_Reset(); 288 | } 289 | /* 290 | void snapper_OnWindowPosChanging(HWND hWnd, LPWINDOWPOS pWindowPos){ 291 | if (! (pWindowPos->flags & SWP_NOMOVE)){ 292 | RECT rc; 293 | 294 | int width = rc.right - rc.left; 295 | int height = rc.bottom - rc.top; 296 | 297 | rc.left = pWindowPos->x; 298 | rc.right = pWindowPos->x + width; 299 | 300 | rc.top = pWindowPos->y; 301 | rc.bottom = pWindowPos->y + height; 302 | 303 | GetWindowRect(hWnd,&rc); //does this have the current position? 304 | snapper_OnMoving(hWnd,&rc); 305 | 306 | pWindowPos->x = rc.left; 307 | pWindowPos->y = rc.top; 308 | } 309 | else if ( ! ( (pWindowPos->flags) & SWP_NOSIZE)){ 310 | RECT rc; 311 | WPARAM allEdges = (WMSZ_TOPRIGHT | WMSZ_BOTTOMLEFT); 312 | GetWindowRect(hWnd,&rc); 313 | snapper_OnSizing(hWnd,allEdges,&rc); 314 | 315 | pWindowPos->cx = rc.right - rc.left; 316 | pWindowPos->cy = rc.bottom - rc.top; 317 | } 318 | }*/ 319 | -------------------------------------------------------------------------------- /CmnHdr.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | Module name: CmnHdr.h 3 | Written by: Jeffrey Richter 4 | Notices: Copyright (c) 1995-1998 Jeffrey Richter 5 | Purpose: Common header file containing handy macros and definitions used 6 | throughout all the applications in the book. 7 | ******************************************************************************/ 8 | 9 | 10 | /* Disable ridiculous warnings so that the code */ 11 | /* compiles cleanly using warning level 4. */ 12 | 13 | /* nonstandard extension 'single line comment' was used */ 14 | #pragma warning(disable: 4001) 15 | 16 | // nonstandard extension used : nameless struct/union 17 | #pragma warning(disable: 4201) 18 | 19 | // unreferenced inline function has been removed 20 | #pragma warning(disable: 4514) 21 | 22 | // unreferenced formal parameter 23 | #pragma warning(disable: 4100) 24 | 25 | // nonstandard extension used : bit field types other than int 26 | #pragma warning(disable: 4214) 27 | 28 | // Note: Creating precompiled header 29 | #pragma warning(disable: 4699) 30 | 31 | // indirection to slightly different base types 32 | #pragma warning(disable: 4057) 33 | 34 | // named type definition in parentheses 35 | #pragma warning(disable: 4115) 36 | 37 | // nonstandard extension used : benign typedef redefinition 38 | #pragma warning(disable: 4209) 39 | 40 | // 'function' : function not expanded 41 | #pragma warning(disable: 4710) 42 | 43 | 44 | //////////////////////// Windows Version Build Option ///////////////////////// 45 | 46 | 47 | //#define _WIN32_WINNT 0x0400 48 | 49 | 50 | ///////////////////////////// STRICT Build Option ///////////////////////////// 51 | 52 | 53 | // Force all EXEs/DLLs to use STRICT type checking. 54 | #define STRICT 55 | 56 | 57 | /////////////////////////// CPU Portability Macros //////////////////////////// 58 | 59 | 60 | // If no CPU platform was specified, default to the current platform. 61 | #if !defined(_ALPHA_) && !defined(_X86_) 62 | #if defined(_M_IX86) 63 | #define _X86_ 64 | #endif 65 | #if defined(_M_ALPHA) 66 | #define _ALPHA_ 67 | #endif 68 | #endif 69 | 70 | 71 | //////////////////////////// Unicode Build Option ///////////////////////////// 72 | 73 | 74 | // If we are not compiling for an x86 CPU, we always compile using Unicode. 75 | //#ifndef _X86_ 76 | //#define UNICODE 77 | //#endif 78 | 79 | 80 | // To compile using Unicode on the x86 CPU, uncomment the line below. 81 | //#define UNICODE 82 | 83 | // When using Unicode Win32 functions, use Unicode C-Runtime functions too. 84 | #ifdef UNICODE 85 | #ifndef _UNICODE 86 | #define _UNICODE 87 | #endif 88 | #endif 89 | 90 | 91 | ////////////////////////////// chINRANGE Macro //////////////////////////////// 92 | 93 | 94 | // This macro returns TRUE if a number is between two others 95 | #define chINRANGE(low, Num, High) (((low) <= (Num)) && ((Num) <= (High))) 96 | 97 | 98 | //////////////////////////////// chDIMOF Macro //////////////////////////////// 99 | 100 | 101 | // This macro evaluates to the number of elements in an array. 102 | #define chDIMOF(Array) (sizeof(Array) / sizeof(Array[0])) 103 | 104 | 105 | ///////////////////////////// chBEGINTHREADEX Macro /////////////////////////// 106 | 107 | 108 | // Create a chBEGINTHREADEX macro that calls the C run-time's 109 | // _beginthreadex function. The C run-time library doesn't 110 | // want to have any reliance on Win32 data types such as 111 | // HANDLE. This means that a Win32 programmer needs to cast 112 | // the return value to a HANDLE. This is terribly inconvenient, 113 | // so I have created this macro to perform the casting. 114 | typedef unsigned (__stdcall *PTHREAD_START) (void *); 115 | 116 | #define chBEGINTHREADEX(lpsa, cbStack, lpStartAddr,lpvThreadParm, fdwCreate, lpIDThread) ((HANDLE)_beginthreadex((void *) (lpsa),(unsigned) (cbStack),(PTHREAD_START) (lpStartAddr), (void *) (lpvThreadParm), (unsigned) (fdwCreate),(unsigned *) (lpIDThread))) 117 | 118 | 119 | //////////////////////////// Assert/Verify Macros ///////////////////////////// 120 | 121 | 122 | #define chFAIL(szMSG) { \ 123 | MessageBox(GetActiveWindow(), szMSG, \ 124 | __TEXT("Assertion Failed"), MB_OK | MB_ICONERROR); \ 125 | DebugBreak(); \ 126 | } 127 | 128 | // Put up an assertion failure message box. 129 | #define chASSERTFAIL(file,line,expr) { \ 130 | TCHAR sz[128]; \ 131 | wsprintf(sz, __TEXT("File %hs, line %d : %hs"), file, line, expr); \ 132 | chFAIL(sz); \ 133 | } 134 | 135 | // Put up a message box if an assertion fails in a debug build. 136 | #ifdef _DEBUG 137 | #define chASSERT(x) if (!(x)) chASSERTFAIL(__FILE__, __LINE__, #x) 138 | #else 139 | #define chASSERT(x) 140 | #endif 141 | 142 | // Assert in debug builds, but don't remove the code in retail builds. 143 | #ifdef _DEBUG 144 | #define chVERIFY(x) chASSERT(x) 145 | #else 146 | #define chVERIFY(x) (x) 147 | #endif 148 | 149 | 150 | /////////////////////////// chHANDLE_DLGMSG Macro ///////////////////////////// 151 | 152 | 153 | // The normal HANDLE_MSG macro in WINDOWSX.H does not work properly for dialog 154 | // boxes because a DlgProc returns a BOOL instead of an LRESULT (like 155 | // WndProcs). This chHANDLE_DLGMSG macro corrects the problem: 156 | #define chHANDLE_DLGMSG(hwnd, message, fn) \ 157 | case (message): return (SetDlgMsgResult(hwnd, uMsg, \ 158 | HANDLE_##message((hwnd), (wParam), (lParam), (fn)))) 159 | 160 | 161 | /////////////////////////// Quick MessageBox Macro //////////////////////////// 162 | 163 | 164 | #define chMB(s) { \ 165 | TCHAR szTMP[128]; \ 166 | GetModuleFileName(NULL, szTMP, chDIMOF(szTMP)); \ 167 | MessageBox(GetActiveWindow(), s, szTMP, MB_OK); \ 168 | } 169 | 170 | 171 | ///////////////////////////// Zero Variable Macro ///////////////////////////// 172 | 173 | 174 | // Zero out a structure. If fInitSize is TRUE, initialize 175 | // the first int to the size of the structure. Many structures 176 | // like WNDCLASSEX and STARTUPINFO require that their first 177 | // member be set to the size of the structure itself. 178 | #define chINITSTRUCT(structure, fInitSize) \ 179 | (ZeroMemory(&(structure), sizeof(structure)), \ 180 | fInitSize ? (*(int*) &(structure) = sizeof(structure)) : 0) 181 | 182 | 183 | //////////////////////// Dialog Box Icon Setting Macro //////////////////////// 184 | 185 | 186 | // Associates an icon with a window. 187 | #define chSETDLGICONS(hwnd, idiLarge, idiSmall) \ 188 | { \ 189 | SendMessage(hwnd, WM_SETICON, TRUE, (LPARAM) \ 190 | LoadIcon(GetWindowInstance(hwnd), MAKEINTRESOURCE(idiLarge))); \ 191 | SendMessage(hwnd, WM_SETICON, FALSE, (LPARAM) \ 192 | LoadIcon(GetWindowInstance(hwnd), MAKEINTRESOURCE(idiSmall))); \ 193 | } 194 | 195 | 196 | ///////////////////////////// UNICODE Check Macro ///////////////////////////// 197 | 198 | 199 | #ifdef UNICODE 200 | 201 | #define chWARNIFUNICODEUNDERWIN95() \ 202 | if (GetWindowsDirectoryW(NULL, 0) <= 0) \ 203 | MessageBoxA(NULL, "This operating system doesn't support Unicode.", \ 204 | NULL, MB_OK) 205 | 206 | #else 207 | 208 | #define chWARNIFUNICODEUNDERWIN95() 209 | 210 | #endif 211 | 212 | 213 | ///////////////////////// Pragma message helper macro ///////////////////////// 214 | 215 | 216 | /* 217 | When the compiler sees a line like this: 218 | #pragma chMSG(Fix this later) 219 | 220 | it outputs a line like this: 221 | C:\Document\AdvWin\Code\Sysinfo.06\..\CmnHdr.H(296):Fix this later 222 | 223 | You can easily jump directly to this line and examine the surrounding code. 224 | */ 225 | #define chSTR(x) #x 226 | #define chSTR2(x) chSTR(x) 227 | #define chMSG(desc) message(__FILE__ "(" chSTR2(__LINE__) "):" #desc) 228 | 229 | 230 | //////////////////////////// Message Cracker Macros /////////////////////////// 231 | // WindowsX.H doesn't have these message cracker macros 232 | 233 | 234 | /* BOOL Cls_OnCopyData(HWND hwnd, HWND hwndFrom, PCOPYDATASTRUCT pcds) */ 235 | #define HANDLE_WM_COPYDATA(hwnd, wParam, lParam, fn) \ 236 | ((fn)((hwnd), (HWND)(wParam), \ 237 | (PCOPYDATASTRUCT)lParam), 0L) 238 | #define FORWARD_WM_COPYDATA(hwnd, hwndFrom, pcds, fn) \ 239 | (BOOL)(UINT)(DWORD)(fn)((hwnd), WM_COPYDATA, \ 240 | (WPARAM)(hwndFrom), (LPARAM)(pcds)) 241 | 242 | 243 | /* void Cls_OnHotKey(HWND hwnd, int idHotKey, UINT fuModifiers, UINT vk) */ 244 | #define HANDLE_WM_HOTKEY(hwnd, wParam, lParam, fn) \ 245 | ((fn)((hwnd), (int)(wParam), (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)), 0L) 246 | #define FORWARD_WM_HOTKEY(hwnd, idHotKey, fuModifiers, vk, fn) \ 247 | (void)(fn)((hwnd), WM_HOTKEY, (WPARAM)(idHotKey), MAKELPARAM((fuModifiers), (vk))) 248 | 249 | 250 | // WindowsX.H defines HANDLE_WM_NCCALCSIZE incorrectly 251 | /* 252 | #undef HANDLE_WM_NCCALCSIZE 253 | #define HANDLE_WM_NCCALCSIZE(hwnd, wParam, lParam, fn) \ 254 | (LRESULT)(DWORD)(UINT)(fn)((hwnd), (BOOL)(wParam), (NCCALCSIZE_PARAMS *)(lParam)) 255 | */ 256 | 257 | ///////////////////////////////// End of File ///////////////////////////////// 258 | 259 | -------------------------------------------------------------------------------- /resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by snapit.rc 4 | // 5 | #define IDAPPLY 2 6 | #define IDC_CLEAR 3 7 | #define IDC_APPLY 4 8 | #define IDC_SAVE 4 9 | #define IDS_APP_TITLE 103 10 | #define IDM_ABOUT 104 11 | #define IDC_MYHAND 104 12 | #define IDS_THRESHOLD_ERROR 104 13 | #define IDM_EXIT 105 14 | #define IDS_SELF 105 15 | #define IDS_HELLO 106 16 | #define IDS_OTHERS 106 17 | #define IDS_DESKTOP 107 18 | #define IDS_VCENTER 108 19 | #define IDI_SNAPIT 109 20 | #define IDS_STRING109 109 21 | #define IDS_HCENTER 109 22 | #define IDT_MYTRAY 110 23 | #define IDS_ENABLED 110 24 | #define IDS_PLAYSOUNDS 111 25 | #define IDS_UNSNAP_FILE 112 26 | #define IDS_BROWSE_UNSNAP 113 27 | #define IDS_SNAP_FILE 114 28 | #define IDS_BROWSE_SNAP 115 29 | #define IDS_TOGGLEKEYS 116 30 | #define IDS_SCREEN_THRESH 117 31 | #define IDS_WIN_THRESH 118 32 | #define IDS_SNAPTOL 119 33 | #define IDS_GENERALL 120 34 | #define IDS_SOUNDS 121 35 | #define IDS_SNAPMDI 122 36 | #define IDS_QUIETFAST 123 37 | #define IDS_INSIDES 124 38 | #define IDS_INVTOGGLE 125 39 | #define IDS_ADVL 126 40 | #define IDS_PLAY 127 41 | #define IDS_CROPTOP 128 42 | #define IDC_SNAPIT 129 43 | #define IDS_HIDEICON 130 44 | #define IDS_KEPT 131 45 | #define IDS_CENTERED 132 46 | #define IDS_STRING132 132 47 | #define IDR_SYSMENU 133 48 | #define IDS_CROP_RGN 133 49 | #define IDS_AUTOLINEUP 134 50 | #define IDS_CHECK_HORIZONTAL 135 51 | #define IDI_DISABLED 136 52 | #define IDS_CHECK_VERTICAL 136 53 | #define IDD_ABOUT 137 54 | #define IDS_H_NUM_EVEN 137 55 | #define IDS_H_PIXELS_BTWN 138 56 | #define IDI_SPEAKER 143 57 | #define IDI_SNAP_TOS 144 58 | #define IDD_GENERAL 168 59 | #define IDD_SOUNDS 169 60 | #define IDI_ENABLED 170 61 | #define IDI_ARROWSLOGO 178 62 | #define IDR_WHAT 200 63 | #define IDM_WHAT 201 64 | #define IDR_WHAT3 201 65 | #define IDB_PAYPAL 204 66 | #define IDI_PLAY 208 67 | #define IDI_STOP 209 68 | #define IDD_ADVANCED 211 69 | #define IDI_XPDISABLED 215 70 | #define IDI_ICON1 217 71 | #define IDI_XPENABLED 217 72 | #define IDM_DEBUG 218 73 | #define IDI_XPENABLED1 218 74 | #define IDD_DEBUG 219 75 | #define ID_NOTIFY_ADD 220 76 | #define IDD_GRID 220 77 | #define ID_ADD_ALARMMESSAGE 221 78 | #define ID_ADD_BEACONMESSAGE 222 79 | #define ID_ADDMESSAGE_TELEMETRYMESSAGE 223 80 | #define ID_ADDMESSAGE_TRACKING 224 81 | #define ID_Menu 225 82 | #define ID_NOTIFY_CUT 226 83 | #define ID_NOTIFY_COPY 227 84 | #define IDR_MENU1 228 85 | #define IDR_COPY 228 86 | #define IDI_ICON2 231 87 | #define IDS_DEBUG_MSG 500 88 | #define IDS_STRING501 501 89 | #define IDS_STRING502 502 90 | #define IDS_STRING503 503 91 | #define IDS_STRING504 504 92 | #define IDS_STRING505 505 93 | #define IDS_STRING506 506 94 | #define IDS_STRING507 507 95 | #define IDS_STRING508 508 96 | #define IDS_STRING509 509 97 | #define IDS_STRING134 510 98 | #define IDS_STRING511 511 99 | #define IDS_STRING512 512 100 | #define IDS_STRING513 513 101 | #define IDS_STRING514 514 102 | #define IDS_STRING515 515 103 | #define IDS_STRING520 516 104 | #define IDS_STRING521 517 105 | #define IDS_STRING530 518 106 | #define IDS_STRING531 519 107 | #define IDS_STRING532 520 108 | #define IDS_STRING533 521 109 | #define IDS_STRING133 522 110 | #define IDS_STRING517 523 111 | #define IDS_STRING518 524 112 | #define IDS_STRING519 525 113 | #define IDS_STRING522 526 114 | #define IDS_STRING523 527 115 | #define IDS_STRING524 528 116 | #define IDS_STRING525 529 117 | #define IDS_STRING526 530 118 | #define IDS_STRING527 531 119 | #define IDS_STRING528 532 120 | #define IDS_STRING529 533 121 | #define IDS_STRING135 534 122 | #define IDS_STRING535 535 123 | #define IDS_STRING136 536 124 | #define IDC_THRESH 1001 125 | #define IDC_WIN_THRESH 1001 126 | #define IDC_SCREEN_THRESH 1002 127 | #define IDC_DESKTOP 1013 128 | #define IDC_SELF 1014 129 | #define IDC_OTHERS 1015 130 | #define IDC_ENABLED 1016 131 | #define IDC_HCENTER 1017 132 | #define IDC_VCENTER 1018 133 | #define IDC_HCENTER2 1019 134 | #define IDC_CENTERED 1019 135 | #define IDC_PLAYSOUNDS 1026 136 | #define IDC_UNSNAP_FILE 1029 137 | #define IDC_BROWSE_UNSNAP 1030 138 | #define IDC_SNAP_FILE 1031 139 | #define IDC_BROWSE_SNAP 1032 140 | #define IDC_TOGGLEKEYS 1039 141 | #define IDC_LINK 1041 142 | #define IDC_THRESH_SPIN 1047 143 | #define IDC_WIN_THRESH_SPIN 1047 144 | #define IDC_SCREEN_THRESH_SPIN 1048 145 | #define IDC_SNAPATL 1049 146 | #define IDC_PIXELSL 1050 147 | #define IDC_TOGGLEKEYL 1051 148 | #define IDC_GENERALL 1052 149 | #define IDC_SNAPATL2 1053 150 | #define IDC_SNAPFILEL 1054 151 | #define IDC_UNSNAPFILEL 1055 152 | #define IDC_CHOSEL 1056 153 | #define IDC_SOUNDSL 1057 154 | #define IDC_PAYPAL 1062 155 | #define IDC_EMAIL 1063 156 | #define IDC_PIXELSL2 1064 157 | #define IDC_SNAPMDI 1069 158 | #define IDC_TESTSNAPSOUND 1070 159 | #define IDC_TESTSNAPSOUND2 1070 160 | #define IDC_TESTUNSNAPSOUND 1071 161 | #define IDC_QUIETFAST 1072 162 | #define IDC_INSIDES 1074 163 | #define IDC_INVTOGGLE 1075 164 | #define IDC_ADVL 1076 165 | #define IDC_CROPTOP 1077 166 | #define IDC_CROPTOPL 1078 167 | #define IDC_CROPTOP2L 1079 168 | #define IDC_HIDEICON 1080 169 | #define IDC_CROPTOPC 1081 170 | #define IDC_KEPT 1083 171 | #define IDC_MSGLIST 1084 172 | #define IDC_CROP_RGN 1085 173 | #define IDC_AUTOLINEUP 1088 174 | #define IDC_CHECK_HORIZONTAL 1089 175 | #define IDC_CHECK_VERTICAL 1090 176 | #define IDC_RADIO_H_EVEN 1091 177 | #define IDC_RADIO_H_PIXELS 1092 178 | #define IDC_RADIO_H_SINGLE 1093 179 | #define IDC_RADIO_V_EVEN 1094 180 | #define IDC_RADIO_V_PIXELS 1095 181 | #define IDC_RADIO_V_SINGLE 1096 182 | #define IDC_H_NUM_EVEN 1097 183 | #define IDC_H_PIXELS_BTWN 1099 184 | #define IDC_PLAY_SNAP 1099 185 | #define IDC_H_PIXELS_FROM_TOP 1100 186 | #define IDC_PLAY_UNSNAP 1100 187 | #define IDC_V_NUM_EVEN 1101 188 | #define IDC_CHECK2 1101 189 | #define IDC_V_PIXELS_BTWN 1102 190 | #define IDC_V_PIXELS_FROM_LEFT 1103 191 | #define IDM_SETTINGS 32772 192 | #define Enabled 32773 193 | #define IDS_ENABLED_TIP 32774 194 | #define IDS_DISABLED_TIP 32775 195 | #define ID_ENABLEWINDOWSNAPPING 32776 196 | #define IDM_COPY 32785 197 | #define ID_NOTHIN_COPY 32787 198 | #define IDC_STATIC -1 199 | 200 | // Next default values for new objects 201 | // 202 | #ifdef APSTUDIO_INVOKED 203 | #ifndef APSTUDIO_READONLY_SYMBOLS 204 | #define _APS_NO_MFC 1 205 | #define _APS_3D_CONTROLS 1 206 | #define _APS_NEXT_RESOURCE_VALUE 232 207 | #define _APS_NEXT_COMMAND_VALUE 32788 208 | #define _APS_NEXT_CONTROL_VALUE 1102 209 | #define _APS_NEXT_SYMED_VALUE 111 210 | #endif 211 | #endif 212 | --------------------------------------------------------------------------------