Forum > Windows

MessageBox needs an hWnd?

(1/3) > >>

linuxbob:
When I try to type in 'MessageBox' into a unit, the code prediction tells me I need to provide an hWnd. If I don't provide an hWnd, I get an error.

The wiki doesn't refer to the hWnd parameter at all, nor does the appropriate Delphi reference. Coming from VB6, I never needed an hWnd there either.

If an hWnd is required, which one should I pass?

TIA.

440bx:

--- Quote from: linuxbob on July 07, 2022, 03:31:40 am ---If an hWnd is required, which one should I pass?

--- End quote ---
Pass zero (0) as the hwnd.

linuxbob:
Cool, I'll give that a try.

MarkMLl:
What exactly are you trying to do (and on what platform)? There's a risk here that a suggestion from the IDE is leading you towards a low-level API rather than a more general routine to e.g. display a dialog(u)e.

Also note that the- in fact any- wiki should not automatically be considered authoritative documentation. See e.g. https://lazarus-ccr.sourceforge.io/docs/lcl/ hence https://lazarus-ccr.sourceforge.io/docs/lcl/forms/tapplication.messagebox.html

I'd suggest that even if not obvious, it is always prudent to give the compiler and IDE version in a question. For example, it might be that you have am IDE version where there are known to be deficiencies in some areas of the help subsystem.

MarkMLl

Zvoni:
at a Guess, the hWnd is "representing" the Parent-Form of the Message-Box,
but looking at Mark's link to TApplication.MessageBox i'm wondering where the hWnd is coming from....

Navigation

[0] Message Index

[#] Next page

Go to full version