Click here to Skip to main content
15,399,788 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is There an event that records when dialog opens?an event like onClose but to the opposite when dialog opens

What I have tried:

I searched on internet, I saw there is an event like show..
Updated 9-Mar-22 18:01pm

Member 14594285 9-Mar-22 11:57am
there is OnInitDialog but it intervenes only in the start and not always when dialog opens
Richard MacCutchan 9-Mar-22 12:17pm
You can only use the events that are listed. And OnInitDialog is called just before it opens.
Another link to the Microsoft documentation might also be helpful.
Using Dialog Boxes - Win32 apps | Microsoft Docs[^]

Since a dialog is derived from CWnd one could probably also use these messages. BeginPaint is probably also involved in displaying the dialog.
if ((hwndOwner = GetParent(hwndDlg)) == NULL) {
    hwndOwner = GetDesktopWindow(); 
I recommend that you use the Spy utility and find out for yourself exactly what messages are sent. If you have never used it then this is a very good opportunity to learn how.
Member 14594285 10-Mar-22 9:59am
I solved my problem with function OnSize

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900