GetDlgItem & GetDlgItemText give a parameter error.
I used Dragons Handerror to find the error.
I used C++ to create the Dialog box template.

Here is some of the code:

IData db " ",0
IDC_TEXT equ 1004

MyDialogProc Proc hWnd:HWND, uMsg:dword, wParam:WPARAM,
lParam:LPARAM

invoke GetDlgItem, hWnd, IDC_TEXT
invoke GetDlgItemText, hWnd, IDC_TEXT, addr IData, 1

What I am trying to do is get a single letter from the user.
Also the cursor is not at the box where the user must key it in
and the box has to be clicked on first to key in the letter.

Thanks for any help
jps
Posted on 2002-03-18 03:46:15 by shankle
Jack,

Just make sure you have a matching set of equates for the ones that the VC IDE create in you asm file. If you use the direct numbers in the RC file, you can get them normally with the API calls but if you use the equates, you must also do a set fore the asm file that match those produced by the RC file. They will usually be in a seperate C header file when you create the RC file so just make a set of assembler versions for your source file.

They will be in the form,

IDC_TEXT equ <number>

In your assembler source file.

Regards,

hutch@movsd.com
Posted on 2002-03-18 03:53:59 by hutch--
I have made the #s of the IDC_ the same in the RC file and the Program file.

Got a valid code on GetDlgItem but GetDlgItemText still gives
an invalid code. Can't get any input in IData which is the byte
of input from the user.

Thanks for the reply hutch.
JPS
Posted on 2002-03-20 07:44:50 by shankle
Have you tried:


invoke GetDlgItemText, hWnd, IDC_TEXT, addr IData, 2


As the function will copy n-1 + the null terminator to the buffer, 1 - 1 = 0 + a null terminator, and it returns the number of characters copied (not including the null terminator), which in this case can be at most 0, which is incidentally the value of an error code.

Mirno
Posted on 2002-03-20 07:54:06 by Mirno
Thank you very much Mrino.

You were right that a length of 1 doesn't work on
GetDlgItemText. I changed it to 2 and all is fine.

JPS
Posted on 2002-03-20 10:34:19 by shankle