Hello Paul,
Error 1158 indicates the following
ERROR_NO_MORE_USER_HANDLES
1158 (0x486)
The current process has used all of its system allowance of handles for Window Manager objects.
The runtime default in OR62 (after p14746) now has RequireRealFields set to TRUE. A new command line flag -fakefields was added for backward compatibility. Please set this on the command line when runnning your applications.
So flag -fakefields can help to solve the problem because it’s allow you to use less handles
However in some case you’ll need to redesigned your frame to not have so many objects allocated at the same time.
Window Handle :
The limit is 10000, this is a Windows default setting.
I hope this help
With regards.
Xavier
Actian Support Team.
--
You received this message because you are subscribed to the Google Groups "OpenROAD Users Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
openroad-user...@googlegroups.com.
To post to this group, send email to
openroa...@googlegroups.com.
Visit this group at
https://groups.google.com/group/openroad-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/openroad-users/5b053057.1c69f...@mx.google.com.
For more options, visit
https://groups.google.com/d/optout.
Thank you Xavier.
Most likely there is one frame which is causing the problem.
The error just affects the one user on two different PCs
I have been looking at taskmgr GDI handles to see if I can capture the faulty frame.
Paul
To view this discussion on the web visit https://groups.google.com/d/msgid/openroad-users/CY4PR06MB3175F536291391238339CFAA906B0%40CY4PR06MB3175.namprd06.prod.outlook.com.
If it’s only happening for one user, the user might also have some other program running which is exhausting the handles.
Windows USER handles have also a 32K system limit (shared by all programs).
BTW: There are GDI handles and USER handles (the latter one is the one involved in the error encountered).
Bodo.
Bodo Bergmann
Principal Software Engineer
Actian | Engineering
GESELLSCHAFTSANGABEN: Actian Germany GmbH | Geschäftsführer: Stephen Mark Padgett, Suzanne Gisborn, Gregory S. Hampton
Sitz der Gesellschaft: Hamburg| Handelsregister: Amtsgericht Hamburg | HRB 135991| USt-IdNr: DE252449897
To view this discussion on the web visit https://groups.google.com/d/msgid/openroad-users/5b05417f.1c69fb81.9522c.cc98%40mx.google.com.
Thanks Bodo and Xavier
I have been able to reproduce the problem.
It is a power user running a complex frame which opens a second, bigger frame with callframe.
Just open the second frame 6 times to see screen painting problems and error 1158 in the trace.
Taskmgr shows “USER Objects” = 9998
If I close some frames, then the stat comes down and OpenROAD can keep running normally.
I suspect there is some corruption happening because occasionally w4glrun disappears without a trace (pun intended)
Is it possible to capture this event within the 4GL and close elegantly?
I guess we can limit the frame opens, and I will try out the fakefields switch.
Paul

