| 1 | #define INCL_DOS | 
|---|
| 2 | #define INCL_WIN | 
|---|
| 3 |  | 
|---|
| 4 | #include <os2.h> | 
|---|
| 5 | #include <stdlib.h> | 
|---|
| 6 | #include <stdio.h> | 
|---|
| 7 | #include <string.h> | 
|---|
| 8 | #include "fm3dll.h" | 
|---|
| 9 | #include "fm3dlg.h" | 
|---|
| 10 | #include "fm3str.h" | 
|---|
| 11 |  | 
|---|
| 12 | #pragma alloc_text(FMINPUT,InputDlgProc) | 
|---|
| 13 |  | 
|---|
| 14 |  | 
|---|
| 15 | MRESULT EXPENTRY InputDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) { | 
|---|
| 16 |  | 
|---|
| 17 | /* | 
|---|
| 18 | * mp2 should point at a structure of type STRINGINPARMS | 
|---|
| 19 | */ | 
|---|
| 20 |  | 
|---|
| 21 | STRINGINPARMS *ret; | 
|---|
| 22 |  | 
|---|
| 23 | switch(msg) { | 
|---|
| 24 | case WM_INITDLG: | 
|---|
| 25 | if(!mp2) { | 
|---|
| 26 | WinDismissDlg(hwnd,0); | 
|---|
| 27 | break; | 
|---|
| 28 | } | 
|---|
| 29 | WinSetWindowPtr(hwnd,0,(PVOID)mp2); | 
|---|
| 30 | ret = (STRINGINPARMS *)mp2; | 
|---|
| 31 | if(!(BOOL)WinSendDlgItemMsg(hwnd,STR_INPUT,EM_SETTEXTLIMIT, | 
|---|
| 32 | MPFROM2SHORT(ret->inputlen,0),MPVOID)) { | 
|---|
| 33 | DosBeep(50,100); | 
|---|
| 34 | WinDismissDlg(hwnd,0); | 
|---|
| 35 | break; | 
|---|
| 36 | } | 
|---|
| 37 | if(ret->prompt && *ret->prompt) | 
|---|
| 38 | WinSetDlgItemText(hwnd,STR_PROMPT,ret->prompt); | 
|---|
| 39 | if(ret->ret && *ret->ret) { | 
|---|
| 40 | WinSetDlgItemText(hwnd,STR_INPUT,ret->ret); | 
|---|
| 41 | WinSendDlgItemMsg(hwnd,STR_INPUT,EM_SETSEL, | 
|---|
| 42 | MPFROM2SHORT(0,strlen(ret->ret)),MPVOID); | 
|---|
| 43 | } | 
|---|
| 44 | *ret->ret = 0; | 
|---|
| 45 | if(ret->title && *ret->title) | 
|---|
| 46 | WinSetWindowText(hwnd,ret->title); | 
|---|
| 47 | break; | 
|---|
| 48 |  | 
|---|
| 49 | case WM_CONTROL:    /* don't care */ | 
|---|
| 50 | return 0; | 
|---|
| 51 |  | 
|---|
| 52 | case WM_COMMAND: | 
|---|
| 53 | switch(SHORT1FROMMP(mp1)) { | 
|---|
| 54 | case DID_OK: | 
|---|
| 55 | ret = WinQueryWindowPtr(hwnd,0); | 
|---|
| 56 | WinQueryDlgItemText(hwnd,STR_INPUT,ret->inputlen,ret->ret); | 
|---|
| 57 | WinDismissDlg(hwnd,1); | 
|---|
| 58 | break; | 
|---|
| 59 |  | 
|---|
| 60 | case IDM_HELP: | 
|---|
| 61 | ret = WinQueryWindowPtr(hwnd,0); | 
|---|
| 62 | if(ret->help && *ret->help) | 
|---|
| 63 | WinMessageBox(HWND_DESKTOP,hwnd,ret->help, | 
|---|
| 64 | GetPString(IDS_HELPTEXT), | 
|---|
| 65 | 0,MB_ENTER | MB_ICONASTERISK | MB_MOVEABLE); | 
|---|
| 66 | else | 
|---|
| 67 | WinMessageBox(HWND_DESKTOP,hwnd, | 
|---|
| 68 | GetPString(IDS_ENTERTEXTHELPTEXT), | 
|---|
| 69 | GetPString(IDS_HELPTEXT), | 
|---|
| 70 | 0,MB_ENTER | MB_ICONASTERISK | MB_MOVEABLE); | 
|---|
| 71 | break; | 
|---|
| 72 |  | 
|---|
| 73 | case DID_CANCEL: | 
|---|
| 74 | WinDismissDlg(hwnd,0); | 
|---|
| 75 | break; | 
|---|
| 76 | } | 
|---|
| 77 | return 0; | 
|---|
| 78 | } | 
|---|
| 79 | return WinDefDlgProc(hwnd,msg,mp1,mp2); | 
|---|
| 80 | } | 
|---|
| 81 |  | 
|---|