您的位置:首页 > 其它

在程序中暂时禁止右键菜单函数

2007-08-08 00:52 218 查看

    BYTE            bytSave [ 2 ];






    /**///////////////////////////////////////////////////////////////////////////


    //禁止右键菜单


    HMODULE hModule;


    FARPROC ProcAddr;


    BYTE    bytWrite [ 2 ];


    bytWrite [ 0 ] = 0xc3;


    bytWrite [ 1 ] = 0x90;


    hModule = LoadLibrary ( "user32.dll" );


    ProcAddr = GetProcAddress ( hModule , "TrackPopupMenu" );


    ReadProcessMemory ( GetCurrentProcess () , ProcAddr , bytSave , 2 , 0 ) ;


    WriteProcessMemory ( GetCurrentProcess () ,


                         ProcAddr ,


                         bytWrite ,


                         2 ,


                         0 ) ;






    /**///////////////////////////////////////////////////////////////////////////


    //还原右键菜单


    hModule = LoadLibrary ( "user32.dll" );


    ProcAddr = GetProcAddress ( hModule , "TrackPopupMenu" );


    WriteProcessMemory ( GetCurrentProcess () , ProcAddr , bytSave , 2 , 0 ) ;





 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  user