博客

i780长按快捷方式解决办法及源码

i780长按开始,OK及GPS的快捷方式是指定启动程序文件的而不是跟相机及短信那样,可以在按键中进行设置,长期以来,大家都只能让这几个按键映射到默认的几个程序上。三星的任务管理器虽然不咋的,但一直以来没有用其他的任务管理器,用着还行,所以,一直没有去解决这几个键的快捷方式问题。最近有机油提出来想可以自定义,看到雨夜的ROM也解决了这个问题,所以,就下来解开看了一下。解决方案很巧妙:

首先,把默认映射的几个程序重命名。
再创建一个程序替换上去。比如长换开始的程序对应的是Launcher.exe。
替换上去的程序也很简单,只需要从注册表中读相应的键的值,然后调用就可以了。

自己动手写了个程序,C++的,运行速度飞快,完全可以忽略这个中间程序的延迟,当然,雨夜ROM中的应该也是一样的,不过,我没有试过。下面是代码:

// HotkeyRelay.cpp : Defines the entry point for the console application.
//
#include <windows.h>
#include <malloc.h>
#include "stdafx.h"
#define MAX_LENGTH      256
int _tmain(int argc, _TCHAR* argv[])
{
    HKEY                hkey;
    DWORD               dwRet;
    DWORD               dwDisposition;
    DWORD               dwType;
    DWORD               dwSize;
    LPTSTR              m_szApplication = (LPTSTR)malloc( MAX_LENGTH );
    SHELLEXECUTEINFO    shExecInfo = {0};
    dwRet = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
                            TEXT("Software\\Microsoft\\Shell\\Keys\\40C7"),
                            0,
                            NULL,
                            0,
                            0,
                            NULL,
                            &hkey,
                            &dwDisposition );
    if(dwRet == ERROR_SUCCESS)
    {
        dwType = REG_SZ;
        dwSize = MAX_LENGTH - 1;
        // Query registry value.
        //
        dwRet = RegQueryValueEx( hkey,
                                 TEXT(""),
                                 NULL,
                                 &dwType,
                                 (PBYTE)m_szApplication,
                                 &dwSize );
        if(dwRet == ERROR_SUCCESS)
        {
            shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
            shExecInfo.fMask = SEE_MASK_FLAG_NO_UI;
            shExecInfo.hwnd = NULL;
            shExecInfo.lpVerb = _T("open");
            shExecInfo.lpFile = m_szApplication;
            shExecInfo.lpParameters = _T("");
            shExecInfo.lpDirectory = _T("");
            shExecInfo.nShow = SW_SHOW;
            shExecInfo.hInstApp = GetModuleHandle(NULL);
            // Startup the application.
            //
            ShellExecuteEx(&shExecInfo);
        }
        RegCloseKey(hkey);
    }
    return 0;
}
发表评论
CAPTCHA
最新评论
  • Swanceacidway 说:

    http://es5.com - http://www.Blackhatworld.com/blackhat-seo/images/avatars/vba5433.gif Hello.. Can you help me? http://www.verifiedfile.com - http://verifiedfile.com/images/smile.gif I was really inquisitive to learn if Black Hat SEO Methods improve Bing & Google.com ratings? A acquaintance found becoming a member of a Blackhat and Whitehat SEO Tools portal Over the past week, we are trying to study gain web traffic. Has anybody gain SEO rankings using http://www.es5.com - Black Hat SEO Forum. Just curious to know...

  • CHirqui 说:

    I am new here and I was wondering if you could tell me why my account keeps logging out? Is this normal?

  • Panama 说:

    Hello Im PM'ing you in the hope that you visit my video http://www.youtube.com/watch?v=iS7I1cBi4Kk, as I was told you would be able to help me with it.

  • skyli120 说:

    老大的电脑还没修好吗?

  • skyli120 说:

    唉,看来真是悲剧了。。。希望只是小问题。

  • 分类
    1. CHome Visual Editor
      CHome Visual Editor更新记录
    2. 手机相关
      i780ROM发布,手机应用及相关信息
    3. 未分类