Home > Back-end >  Through the handle will have to open the window in front no longer created again
Through the handle will have to open the window in front no longer created again

Time:09-26

The following code is what I want to through the handle will have to open the window in front not to create

SaveFrmAddress (DllFormName);//handle to temporarily store
ChildHandle:=StrToInt (FFrmIni. ReadString (' FrmList DllFormName, '0'));/when open the child form, will be stored in child form the Ini file, handle to open again read value, storage handle way is rigid is to read and write Ini file
If ChildHandle=0, then no opened,//sense to open too won't go to call DLL files, no open call DLL file is loaded into the main form of
RunDllForm (DllFileName DllFormName, Parameter, FrmCaption, 'ShowForm')//open for the first time can be displayed to the main form
The else
The begin
//this code has a problem, the second can't open the window when it is open, not according to the front, and then call the DLL will create a new form in the son, want to through the handle in this way will the form again displayed,
//this code at execution time, if the child form without focus, according to the control (xjPanel) can be pre - control with a focus (xjEdit) are not displayed, there is a major problem that I'm asking you, do not know how to display the form again?
Windows. ShowWindow (ChildHandle, SW_SHOW);
Windows. SetFocus (ChildHandle);
Windows. The SetForegroundWindow (ChildHandle);
Windows. SetWindowPos (ChildHandle, HWND_TOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW or SWP_NOREDRAW or SWP_NOSIZE or SWP_ASYNCWINDOWPOS);
The end;
  • Related