home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / mswindo / programm / misc / 4524 < prev    next >
Encoding:
Text File  |  1992-12-30  |  3.9 KB  |  127 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!cs.utexas.edu!torn!nott!emr1!jagrant
  3. From: jagrant@emr1.emr.ca (John Grant)
  4. Subject: problems with CTL3D.DLL
  5. Message-ID: <1992Dec31.021603.21231@emr1.emr.ca>
  6. Organization: Energy, Mines, and Resources, Ottawa
  7. Date: Thu, 31 Dec 1992 02:16:03 GMT
  8. Lines: 117
  9.  
  10. CTL3D.DLL is provided by MS on CI$ and at ftp.cica.indiana.edu
  11. (in vendors... - sorry I forget the exact location or filenames,
  12. but it was posted here recently).  It provides 3d effects for
  13. listboxes, comboboxes, etc (finishing up what they started with
  14. 3d buttons).
  15.  
  16. Problems with CTL3D.DLL
  17. -----------------------  
  18.   1. before *anything* in your app runs (i.e. even before you check for
  19.      'first instance', something in CTL3D.LIB (linked in) tries to find
  20.      CTL3D.DLL.  It appears to look in at least 3 directories:
  21.     - ...\windows
  22.     - ...\windows\system
  23.     - the application's home directory (GetModuleFileName)
  24.      (I tried placing it in each of the 3 directories to see
  25.       what it was looking for and where).
  26.  
  27.      If it can't find CTL3D.DLL, it chokes and displays:
  28.     +----------------------+
  29.     |     File Error       |
  30.     | Can't find CTL3D.DLL |
  31.     +----------------------+
  32.      and then terminates the application before it even gets a
  33.      chance to run.
  34.      
  35.      This is distinctly unfriendly! At the very least, it should
  36.      keep it's mouth shut and quietly disable itself and keep
  37.      going, but without 3d effects.  If it must check for CTL3D.DLL
  38.      it should only do it in Ctl3dRegister(), so only if *I* choose
  39.      to register it, will it croak if it can't find it.
  40.  
  41.      I had intended to set a BOOL ctl3d flag myself, if I could
  42.      find CTL3D.DLL (in either of the 3 directories I described
  43.      above), and then call the ctl3d... functions only
  44.      if ctl3d==TRUE, but it croaks before I even have a chance
  45.      to do anything.
  46.  
  47.  
  48.   2. CTL3D.DLL will only allow MessageBox to display 256 characters,
  49.      however the box is sized large enough for the entire message.
  50.      The following example works fine without CTL3D.DLL, but
  51.      with CTL3D.DLL, it truncates at 256 characters (just before
  52.      "line 17") and yet it makes the box tall enough for all 20
  53.      lines.
  54.  
  55.     MessageBox(GetFocus(),
  56.         "this is line 1\n"
  57.         "this is line 2\n"
  58.         "this is line 3\n"
  59.         "this is line 4\n"
  60.         "this is line 5\n"
  61.         "this is line 6\n"
  62.         "this is line 7\n"
  63.         "this is line 8\n"
  64.         "this is line 9\n"
  65.         "this is line 10\n"
  66.         "this is line 11\n"
  67.         "this is line 12\n"
  68.         "this is line 13\n"
  69.         "this is line 14\n"
  70.         "this is line 15\n"
  71.         "this is line 16\n"
  72.         "this is line 17\n"
  73.         "this is line 18\n"
  74.         "this is line 19\n"
  75.         "this is line 20","This is a Test",MB_OK);
  76.  
  77. If someone at MS reads this, can they please pass it on to the
  78. folks who are responsible for this product.  No, I do not use CI$.
  79.  
  80. ======================================================================
  81. For reference, here is a skeleton outline of my code for ctl3d.dll
  82.  
  83. #include <ctl3d.h>
  84.  
  85. static BOOL ctl3d=FALSE;
  86. static HINSTANCE appinst;
  87.  
  88. int PASCAL WinMain(HINSTANCE hinstance,HINSTANCE hprevinstance,
  89.                 LPSTR cmdline,int showtype)
  90. {
  91.     appinst=hinstance;      //copy to global for use everywhere
  92.  
  93.     //this is where I was going to set ctl3d TRUE/FALSE
  94.     //depending on whether or not I could find CTL3D.DLL
  95.     //but it choked before it got here!
  96.  
  97.     if(ctl3d){
  98.       Ctl3dRegister(appinst);
  99.       Ctl3dAutoSubclass(appinst);
  100.     }
  101.     
  102.     if(!hprevinstance){
  103.        if(!RegisterClasses(hinstance)) return(FALSE);
  104.     }
  105.     ...
  106.  
  107. LRESULT CALLBACK _export WndProc(HWND hwnd,UINT wm,
  108.         WPARAM wparam,LPARAM lparam)
  109. {
  110.  
  111.     switch(wm){
  112.       ...
  113.  
  114.       case WM_SYSCOLORCHANGE:if(ctl3d) Ctl3dColorChange();
  115.                  break;
  116.  
  117.       case WM_DESTROY:       if(ctl3d) Ctl3dUnregister(appinst);
  118.                  PostQuitMessage(0);
  119.                  break;
  120.       ...
  121.    }
  122. =========================================================================
  123. -- 
  124. John A. Grant                        jagrant@emr1.emr.ca
  125. Airborne Geophysics
  126. Geological Survey of Canada, Ottawa
  127.