Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

IVF: Handle to modal dialog zero?

alb_f
Novice
195 Views

For some test work (using VS and IVF) I created a single modal dialog like

use IFLOGM
lret = DLGINIT(IDD_DIALOG, dlg)
iret = DLGMODAL(dlg)

It works fine but I noticed that the dialog handle dlg%hWnd is 0 after DLGINIT().

Why is that? And the more important question: is there a way to obtain a handle to it?

This because I need the handle to it for some controls I want to test.

From searching the internet I only found it is 0, but not why.. Is it because it has no parent dialog?

 

 

 

0 Kudos
6 Replies
Steve_Lionel
Black Belt Retired Employee
183 Views

I would not expect the handle to be nonzero after just calling DLGINIT, as the window for the dialog hasn't been created yet - that is done in the DLGMODAL call. As best as I can tell, the creation of the dialog window is done internally to the support library - some of the IFLOGM code is in module procedures in iflogm.f90, but not all of it. I guess the idea is that the user doesn't need to know the dialog window handle?  I wonder (haven't tried this) if you called GetForegroundWIndow from a callback if you'd get anything useful.

alb_f
Novice
161 Views

Thanks for your answer, indeed there is some logic in making it available for the user at the moment it could be needed like during a callback from an event but that's for "normal" users..

I found a way out of this issue by using CreateDialogParam() instead of DlgModal() but this leads to more work creating and destroying the dialogs with their own routines. I like to use just the standard DlgModal if possible but since the DlgModal call blocks any further code after it, the handle should be available before this call. I'll try some calls like the one you propose.

(forgot to mention). Actually this is cheating, the CreateDialogParam call creates a modeless dialog, not a modal one. Perhaps I should try to move to modeless dialogs instead.

andrew_4619
Honored Contributor I
156 Views

It always used to set the handle as the first item in the dlg structure..... Did you try a test build of the intel dialog sample program to see that that does?

Steve_Lionel
Black Belt Retired Employee
132 Views

I did a test, and you can see the actual code in iflogm.f90. The handle component is set to zero in DLGINIT and isn't changed in DLGMODAL. It might get changed internally to the library but put back before DLGMODAL returns.

mfinnis
New Contributor I
148 Views

You need to set a callback routine with DlgSetSub for the dialog. This is called with a callbacktype of DLG_INIT after the window is created but before it is displayed, ie dlg%hwnd contains the window handle. All the code you need to implement the dialog can be included in, or referenced by, the callback routine(s).

alb_f
Novice
128 Views

This is my current solution also after various other trials. Read somewhere that via the DLG_INIT you have the dialog just before it is displayed and indeed, there the handle is assigned already. So that saves my day.  Now I can use both modal and modeless dialogs with fancy bitmaps and coloured controls. Thanks for the discussion and ideas!

Reply