C # completely shield the right-click menu of Flash

Source: Internet
Author: User
Using System;
Using System. Collections. Generic;
Using System. componentmodel;
Using System. Data;
Using System. drawing;
Using System. text;
Using System. Windows. forms;
Using System. runtime. interopservices;

Namespace Flashplayer
{
Public Partial Class Form1: Form
{
Disable Flash's context menu # Region Disable Flash's context menu
Private   Const   Int Gwl_wndproc =   - 4 ;
Public   Delegate Intptr flawndproc (intptr hwnd, Int MSG, intptr wparam, intptr lparam );

Private Intptr oldwndproc = Intptr. zero;
Private Flawndproc WPR =   Null ;

[Dllimport ( " User32.dll " , Charset = Charset. Auto)]
Public   Static   Extern Intptr setwindowlong (intptr hwnd, Int Nindex, flawndproc wndproc );
[Dllimport ( " User32.dll " , Charset = Charset. Auto)]
Public   Static   Extern Intptr callwindowproc (intptr wndproc, intptr hwnd, Int MSG, intptr wparam, intptr lparam );

Private Intptr flashwndproc (intptr hwnd, Int MSG, intptr wparam, intptr lparam) {< br> If (MSG = 516 )
return (intptr) 0 ;< br> return callwindowproc (oldwndproc, hwnd, MSG, wparam, lparam );
}
# Endregion

Public Form1 ()
{
Initializecomponent ();
}

Private   Void Form1_load ( Object Sender, eventargs E) {
This. WPR= NewFlawndproc (This. Flashwndproc );
This. Oldwndproc=Setwindowlong (axshockwaveflash1.handle, gwl_wndproc, WPR );
}
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.