[comp.windows.ms] Dialog Boxes

gt3070b@prism.gatech.EDU (Jeff Watkins) (08/30/90)

Well, I've been having some trouble getting the login dialog box working for
my cli.  The problem is that the edit controls do not send any messages when
I strike the enter or the tab key.  Am I setting up the styles incorrectly?

The following is a code clip from a .dlg file produced by Dialog.exe:


LOGIN DIALOG LOADONCALL MOVEABLE DISCARDABLE 11, 19, 136, 72
STYLE WS_DLGFRAME | WS_VISIBLE | WS_POPUP
BEGIN
    CONTROL "", 100, "edit", ES_LEFT | WS_BORDER | WS_TABSTOP | WS_CHILD | WS_GROUP, 56, 9, 72, 12
    CONTROL "", 106, "edit", ES_LEFT | ES_PASSWORD | WS_BORDER | WS_TABSTOP | WS_CHILD, 56, 24, 72, 12
    CONTROL "User ID", -1, "static", SS_RIGHT | WS_CHILD, 17, 11, 35, 8
    CONTROL "Password", -1, "static", SS_RIGHT | WS_CHILD, 17, 26, 35, 8
    CONTROL SHELLICON, -1, "static", SS_ICON | WS_CHILD, 6, 7, 16, 16
    CONTROL "LOGIN", 107, "button", BS_PUSHBUTTON | WS_TABSTOP | WS_CHILD, 55, 43, 29, 23
END

my dialog box function looks as follows:


BOOL FAR PASCAL	LoginProc( HWND hDlg, unsigned messg, WORD wParam, LONG lParam )
{	
	switch(messg)
	{	case WM_INITDIALOG:
			return FALSE;		
			break;

		case WM_COMMAND:
			switch (wParam)
			{	case IDOK:
				case IDC_LOGIN:
					DestroyWindow( hDlg );
					break;

				default:
					return FALSE;
			}
			break;

		default:
			return FALSE;
	}
	return TRUE;
}

So just what am I doing wrong here?  I pound on my enter and tab keys until
the springs threaten to break of, but nothing happens.  No messages are sent
to my dialog function.  (Boldface on)NO(Boldface off) messages are sent at
all!

Help!

jeff

-- 
Jeff Watkins                       gt3070b@prism.gatech.edu
Convergent Media Systems           (404) 315-0105 voice  (404) 315-0231 data
"I speak for no-one. AND NO-ONE SPEAKS FOR ME... oh, yes, _dear_...I gotta go..."

patrickd@chinet.chi.il.us (Patrick Deupree) (08/30/90)

In article <13163@hydra.gatech.EDU> gt3070b@prism.gatech.EDU (Jeff Watkins) writes:
[Sample of Dialog Box script that looked fine]
[Sample of Dialog code that looks sorta fine]

>So just what am I doing wrong here?  I pound on my enter and tab keys until
>the springs threaten to break of, but nothing happens.  No messages are sent
>to my dialog function.  (Boldface on)NO(Boldface off) messages are sent at
>all!

Here's the part where I ask my stupid question.  When you bring up the
dialog box do you have the following code in your program:

             lpProc<dlg proc name> = MakeProcInstance(<dlg proc name>, hInst);
             DialogBox(hInst, "<Dialog Resource>", hWnd, lpProc<dlg proc name>);
             FreeProcInstance(lpProc<dlg proc name>);

If not, it would be a definite problem (I'm especiallly referring to the
first line).  Actually, I can't think of a way you'd bring up the dialog
without this, but I'm checking.

The next question regards the constants.  You posted dialog resource code
that had a 107 for the button you were using and in the code you refered
to IDC_PASSWD (or something like that).  I'm going on the assumption that
these are the same value.  One other tip here is that you should use
EndDialog, not DestroyDialog.  This would have nothing to do with you're
not getting any messages, however.  Next tip, make sure that your .DEF file
contains the dialog proc name in it's EXPORTS section.

I think that covers just about anything that could go wrong.
-- 
"What's in a name?  That which we call a rose by any other name would smell
 as sweet."             William Shakespeare
Patrick Deupree ->	patrickd@chinet.chi.il.us
			Business Phone: (708) 328-3800