Skip to content

Commit

Permalink
- Fixed closes due to whatsapp sending WM_NCDESTROY even if its not c…
Browse files Browse the repository at this point in the history
…ompletle closing.

- Addes Inno script-studio file to generate a setup.
- Removed unused files.
  • Loading branch information
Dakoon committed Oct 15, 2017
1 parent 80c26b0 commit b4e7372
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 155 deletions.
10 changes: 7 additions & 3 deletions WhatsappTray/Hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,13 @@ LRESULT CALLBACK CallWndRetProc(int nCode, WPARAM wParam, LPARAM lParam)
// Deshalb denk ich es ist ok wenn ich hier den namen nicht prüfe.
// NOTE: Ich mach es deshalb nicht weil das Fenster zu den zeitpunkt nicht auffindbar ist, was warscheinlich daran liegt das es bereits geschlossen wurde.

bool successfulSent = PostMessage(FindWindow(NAME, NAME), WM_WHAHTSAPP_CLOSING, 0, (LPARAM)msg->hwnd);
if (successfulSent) {
OutputDebugString(MODULE_NAME L"WM_WHAHTSAPP_CLOSING successful sent.");
// Ich machs jetz so dass ich wenn ich das Whatsapp-Fenster nicht finde auch schließe, wegen den oben genannten gruenden.
if (msg->hwnd == FindWindow(NULL, WHATSAPP_CLIENT_NAME) || FindWindow(NULL, WHATSAPP_CLIENT_NAME) == NULL)
{
bool successfulSent = PostMessage(FindWindow(NAME, NAME), WM_WHAHTSAPP_CLOSING, 0, (LPARAM)msg->hwnd);
if (successfulSent) {
OutputDebugString(MODULE_NAME L"WM_WHAHTSAPP_CLOSING successful sent.");
}
}
}

Expand Down
Binary file removed WhatsappTray/RCa09256
Binary file not shown.
Binary file removed WhatsappTray/RCb09256
Binary file not shown.
145 changes: 0 additions & 145 deletions WhatsappTray/WhatsappTray - Kopie.rc

This file was deleted.

3 changes: 2 additions & 1 deletion WhatsappTray/WhatsappTray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ LRESULT CALLBACK HookWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
setHook();
break;
case WM_ADDTRAY:
OutputDebugString(MODULE_NAME L"WM_ADDTRAY\n");
MinimizeWindowToTray((HWND)lParam);
break;
case WM_REMTRAY:
Expand All @@ -310,7 +311,7 @@ LRESULT CALLBACK HookWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)

case WM_WHAHTSAPP_CLOSING:
// If Whatsapp is closing we want to close WhatsappTray as well.
//OutputDebugString(MODULE_NAME L"WM_WHAHTSAPP_CLOSING\n");
OutputDebugString(MODULE_NAME L"WM_WHAHTSAPP_CLOSING\n");
DestroyWindow(_hwndWhatsappTray);
break;
case WM_DESTROY:
Expand Down
12 changes: 6 additions & 6 deletions WhatsappTray/WhatsappTray.rc
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ CAPTION "About WhatsappTray"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,75,159,50,14
ICON IDI_WHATSAPPTRAY,IDC_STATIC,7,7,21,20
LTEXT "WhatsappTray 1.3\r\nFreeware\r\n\r\nThis program is distributed under the terms of the GNU General Public License.\r\n\r\nCopyright � 1998-2017",IDC_STATIC,34,7,151,58
ICON IDI_WHATSAPPTRAY,IDC_STATIC,7,7,20,20
LTEXT "WhatsappTray 1.3.1\r\nFreeware\r\n\r\nThis program is distributed under the terms of the GNU General Public License.\r\n\r\nCopyright � 1998-2017",IDC_STATIC,34,7,151,58
LTEXT "Sebastian Amann\r\nhttps://github.com/D4koon",IDC_STATIC,34,69,151,25
LTEXT "Nikolay Redko\r\nhttp://rbtray.sourceforge.net/\r\n\r\nJ.D. Purcell\r\nhttp://www.moitah.net/",IDC_STATIC,34,93,151,42
END
Expand Down Expand Up @@ -99,8 +99,8 @@ IDI_WHATSAPPTRAY ICON "WhatsappTray.ico"
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,3,0,0
PRODUCTVERSION 1,3,0,0
FILEVERSION 1,3,1,0
PRODUCTVERSION 1,3,1,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -116,12 +116,12 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "WhatsappTray"
VALUE "FileVersion", "1.3.0.0"
VALUE "FileVersion", "1.3.1.0"
VALUE "InternalName", "WhatsappTray"
VALUE "LegalCopyright", "Copyright � 1998-2016 Sebastian Amann, Nikolay Redko, J.D. Purcell"
VALUE "OriginalFilename", "WhatsappTray.exe"
VALUE "ProductName", "WhatsappTray"
VALUE "ProductVersion", "1.3.0.0"
VALUE "ProductVersion", "1.3.1.0"
END
END
BLOCK "VarFileInfo"
Expand Down
44 changes: 44 additions & 0 deletions setupBuildfile.iss
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
; Script generated by the Inno Script Studio Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "WhatsappTray"
#define MyAppVersion "1.3.1"
#define MyAppURL "https://github.com/D4koon/WhatsappTray"
#define MyAppExeName "WhatsappTray.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{1237D679-445B-4101-B7EC-B5081C5FA4A3}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputBaseFilename=WhatsappTrayV1.3.1
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "WhatsappTray\x64\Release\WhatsappTray.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "WhatsappTray\x64\Release\Hook.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "README.md"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

0 comments on commit b4e7372

Please sign in to comment.