🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.misc
Article #1786

Re: Dialog boxes and Icons.

#1786
From: Mancko H|glund
Date: Tue, 15 Dec 1992 06:42
57 lines
2384 bytes
In article <1992Dec11.114122.10968@ugle.unit.no> stephan@idt.unit.no (Eirik Morten Stephansen) writes:
>
>I'm developing a Windows program with a dialog box as a main window.
>Further I have 2 additional dialog boxes which I want to be icons at
>startup. 
>
>    My problem is how to get different icon for these to dialog boxes.

Register a new window class for each dialog you wish to have a 
certain icon associated wit. Then, in your .DLG file, insert
a CLASS <classname> statement for each dialog.

Like so:

void RegisterCustDlgClass()
{
    WNDCLASS wc;                    // Window class
    
    wc.style=CS_VREDRAW | CS_HREDRAW;
    wc.lpfnWndProc=AfxWndProc;
    wc.cbClsExtra=0;
    wc.cbWndExtra=DLGWINDOWEXTRA;
    wc.hInstance=AfxGetInstanceHandle();

// Insert the name of your ICON resource here-----\/
    wc.hIcon=::LoadIcon(AfxGetInstanceHandle(),"CUSTOM");
    wc.hCursor=::LoadCursor(NULL,IDC_ARROW);
    wc.hbrBackground=(HBRUSH)(COLOR_BTNFACE+1);
    wc.lpszMenuName=(LPCSTR)NULL;
    wc.lpszClassName=CUSTDLG_CLASS;

    if(RegisterClass(&wc)==FALSE)
    {
        MessageBox(NULL,"RegisterCustDlgClass() failed!",
                        AfxGetAppName(),
                        MB_ICONINFORMATION | MB_OK);
    }

In your .DLG file, do:

CUSTOM DIALOG  0,0,309,245
STYLE WS_CHILD | DS_MODALFRAME | WS_CLIPSIBLINGS | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX
CAPTION "CUSTOM"
CLASS CUSTDLG_CLASS	/* This should be the same as wc.lpszClassName */
BEGIN
   IT",WS_TABSTOP | WS_CHILD | ES_LEFT,70,43,115,8
...
END


}


+----------------------------------------------------------------------------+
v37262d@kaira.hut.fi:	Mancko H|glund 	(mancko@shsibm.shh.fi) or  
			Ebbe Jonsson	(ebbe@shsibm.shh.fi)
+----------------------------------------------------------------------------+
Technical Details
Message-ID: <1992Dec15.064255.17864@nntp.hut.fi>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!fuug!funic!nntp.hut.fi!kaira.hut.fi!v37262d
References: <1992Dec11.114122.10968@ugle.unit.no>

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.ms-windows.programmer.misc
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!fuug!funic!nntp.hut.fi!kaira.hut.fi!v37262d
From: v37262d@kaira.hut.fi (Mancko H|glund)
Subject: Re: Dialog boxes and Icons.
Message-ID: <1992Dec15.064255.17864@nntp.hut.fi>
Sender: usenet@nntp.hut.fi (Usenet pseudouser id)
Nntp-Posting-Host: kaira.hut.fi
Reply-To: ebbe@shsibm.shh.fi
Organization: Helsinki University of Technology, Finland
References: <1992Dec11.114122.10968@ugle.unit.no>
Date: Tue, 15 Dec 1992 06:42:55 GMT
Lines: 57