0
我正在使用jsfl爲fla添加自定義組件的新版本。JSFL - 響應「Replace Existing Item」對話框
這會提示用戶選擇是否替換現有組件。
如果可能,我想通過jsfl迴應此提示。
謝謝。
我正在使用jsfl爲fla添加自定義組件的新版本。JSFL - 響應「Replace Existing Item」對話框
這會提示用戶選擇是否替換現有組件。
如果可能,我想通過jsfl迴應此提示。
謝謝。
我會在調用fl.componentsPanel.addItemToDocument之前編寫一個程序(帶有延遲)來確認「解決庫衝突」對話框並使用FLfile.runCommandLine調用它。 我知道如何在Windows中做到這一點,但不是在Mac上。
(Windows中的程序,以確認替換可能是:
見微軟 - 開發中心 - 桌面>樣品>枚舉頂級窗口快於C#
using System;
using System.Text;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace FlashHack
{
class Program
{
protected delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam);
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
protected static extern int GetWindowText(IntPtr hWnd, StringBuilder strText, int maxCount);
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
protected static extern int GetWindowTextLength(IntPtr hWnd);
[DllImport("user32.dll")]
protected static extern bool EnumWindows(EnumWindowsProc enumProc, IntPtr lParam);
[DllImport("user32.dll")]
protected static extern bool IsWindowVisible(IntPtr hWnd);
[DllImport("user32", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
internal static extern IntPtr GetParent(IntPtr hwnd);
[DllImport("User32.dll", EntryPoint = "SetForegroundWindow")]
private static extern IntPtr SetForegroundWindowNative(IntPtr hWnd);
protected static bool AnswerResolveLibraryConflictDlg(IntPtr hWnd, IntPtr lParam)
{
int size = GetWindowTextLength(hWnd);
if (size++ > 0 && IsWindowVisible(hWnd))
{
StringBuilder sb = new StringBuilder(size);
GetWindowText(hWnd, sb, size);
if (sb.ToString() == "Resolve Library Conflict")
{
IntPtr parent = GetParent(hWnd);
Console.WriteLine(sb.ToString());
if (parent != null)
{
SetForegroundWindowNative(parent);
SendKeys.SendWait("{TAB} {ENTER}");
}
}
}
return true;
}
static void Main(string[] args)
{
System.Threading.Thread.Sleep(1000); // Must wait for the 'Resolve Library Conflict'-dlg
Console.WriteLine("Now!");
EnumWindows(new EnumWindowsProc(AnswerResolveLibraryConflictDlg), IntPtr.Zero);
}
}
}
而且在JSFL這個程序可以啓動搭配:
FLfile.runCommandLine("start ConfirmReplace.exe");
fl.componentsPanel.addItemToDocument(...);
)
你已經有了什麼碼? –