To view this discussion on the web visit https://groups.google.com/d/msgid/openroad-users/DM5PR06MB3385C9CA1989EBBB85821036936B0%40DM5PR06MB3385.namprd06.prod.outlook.com.
With -fakefields I am able to open the second frame about 30 times before running into problems.
From: pwhite
Sent: Wednesday, 23 May 2018 10:09 PM
To: 'openroa...@googlegroups.com'
Subject: RE: [openroad-users] CreateWindow(W4GLEditClass) failed with
error 1158
Thanks Bodo and Xavier
Paul,
For your question “Is it possible to capture this event within the 4GL and close elegantly?” the answer is:
There is no way to catch the event in the 4GL.
And as the USER resources are exhausted, you wouldn’t even be able to create an error message window (requiring a USER handle).
What you should do is: Check available resources BEFORE you call (or open) a frame that requires a lot of them.
This can be done using the two Win32 API functions GetCurrentProcess (from user32.dll) and GetGuiResources (from kernel32.dll).
See
https://msdn.microsoft.com/de-de/library/windows/desktop/ms683179(v=vs.85).aspx
and
https://msdn.microsoft.com/en-us/library/windows/desktop/ms683192(v=vs.85).aspx
You declare them in OpenROAD as 3GL Procedures (returning INTEGER, GetCurrentProcess might return an INTEGER8 in a 64-bit OpenROAD version – not tested).
Example:
declare
cnt_userobj = INTEGER NOT NULL;
enddeclare
{
cnt_userobj = GetGuiResources(GetCurrentProcess(), 1); // 1 = GR_USEROBJECTS
// Only start the frame if we have at least 2000 USER objects remaining
IF cnt_userobj>8000 THEN
MESSAGE 'Not enough USER resources to open the window!' + HC_NEWLINE +
'Please close other windows before trying again!';
ELSE
CALLFRAME mybigframe();
ENDIF;
}
HTH.
Regards,
Bodo.
Thank you Bodo,
Pretty clever.
The good news is my power user experienced no crashes and no recurrence of error 1158 today after adding fakefields switch.
I do prefer your approach in avoiding the situation in the first place.
Interesting problem trying to recover from low level resource problems without total crash.
Seeing the error 1158 in the trace window makes me think there may be a way to expose this type of low level error to the business logic.
Perhaps with a user event? Or perhaps a callable routine similar to inquire_sql?
Is it worthy of an enhancement request or just not ever remotely possible?
I think it is worthy if we can make OpenROAD more robust without coding low level O/S specific calls.
My suggestion..
If a frame cannot build clean, then CALLFRAME needs to fail with a useful return code.
Automatic memory / handle clean up and can we avoid throwing and catching exception objects too?
Lstatus = CALLFRAME mybigframe();
IF Lstatus <> 0 THEN /* 1558 returned? */
Record error from curproc.LastError()
Allow user to exit elegantly
Dynamic frame build should be able to capture errors
for x = 1 to 100 do
fld[x] = EntryField.Create();
IF fld[x] IS NULL THEN
Record error from EntryField.LastError() /* how to capture the real error code? */
Return fail
Paul
From: openroa...@googlegroups.com
[mailto:openroa...@googlegroups.com] On Behalf Of Bodo Bergmann
Sent: Thursday, 24 May 2018 7:47 PM
To: openroa...@googlegroups.com
Subject: RE: [openroad-users] CreateWindow(W4GLEditClass) failed with
error 1158
Paul,
--
You received this message because you are subscribed to the Google Groups
"OpenROAD Users Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to openroad-user...@googlegroups.com.
To post to this group, send email to openroa...@googlegroups.com.
Visit this group at https://groups.google.com/group/openroad-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/openroad-users/MWHPR06MB33910EEA195FAA43CBD2E2D6936A0%40MWHPR06MB3391.namprd06.prod.outlook.com.
Paul,
The return status wouldn’t work as a CALLFRAME returns data according to the Datatype defined for the frame.
Sending a
UserEvent – similar to the
errorevent in the SendUserEvent() method – is probably not a good idea,
as this requires the caller to be a frame (which can process events), so it wouldn’t work when the frame is started from a 4GL procedure or method,
and in case of a CALLFRAME we get a conflict with the current event block still being executed.
A possibility would be the setting of a SessionObject attribute, e.g. the existing ExternalError attribute, or a new one to be added.
Perhaps using an exit trap would also be a way to go.
If OpenROAD would produce a behaviour like an EXIT statement if such an error occurs, this could be trapped using the
ProcExec.SetExitTrap() method.
It would be good if you could open an “Idea” in the support portal for this.
Bodo.
To view this discussion on the web visit https://groups.google.com/d/msgid/openroad-users/5b06a9bc.1c69fb81.f4b43.7e95%40mx.google.com.
Hi,
I opened a request for OpenROAD to have proper exception/error handling some time ago – vote it up.
Cheers
Adrian

