Obtain text from EDITTEXT

Hello, I am a bit new to GUI programming...I am currently using code::blocks to build everything manually here. I have two dialogs, one in which I need to get whatever is typed in stored to a string, or variable, but i am unable to pull the information from the EDITTEXT box. I get an error message about invalid conversion of int to hwnd.

I am using : GetDlgItemText(DLG_SETS, IDC_SETS1, stringVariable, sizeof(stringVariable)); to try and get the value of the EDITTEXT box from the DLG_SETS dialog.

I will list my source code in the following order:
main.cpp | resource.rc | resource.h

[main.cpp]

#define WIN32_LEAN_AND_MEAN

#include <windows.h>
#include <stdio.h>
#include <string.h>


#include "resource.h"
using namespace std;

/* !>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>
! TODO LIST:
|
| 1. DLG_SETS1 variables to file (encoded)
| 2. Utilize DLG_SETS1 variables to login to tools.bisc.cv site
| 3. Create HTML Scraper to grab and display data
| 4. API Hook to OMNI? AUTOPOLL INFO HURRAH!
|
!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>!>

*/


HINSTANCE hInst;


BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
int MAX_EXPECTED_SIZE = 20;
char stringVariable[MAX_EXPECTED_SIZE];

switch(uMsg)
{
case WM_INITDIALOG:
/*
* TODO: Add code to initialize the dialog.
*/
return TRUE;

case WM_CLOSE:
EndDialog(hwndDlg, 0);
return TRUE;

case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_BTN_QUIT:
EndDialog(hwndDlg, 0);
return TRUE;

case IDC_BTN_TEST:
MessageBox(hwndDlg, "You clicked \"Test\" button!", "Information", MB_ICONINFORMATION);
return TRUE;

case IDC_SETS1:
/*
* TODO: Add code to initialize the dialog.
*/
return TRUE;

case IDC_SETSBTN:
/* --> Load Sets Dialog <-- */
return DialogBox(hInst, MAKEINTRESOURCE(DLG_SETS), NULL, DialogProc);

return TRUE;

case IDC_EDIT1:
/*
* TODO: Add code to initialize the dialog.
*/
return TRUE;

case IDC_GETACCT:
/*
* TODO: Add code to initialize the dialog.
*/
return TRUE;

case IDC_SAVESETS:
GetDlgItemText(DLG_SETS, IDC_SETS1, stringVariable, sizeof(stringVariable));

return TRUE;


}
}

return FALSE;
}


int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
// The user interface is a modal dialog box
return DialogBox(hInstance, MAKEINTRESOURCE(DLG_MAIN), NULL, DialogProc);
}


------------------------------------------
[resource.rc]

#include "resource.h"

DLG_MAIN DIALOG DISCARDABLE 0, 0, 239, 200
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "IniTech Tools"
FONT 8, "MS Sans Serif"


// 1st: unknown | 2nd: horizontal | 3rd: vertical | 4th: height |

BEGIN
LTEXT "Acct:", -1, 2, 3, 45, 8
CONTROL "&Test", IDC_BTN_TEST, "Button", 0x10010000, 138, 5, 46, 15
CONTROL "&Quit", IDC_BTN_QUIT, "Button", 0x10010000, 138, 29, 46, 15
EDITTEXT IDC_EDIT1,/*horizontal*/20, /*vertical*/3,/*width*/55, 10, 18,ES_AUTOHSCROLL
CONTROL "&GET", IDC_GETACCT, "Button", 0x10010000, /*horizontal*/78, /*vertical*/3, /*width*/ 22, /*height*/ 10
CONTROL "&SETTINGS", IDC_SETSBTN, "Button", 0x10010000, /*horizontal*/200, /*vertical*/3, /*width*/ 38, /*height*/ 10

END

//
// User Settings Dialog
//

DLG_SETS DIALOG DISCARDABLE 20, 60, 239, 200
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "IniTech Tools - Settings"
FONT 8, "MS Sans Serif"


// 1st: unknown | 2nd: horizontal | 3rd: vertical | 4th: height |

BEGIN
LTEXT "Bounce:", -1, 2, 3, 45, 8
EDITTEXT IDC_SETS1,/*horizontal*/30, /*vertical*/3,/*width*/55, 10, 18,ES_AUTOHSCROLL
// CONTROL "&GET", IDC_GETACCT, "Button", 0x10010000, /*horizontal*/78, /*vertical*/3, /*width*/ 22, /*height*/ 10
LTEXT "KDB:", -1, 2, 16, 45, 8
//EDITTEXT IDC_SETS2,/*horizontal*/30, /*vertical*/15,/*width*/55, 10, 18,ES_AUTOHSCROLL
// CONTROL "&GET", IDC_GETACCT, "Button", 0x10010000, /*horizontal*/78, /*vertical*/3, /*width*/ 22, /*height*/ 10
LTEXT "Bnce:", -1, 2, 27, 45, 8
//EDITTEXT IDC_SETS3,/*horizontal*/30, /*vertical*/27,/*width*/55, 10, 18,ES_AUTOHSCROLL
// CONTROL "&GET", IDC_GETACCT, "Button", 0x10010000, /*horizontal*/78, /*vertical*/3, /*width*/ 22, /*height*/ 10
CONTROL "&Quit", IDC_BTN_QUIT, "Button", 0x10010000, 138, 29, 46, 15
CONTROL "&Save", IDC_SAVESETS, "Button", 0x10010000, 138, 45, 46, 15
END

-----------------------------------------------
[resource.h]

#include <windows.h>

// ID of Main Dialog
#define DLG_MAIN 101
#define DLG_SETS 102

// ID of Button Controls
#define IDC_BTN_TEST 1001
#define IDC_BTN_QUIT 1002
#define IDC_EDIT1 1003
#define IDC_GETACCT 1004
#define IDC_SETS1 1005
#define IDC_SETSBTN 1006
#define IDC_SAVESETS 1007
Topic archived. No new replies allowed.