Hey, thank you tabstop buddy for the help. Although my objective here was
not to assign the returns to the array, but to what the array points to.
I think a pointer and subscript, in many instances, can become confusing
if the array becomes to large or if you have many arrays. Of course one
could just use a #define statement to clarify the array like so:
Code:
#define HWNDAPPLES1 1
#define HWNDORANGES2 2
#define HWNDPEACHES3 3
//...#define HWNDUNIQUENAME 100
char Info[11];
int x[] ={0, 0, 0};
int y[] ={50,100,150};
int nWidth[] ={50,50, 50};
int nHeight[]={20,20, 20};
HWND phWnd[3];
switch (message) /* handle the messages */
{
case WM_CREATE:
for(int makeWin=0; makeWin < 3; makeWin++)
{
hMenu[makeWin]=(HMENU)makeWin;
pHwnd[makeWin]=CreateWindowEx(0,
"Edit",
"",
WS_CHILD|WS_VISIBLE,
x[makeWin],
y[makeWin],
nWidth[makeWin],
nHeight[makeWin],
hwnd,
(HMENU)makeWin+1,
NULL,
NULL
);
}
break;
case WM_COMMAND:
if(LOWORD(wParam)==GetDlgCtrlID(pHwnd[HWNDAPPLES1]) )
{
GetDlgItemText(hwnd, GetDlgCtrlID(pHwnd[HWNDAPPLES1]), Info, 10);
}
if(LOWORD(wParam)==GetDlgCtrlID(pHwnd[HWNDORANGES2]) )
{
GetDlgItemText(hwnd, GetDlgCtrlID(pHwnd[HWNDORANGES2]), Info, 10);
}
break;
This approach of identifying the contents of an array with a unique constant is fine,
but I still would like to know an approach simular to the one I have mentioned.
As a novice - it seems that if one can do this :
Code:
HWND hWnd = CreateWindowEx(...);
Then one ought to be able to do something --- approximate --- to this:
(keep in mind, good people, that I don't know the proper syntax,
and that was the very point to this post)
Code:
HWND hWnd;
HWND *phWnd=&hWnd;
phWnd = CreateWindowEx(...);
It seems to me that the contents of phWnd(namely hWnd) needs to receive
a value in order to be useful. For Instance a variable of type int is virtually useless
unless it has at least some value. Therefore if in the C++ language it is possible to
assign hWnd to phWnd then it must be possible to assign a value to
this very samehWnd. I simply want to know how to assign a value to hWnd in
this manner - this is the main purpose of this post.
Also, as I said before it seems that a good programmer would want to make their
variables as clear as possible. It seems to me, as a novice, that an array -- having
only one name and subscript which is unique through it's number -- would not be
clear enough if the array were to large or if there were many such arrays. It seems
that it can become necessary to give the elements of such an array a - unique name -
rather than just refer to the elements only by number.
Thank you Greenhorn__ for your reply.
THANK you to all who read this and even more so to those who answer my question.