File:  [WindowsNT SDKs] / mstools / samples / ddeml / ddeprog / phtest.c
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs
Thu Aug 9 18:23:26 2018 UTC (7 years, 9 months ago) by root
Branches: msft, MAIN
CVS tags: ntsdk-nov-1993, ntsdk-jul-1993, HEAD
Microsoft Windows NT Build 511 (SDK Final Release) 07-24-1993

#include <windows.h>
#include "phtest.h"
#include "proghelp.h"

LONG  APIENTRY MainWndProc(HWND hwnd, UINT message, WPARAM wParam, LONG lParam);

DWORD GFlags;
DWORD type;
HANDLE hKey;

int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
INT nCmdShow)
{
    DialogBox(hInstance,
            MAKEINTRESOURCE(DID_PHTEST),
            NULL,
            (DLGPROC)MainWndProc);

    return(TRUE);
}



LONG  APIENTRY MainWndProc(
HWND hwnd,
UINT message,
WPARAM wParam,
LONG lParam)
{
    char szT[100];

    switch (message) {
    case WM_INITDIALOG:
        if (!ConnectToProgman()) {
            PostMessage(hwnd, WM_CLOSE, 0, 0);
            return(0);
        }
        return(IDEF_EXECTEXT);

    case WM_COMMAND:
        switch (LOWORD(wParam)) {
        case IDOK:
            GetDlgItemText(hwnd, IDEF_EXECTEXT, szT, sizeof(szT));
            if (!ProgmanExecuteString(szT)) {
                MessageBeep(0);
            }
        }
        break;

    case WM_CLOSE:
        ShowWindow(hwnd, SW_HIDE);
        if (!DisconnectFromProgman()) {
            /*
             * Progman is not done yet - we need to wait around for the
             * transactions to complete before closing down so just
             * keep posting WM_CLOSE to ourselves to allow DDEML's DDE
             * messages to finish.
             */
            Sleep(100);
            PostMessage(hwnd, WM_CLOSE, 0, 0);
            return(0);
        };
        EndDialog(hwnd, 0);
        break;

    }
    return(0);
}



unix.superglobalmegacorp.com

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