NOTE: This page has been translated automatically from Russian to English. Original page.
The hierarchy of windows in 1C 8.2
To work with windows handles 1C requires the following windows:
1. h1C - the handle of the main window
2. hMDI - the handle of the MDI window (for 8.2 irrelevant)
3. hReport - the handle of the active form of the report window (processing)
4. hReportDialog - handle "substrate" (the layer where you can place visible components)
The main window has a 8.2 grade V8TopLevelFrameSDI, for calling the library can be found as a window of this class (with the proviso that the PID of the PID window is the library, since they belong to the same process)
function EnumWindows82Proc (WND: hwnd; LPARAM: lParam): bool; stdcall;
var ThrID, PID: DWORD;
var b: array [0..254] of AnsiChar;
begin
ThrID: = GetWindowThreadProcessId (wnd, PID);
GetClassName (wnd, @ b, 255);
{Only looking for "their" main window}
if (b = 'V8TopLevelFrameSDI') and (PID = GetCurrentProcessId ()) then begin
Main82Handle: = wnd;
end;
end;
function TMiracleClass.GetMain82: Integer;
begin
Main82Handle: = 0;
EnumWindows (@ EnumWindows82Proc, 0);
RESULT: = Main82Handle;
end;
Note: The main window for the third-party program can be found through
FindWindow ( 'V8TopLevelFrameSDI', nil) - topmost
or
FindWindow ( 'V8TopLevelFrameSDI', ZagolovokEtogoOkna)
Forms 8.2, though owned by the process of the main window, but are not its subsidiaries, and are top-level windows. The windows have V8TopLevelFrameSDIsec class
For calling the library handle forms can be found through GetActiveWindow, from across
FindWindow ( 'V8TopLevelFrameSDIsec', nil) - active
or
FindWindow ( 'V8TopLevelFrameSDIsec', ZagolovokNuzhnoyFormy)
But then begins a very confusing hierarchy of child windows of the active form.
Method scientific (by the way, convenient - recommend [http://infostart.ru/public/59436/index.php?fimages=yes&PAGEN_1=7#comm], position 124) was defined handle "substrate", is just the layer where the embedded components are visible on the form
wnd: = FindWindow ( 'V8TopLevelFrameSDIsec', nil); // There is an active form
wnd: = GetTopWindow (wnd); // first V8LayouterTabsWindow
wnd: = GetTopWindow (wnd); // his first V8FormElement
w: = FindWindowEx (wnd, 0, 'V8LayouterTabsWindow', nil); // his first V8LayouterTabsWindow
wnd: = FindWindowEx (wnd, w, 'V8LayouterTabsWindow', nil); // Its second V8LayouterTabsWindow
wnd: = GetTopWindow (wnd); // his first V8FormElement
wnd: = GetTopWindow (wnd); // his first V8LayouterTabsWindow
wnd: = GetTopWindow (wnd); // his first V8FormElement - he is !!!!
{Introduce} Delphi component
PB: = TProgressBar.CreateParented (wnd);
PB.UpdateControlState;
PB.Left: = 10;
PB.Top:=40;
PB.Width: = 200;
PB.Height: = 20;
PB.Visible: = true;
PB.Enabled: = true;
PB.Position: = 60;
(Pictured result)