Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Looking for a simple Dialog C++ solution
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00928187
Message ID:
00928302
Vues:
20
Rick,

If I understand you correctly then the answer is relativly straightforward and can be achieved through the Platform API.

You begin by creating a dialog box using a template in Visual C++, making sure you set the Style to Popup (WS_POPUP if using CreateWindowEx function) and invoke it using the CreateDialog function.
HWND hwndProgress = NULL; 

if (!IsWindow(hwndProgress)) 
{ 
   hwndProgress = CreateDialog(hInst, 
                               MAKEINTRESOURCE(IDD_PROGRESS), 
                               NULL, 
                              (DLGPROC)TestProc); 

   ShowWindow(hwndProgress, SW_SHOW); 
} 
You provide a callback function with the correct signature to process messages for both external events (SendMessage) and internal events such as a Cancel button being clicked.
LRESULT CALLBACK TestProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam) 
{ 
   switch (message) 
   { 
      case WM_INITDIALOG: 
         return TRUE; 
 
      case WM_COMMAND: 
         switch (LOWORD(wParam)) 
         { 
            case IDOK: 
               return TRUE;

            case IDCANCEL: 
               DestroyWindow(hwndDlg); 
               hwndProgress = NULL; 

               return TRUE; 

            case CUSTOMMSG:
               // Perform custom processing like updating child controls.
               return TRUE;
         } 
   } 

   return FALSE; 
} 
Once you have your HWND you can register custom external messages using the RegisterWindowMessage function and send them to the dialog, this in turn is catered for in the dialog callback function.
...

case APP_UPDATEEXENAME:
   SetDlgItemText(hwndDlg, IDD_EXEFILENAME, lpstrNewEXEFileName); 
   return TRUE; 

...
HTH
Neil
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform