Image_1

Image_2

--------------------------->> Incorporar
--------------------------->> On Preload ou Globals Functions
xMount = {}
function xMount.Window(Filename,Size,Width,Height,X,Y,Delay)
local xWindow = {}
--Application.Sleep(Delay);
xWindow.PWnd = Application.GetWndHandle();
local xPwndSize = Window.GetSize(xWindow.PWnd);
xWindow.Width = xPwndSize.Width - 15
xWindow.Height = xPwndSize.Height - 30
xWindow.X = 0
xWindow.Y = 0
xWindow.Size = Size
blnEmbedded=false;
while (blnEmbedded==false) do
xProcesses = Window.EnumerateTitles();
Filename = "Relatório.pdf"
for handle,path in pairs(xProcesses) do
xWindow.Find = String.Find(path, Filename, 1, false);
if xWindow.Find ~= -1 then
xWindow.CWnd = handle
blnEmbedded=true;
repeat
Window.SetOrder(handle, HWND_TOPMOST);
xWindow.IsPWnd = DLL.CallFunction(_SystemFolder .. "\\User32.dll", "SetParent", xWindow.CWnd..","..xWindow.PWnd, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
until xWindow.IsPWnd ~= ""
if xWindow.Size == "CUSTOM" then
Window.SetSize(xWindow.CWnd, Width, Height);
Window.SetPos(xWindow.CWnd, X, Y);
Window.Show(xWindow.CWnd);
Page.Redraw();
elseif xWindow.Size == "DEFAULT" then
Window.Maximize(xWindow.CWnd);
Window.Show(xWindow.CWnd);
Page.Redraw();
end
return xWindow
end
end
--return nil;
end
end
function xMount.Resize(ParentWndHandle,ChildWndHandle,Size,Width,Height,X,Y)
if Size == "DEFAULT" then
local xPwndSize = Window.GetSize(ParentWndHandle);
local Width = xPwndSize.Width - 17
local Height = xPwndSize.Height - 40
Window.SetSize(ChildWndHandle, Width, Height);
Window.SetPos(ChildWndHandle, 0, 0);
Window.Maximize(ChildWndHandle);
Window.Show(ChildWndHandle);
Page.Redraw();
elseif Size == "CUSTOM" then
Window.SetSize(ChildWndHandle, Width, Height);
Window.SetPos(ChildWndHandle, X, Y);
Window.Show(ChildWndHandle);
Page.Redraw();
elseif Size == "" or Size == nil then
return nil
end
end
function xMount.Close(ChildWndHandle)
Window.Close(ChildWndHandle, CLOSEWND_SENDMESSAGE);
Page.Redraw();
end
------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------->> On Size
if tblMount ~= nil then
xMount.Resize(tblMount.PWnd,tblMount.CWnd,"DEFAULT",nil,nil,nil,nil);
end
------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------->> xButton On Click
Window.Maximize(Application.GetWndHandle());
sPDFRootFolder = "Relatório\\Relatório.pdf";
sPage = File.Run("SumatraPDF.dll", sPDFRootFolder, "", SW_SHOWNORMAL, false);
tblMount = xMount.Window(sPage,"DEFAULT",nil,nil,nil,nil,1900);