To view this discussion on the web visit https://groups.google.com/d/msgid/openroad-users/DM5PR06MB338549E87F3B18F4CB4F8231936A0%40DM5PR06MB3385.namprd06.prod.outlook.com.
This communication is for use by the intended recipient and contains
information that may be Privileged, confidential or copyrighted under
applicable law. If you are not the intended recipient, you are hereby
formally notified that any use, copying or distribution of this e-mail,
in whole or in part, is strictly prohibited. Please notify the sender by
return e-mail and delete this e-mail from your system. Unless explicitly
and conspicuously designated as "E-Contract Intended", this e-mail does
not constitute a contract offer, a contract amendment, or an acceptance
of a contract offer. This e-mail does not constitute a consent to the
use of sender's contact information for direct marketing purposes or for
transfers of data to third parties.
Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean
Is it done if the button has FocusBehavior TakeFocus?
Mit freundlichen Grüßen / With kind regards
Christian Birkl
Software Engineering
GAMED Gesellschaft für Angewandte
Mathematik und EDV mbH
Address: Harter Straße 48, 8053 Graz, Austria
Phone: +43 (0) 316 27 86 60 - 18
Fax: +43 (0) 316 27 86 60 - 10
E-Mail: Christi...@gamed.com
Internet: www.gamed.com
Register: FN 50094v
Court: Handelsgericht Graz
VAT_ID: ATU28647907
This message and any attachments are solely for the use of the intended recipients. They may contain privileged and/or confidential information or other information protected from disclosure. If you are not an intended recipient, you are hereby notified that you received this email in error and that any review, dissemination, distribution or copying of this email and any attachment is strictly prohibited. If you have received this email in error, please contact the sender and delete the message and any attachment from your system. Thank you for your cooperation.
--
You received this message because you are subscribed to the Google Groups "OpenROAD Users Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
openroad-user...@googlegroups.com.
To post to this group, send email to
openroa...@googlegroups.com.
Visit this group at https://groups.google.com/group/openroad-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/openroad-users/OFC09E614C.86F67346-ON80258328.0039F8A5-80258328.003A9247%40dfsmta1.dupontnet.net.
.
To view this discussion on the web visit https://groups.google.com/d/msgid/openroad-users/DB6PR0701MB2695D9C787B5AC46A41B8CFCFEFE0%40DB6PR0701MB2695.eurprd07.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.
Great, thanks for letting me know!
To view this discussion on the web visit https://groups.google.com/d/msgid/openroad-users/OFC740B303.E22FFC2B-ON80258328.003CA76B-80258328.003CC71E%40dfsmta1.dupontnet.net.
Hi Allan,
You cannot define the original opening position of the
OpenROAD Trace Window,
but it is possible to move (and resize) it by using a few Win32 API functions as 3GL procedures:
declare
rv = INTEGER NOT NULL;
pid = INTEGER NOT NULL;
pid_tw = INTEGER NOT NULL;
threadid = INTEGER NOT NULL;
enddeclare
{
pid = GetCurrentProcessId();
hwndTrace = FindWindowExA(0, 0, 'IITRACE', 'OpenROAD Trace Window ');
WHILE (hwndTrace > 0)
DO
// Check that it is the trace window belonging to this process
threadid = GetWindowThreadProcessId(hwndTrace, BYREF(pid_tw));
IF (pid_tw = pid)
THEN
ENDLOOP;
ENDIF;
// Find the next OpenROAD Trace Window (in case there are more than one OpenROAD apps running)
hwndTrace = FindWindowExA(0, hwndTrace, 'IITRACE', 'OpenROAD Trace Window ');
ENDWHILE;
IF (hwndTrace=0)
THEN
MESSAGE 'No Trace Window found for this process!';
ENDIF;
}
Whenever you want to position and/or resize the Trace Window you use this script
(where x and y define the window position and width and height the dimensions (all values in pixel):
IF (hwndTrace > 0) THEN
CALLPROC SetWindowPos(hwndTrace, 0, x, y, width, height, 0);
ENDIF
HTH.
Regards,
Bodo.
Bodo Bergmann
Principal Software Engineer
Actian | Engineering
GESELLSCHAFTSANGABEN: Actian Germany GmbH | Geschäftsführer: Stephen Mark Padgett, Suzanne Gisborn, Gregory S. Hampton
Sitz der Gesellschaft: Hamburg| Handelsregister: Amtsgericht Hamburg | HRB 135991| USt-IdNr: DE252449897
--
You received this message because you are subscribed to the Google Groups "OpenROAD Users Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
openroad-user...@googlegroups.com.
To post to this group, send email to
openroa...@googlegroups.com.
Visit this group at
https://groups.google.com/group/openroad-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/openroad-users/OFB583EACF.7B0A9A0B-ON8025832A.0048B192-8025832A.00495D92%40dfsmta1.dupontnet.net.
--
You received this message because you are subscribed to the Google Groups "OpenROAD Users Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openroad-user...@googlegroups.com.
To post to this group, send email to openroa...@googlegroups.com.
Visit this group at https://groups.google.com/group/openroad-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/openroad-users/OFB583EACF.7B0A9A0B-ON8025832A.0048B192-8025832A.00495D92%40dfsmta1.dupontnet.net.