Annotation of mstools/samples/ddeml/ddeprog/phtest.c, revision 1.1.1.2

1.1       root        1: #include <windows.h>
                      2: #include "phtest.h"
                      3: #include "proghelp.h"
                      4: 
                      5: LONG  APIENTRY MainWndProc(HWND hwnd, UINT message, WPARAM wParam, LONG lParam);
                      6: 
                      7: DWORD GFlags;
                      8: DWORD type;
                      9: HANDLE hKey;
                     10: 
1.1.1.2 ! root       11: int WINAPI WinMain(
        !            12: HINSTANCE hInstance,
        !            13: HINSTANCE hPrevInstance,
1.1       root       14: LPSTR lpCmdLine,
                     15: INT nCmdShow)
                     16: {
                     17:     DialogBox(hInstance,
                     18:             MAKEINTRESOURCE(DID_PHTEST),
                     19:             NULL,
                     20:             (DLGPROC)MainWndProc);
                     21: 
                     22:     return(TRUE);
                     23: }
                     24: 
                     25: 
                     26: 
                     27: LONG  APIENTRY MainWndProc(
                     28: HWND hwnd,
                     29: UINT message,
                     30: WPARAM wParam,
                     31: LONG lParam)
                     32: {
                     33:     char szT[100];
                     34: 
                     35:     switch (message) {
                     36:     case WM_INITDIALOG:
                     37:         if (!ConnectToProgman()) {
                     38:             PostMessage(hwnd, WM_CLOSE, 0, 0);
                     39:             return(0);
                     40:         }
                     41:         return(IDEF_EXECTEXT);
                     42: 
                     43:     case WM_COMMAND:
                     44:         switch (LOWORD(wParam)) {
                     45:         case IDOK:
                     46:             GetDlgItemText(hwnd, IDEF_EXECTEXT, szT, sizeof(szT));
                     47:             if (!ProgmanExecuteString(szT)) {
                     48:                 MessageBeep(0);
                     49:             }
                     50:         }
                     51:         break;
                     52: 
                     53:     case WM_CLOSE:
                     54:         ShowWindow(hwnd, SW_HIDE);
                     55:         if (!DisconnectFromProgman()) {
                     56:             /*
                     57:              * Progman is not done yet - we need to wait around for the
                     58:              * transactions to complete before closing down so just
                     59:              * keep posting WM_CLOSE to ourselves to allow DDEML's DDE
                     60:              * messages to finish.
                     61:              */
                     62:             Sleep(100);
                     63:             PostMessage(hwnd, WM_CLOSE, 0, 0);
                     64:             return(0);
                     65:         };
                     66:         EndDialog(hwnd, 0);
                     67:         break;
                     68: 
                     69:     }
                     70:     return(0);
                     71: }
                     72: 
                     73: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.