help-emacs-windows
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[h-e-w] EmacsW32 behavior on Windows 7


From: Ben Straub
Subject: [h-e-w] EmacsW32 behavior on Windows 7
Date: Thu, 22 Apr 2010 14:24:30 -0700

A while back, core Emacs added the ability for emacsclient.exe and
emacs.exe to "stack" on the Windows 7 taskbar by manually setting the
application ID. The commit for this in the bzr tree was on June 30,
2009 (revision 96309; http://bzr.savannah.gnu.org/lh/emacs/ is down
right now, or I'd link to the commit).

The latest EmacsW32 (built from cvs as of 11/3/2009), which I much
prefer because of the behavior of emacsclient, does not do this, so
there are two icons on my taskbar. Without access to the EmacsW32
patch sources, I can't tell why, but I can tell with the following
program that the AppUserModelID isn't being set for emacs's main
window (not sure how to tell for the process, but I halfway assume it
would cascade to all the windows).

Is there anything I can do to assist with this?

-- Ben




// compile with cl filename.cpp /link shlwapi.lib ole32.lib shell32.lib
#include <windows.h>
#include <shobjidl.h>
#include <propkey.h>
#include <propvarutil.h>
#include <shellapi.h>

#include <iostream>

using namespace std;


int main( int argc, char* argv[] )
{
        if (argc <= 1)
        {
                cout << "Usage: " << argv[0] << " <hwnd>" << endl;
                return 1;
        }

        HWND hwnd;
        sscanf(argv[1], "%x", &hwnd);
        cout << "Checking APP id for " << hwnd << ": ";

        IPropertyStore *pps;
        HRESULT hr = SHGetPropertyStoreForWindow(hwnd, IID_PPV_ARGS(&pps));
        if (SUCCEEDED(hr))
        {
                PROPVARIANT pv;
                PropVariantInit(&pv);
                hr = pps->GetValue(PKEY_AppUserModel_ID, &pv);

                switch (pv.vt)
                {
                        case VT_EMPTY:
                                cout << "Empty";
                                break;

                        case VT_BSTR:
                                cout << pv.bstrVal;
                                break;

                        case VT_LPWSTR:
                                wcout <<  pv.pwszVal;
                                break;

                        default:
                                cout << "Unknown vartype: " << pv.vt;
                                break;
                }
                cout << endl;

                PropVariantClear(&pv);
                pps->Release();
        }
}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]