English 中文(简体)
C# - How to PostMessage to a闪光窗 嵌入网上浏览器?
原标题:C# - How to PostMessage to a flash window embedded in a WebBrowser?

I would like to know if there was any way to lock onto a Flash window and post a message to it? Another person here had the answer to it, his name is Spencer K. His question was: Sending simulated click via WebBrowser in C# to flash object embedded in HTML

遗憾的是,K先生没有很具体,他离开后去看问题的人都说,他“放弃了工作,然后通过工作振兴”。 我并不十分肯定他这样做的含义。 我通过所有可见的EnumWindows处理器开了电,因为它没有回过一个窗户。

我希望,在座的一些人能够告诉我,因为过去几天,我一直在驾.。

EDIT:我刚刚在插入SWF上定居。 反对我的形式,并向处理此事发出信息。

问题回答

实际的闪光窗口也自行处理。 为了让你从Spy++中获取控制类别的名称,你可以这样:

    [DllImport("user32.dll", SetLastError = true)]
    public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string className, IntPtr windowTitle);
    public IntPtr Flash()
    {
        IntPtr pControl;
        pControl = FindWindowEx(webBrowser1.Handle, IntPtr.Zero, "Shell Embedding", IntPtr.Zero);
        pControl = FindWindowEx(pControl, IntPtr.Zero, "Shell DocObject View", IntPtr.Zero);
        pControl = FindWindowEx(pControl, IntPtr.Zero, "Internet Explorer_Server", IntPtr.Zero);
        pControl = FindWindowEx(pControl, IntPtr.Zero, "MacromediaFlashPlayerActiveX", IntPtr.Zero);
        return pControl;
    }

当你接手时,你可以点击:

    [DllImport("user32.dll", SetLastError = true)]
    static extern bool PostMessage(IntPtr hWnd, uint Msg, int wParam, int lParam);
    public enum WMessages : int
    {
        WM_LBUTTONDOWN = 0x201,
        WM_LBUTTONUP = 0x202
    }
    private int MAKELPARAM(int p, int p_2)
    {
        return ((p_2 << 16) | (p & 0xFFFF));
    }
    public void DoMouseLeftClick(IntPtr handle, Point x)
    {
        PostMessage(handle, (uint)WMessages.WM_LBUTTONDOWN, 0, MAKELPARAM(x.X, x.Y));
        PostMessage(handle, (uint)WMessages.WM_LBUTTONUP, 0, MAKELPARAM(x.X, x.Y));            
    }

这些要点与客户有关,因此,如果你拯救这些客户,你就应当予以撤销:

    List<Point> plist = new List<Point>();
    private void webBrowser1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
    {
        switch (e.KeyCode)
        {
            case Keys.C:                   
                plist.Add(webBrowser1.PointToClient(Cursor.Position));                    
                break;
            default:
                break;
        }
    }

希望是有助益的。

你们可以通过手法这样做。

进口

import flash.external.ExternalInterface;

根据您的《章程》:

if (ExternalInterface.available) {
   // add external interface
   ExternalInterface.addCallback("jsFunction", asFunction);
}

public static function asFunction(message:String):void {
}

在你们共同提交的联合材料中,你可以称之为这一功能:

jsObject.jsFunction("message");

接收闪电物体的功能是:

var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
jsObject = InternetExplorer ? window.jsObjectName: window.document.jsObjectName;

我没有测试这一法典,我只是将其复制出一个项目。

edit: 添加 j功能以获得 object子

The Flash window will probably not have its own handle, since it is embedded in a webpage. You would want to post the message to the web browser window (that s what Mr. K did).

如果你不工作,我知道的唯一选择是通过网络司机或WatiN获得浏览器的控制,并利用javascript与闪点进行互动。

for calling a function in flash object u can use this code

 swfobject.CallFunction(
               "<invoke name="yourfunction" returntype="xml">" +
               " <arguments><number>" yourvalue "</number></arguments> </invoke> ");

http://blog.another-d-mention.ro/programming/communicate-betwen-c-and-an-embeded-flash-application/"rel=“nofollow”

i 尝试用我的形式申请一个闪点,并且工作,但我没有将它用于网络浏览器。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签