Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.1 KiB

  1. //+----------------------------------------------------------------------------
  2. //
  3. // File: image.cpp
  4. //
  5. // Module: CMAK.EXE
  6. //
  7. // Synopsis: Image support routines for displaying the custom graphics
  8. //
  9. // Copyright (c) 1998-1999 Microsoft Corporation
  10. //
  11. // Author: nickball Created Header 03/30/98
  12. // quintinb copied from cmdial 08/04/98
  13. //
  14. //+----------------------------------------------------------------------------
  15. #include "cmmaster.h"
  16. #ifndef UNICODE
  17. #define GetWindowLongU GetWindowLongPtrA
  18. #define SetWindowLongU SetWindowLongPtrA
  19. #define DefWindowProcU DefWindowProcA
  20. #else
  21. #define GetWindowLongU GetWindowLongPtrW
  22. #define SetWindowLongU SetWindowLongPtrW
  23. #define DefWindowProcU DefWindowProcW
  24. #endif
  25. const TCHAR* const c_pszCmakBmpClass = TEXT("Connection Manager Administration Kit Bitmap Window Class");
  26. //
  27. // Include the shared bitmap handling code.
  28. //
  29. #include "bmpimage.cpp"
  30. //+----------------------------------------------------------------------------
  31. //
  32. // Function: RegisterBitmapClass
  33. //
  34. // Synopsis: Helper function to encapsulate registration of our bitmap class
  35. //
  36. // Arguments: HINSTANCE hInst - HINSTANCE to associate registration with
  37. //
  38. // Returns: DWORD - error code
  39. //
  40. // History: nickball Created Header 2/9/98
  41. //
  42. //+----------------------------------------------------------------------------
  43. DWORD RegisterBitmapClass(HINSTANCE hInst)
  44. {
  45. //
  46. // Register Bitmap class
  47. //
  48. WNDCLASS wcClass;
  49. ZeroMemory(&wcClass,sizeof(wcClass));
  50. wcClass.lpfnWndProc = BmpWndProc;
  51. wcClass.cbWndExtra = sizeof(HBITMAP) + sizeof(LPBITMAPINFO);
  52. wcClass.hInstance = hInst;
  53. wcClass.lpszClassName = c_pszCmakBmpClass;
  54. if (!RegisterClass(&wcClass))
  55. {
  56. DWORD dwError = GetLastError();
  57. CMTRACE1(TEXT("RegisterBitmapClass() RegisterClass() failed, GLE=%u."), dwError);
  58. //
  59. // Only fail if the class does not already exist
  60. //
  61. if (ERROR_CLASS_ALREADY_EXISTS != dwError)
  62. {
  63. return dwError;
  64. }
  65. }
  66. return ERROR_SUCCESS;
  67. }