Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. #ifndef DRAKE_INPUT_BOX_H
  2. #define DRAKE_INPUT_BOX_H
  3.  
  4. #include <windows.h>
  5. #include "DrakeInputBoxResource.h"
  6. #include <string>
  7.  
  8. using namespace std;
  9.  
  10. //Global variables
  11. int QueryLen;
  12. char *QueryCaption, *QueryText, *QueryDst;
  13.  
  14.  
  15. BOOL CALLBACK QueryDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
  16. {
  17. switch (uMsg)
  18. {
  19. case WM_INITDIALOG:
  20. {
  21. SetWindowText(hwndDlg, QueryCaption);
  22. SetDlgItemText(hwndDlg, IDC_QUERY_TEXT, QueryText);
  23. SetDlgItemText(hwndDlg, IDC_QUERY_EDIT, QueryDst);
  24. return TRUE;
  25. }
  26. case WM_COMMAND:
  27. {
  28. switch (LOWORD(wParam))
  29. {
  30. case IDOK:
  31. {
  32. char *buf = "";
  33. GetWindowText(GetDlgItem(hwndDlg, IDC_QUERY_EDIT), buf, QueryLen);
  34. EndDialog(hwndDlg, IDOK);
  35. return TRUE;
  36. }
  37. case IDCANCEL:
  38. {
  39. EndDialog(hwndDlg, IDCANCEL);
  40. return TRUE;
  41. }
  42. }
  43. }
  44. }
  45. return FALSE;
  46. }
  47.  
  48. string InputBox(char *caption, char *text, int len)
  49. {
  50. char *dst = "";
  51. QueryCaption = caption;
  52. QueryText = text;
  53. QueryDst = dst;
  54. QueryLen = len;
  55.  
  56. DialogBoxA(0, MAKEINTRESOURCE(IDD_DLG_QUERY), 0, QueryDlgProc);
  57.  
  58. return dst;
  59. //return (DialogBox(0, MAKEINTRESOURCE(IDD_DLG_QUERY), 0, QueryDlgProc) == IDOK);
  60. }
  61.  
  62.  
  63. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement