home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / os / mswindo / programm / misc / 4224 < prev    next >
Encoding:
Text File  |  1992-12-15  |  2.3 KB  |  71 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!mcsun!fuug!funic!nntp.hut.fi!kaira.hut.fi!v37262d
  3. From: v37262d@kaira.hut.fi (Mancko H|glund)
  4. Subject: Re: Dialog boxes and Icons.
  5. Message-ID: <1992Dec15.064255.17864@nntp.hut.fi>
  6. Sender: usenet@nntp.hut.fi (Usenet pseudouser id)
  7. Nntp-Posting-Host: kaira.hut.fi
  8. Reply-To: ebbe@shsibm.shh.fi
  9. Organization: Helsinki University of Technology, Finland
  10. References: <1992Dec11.114122.10968@ugle.unit.no>
  11. Date: Tue, 15 Dec 1992 06:42:55 GMT
  12. Lines: 57
  13.  
  14. In article <1992Dec11.114122.10968@ugle.unit.no> stephan@idt.unit.no (Eirik Morten Stephansen) writes:
  15. >
  16. >I'm developing a Windows program with a dialog box as a main window.
  17. >Further I have 2 additional dialog boxes which I want to be icons at
  18. >startup. 
  19. >
  20. >    My problem is how to get different icon for these to dialog boxes.
  21.  
  22. Register a new window class for each dialog you wish to have a 
  23. certain icon associated wit. Then, in your .DLG file, insert
  24. a CLASS <classname> statement for each dialog.
  25.  
  26. Like so:
  27.  
  28. void RegisterCustDlgClass()
  29. {
  30.     WNDCLASS wc;                    // Window class
  31.     
  32.     wc.style=CS_VREDRAW | CS_HREDRAW;
  33.     wc.lpfnWndProc=AfxWndProc;
  34.     wc.cbClsExtra=0;
  35.     wc.cbWndExtra=DLGWINDOWEXTRA;
  36.     wc.hInstance=AfxGetInstanceHandle();
  37.  
  38. // Insert the name of your ICON resource here-----\/
  39.     wc.hIcon=::LoadIcon(AfxGetInstanceHandle(),"CUSTOM");
  40.     wc.hCursor=::LoadCursor(NULL,IDC_ARROW);
  41.     wc.hbrBackground=(HBRUSH)(COLOR_BTNFACE+1);
  42.     wc.lpszMenuName=(LPCSTR)NULL;
  43.     wc.lpszClassName=CUSTDLG_CLASS;
  44.  
  45.     if(RegisterClass(&wc)==FALSE)
  46.     {
  47.         MessageBox(NULL,"RegisterCustDlgClass() failed!",
  48.                         AfxGetAppName(),
  49.                         MB_ICONINFORMATION | MB_OK);
  50.     }
  51.  
  52. In your .DLG file, do:
  53.  
  54. CUSTOM DIALOG  0,0,309,245
  55. STYLE WS_CHILD | DS_MODALFRAME | WS_CLIPSIBLINGS | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX
  56. CAPTION "CUSTOM"
  57. CLASS CUSTDLG_CLASS    /* This should be the same as wc.lpszClassName */
  58. BEGIN
  59.    IT",WS_TABSTOP | WS_CHILD | ES_LEFT,70,43,115,8
  60. ...
  61. END
  62.  
  63.  
  64. }
  65.  
  66.  
  67. +----------------------------------------------------------------------------+
  68. v37262d@kaira.hut.fi:    Mancko H|glund     (mancko@shsibm.shh.fi) or  
  69.             Ebbe Jonsson    (ebbe@shsibm.shh.fi)
  70. +----------------------------------------------------------------------------+
  71.