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.

56 lines
1.5 KiB

  1. //
  2. // MODULE: tsmfc.cpp
  3. //
  4. // PURPOSE: Imitate the MFC string resource functions that are not available
  5. // in Win32 programs.
  6. //
  7. // PROJECT: Local Troubleshooter Launcher for the Device Manager
  8. //
  9. // COMPANY: Saltmine Creative, Inc. (206)-633-4743 [email protected]
  10. //
  11. // AUTHOR: Richard Meadows
  12. //
  13. // ORIGINAL DATE: 2-26-98
  14. //
  15. //
  16. // Version Date By Comments
  17. //--------------------------------------------------------------------
  18. // V0.1 - RM Original
  19. ///////////////////////
  20. #include <windows.h>
  21. #include "tsmfc.h"
  22. int AfxLoadStringA(UINT nID, LPSTR lpszBuf, UINT nMaxBuf)
  23. {
  24. LPCSTR lpszName = MAKEINTRESOURCEA((nID>>4)+1);
  25. HINSTANCE hInst;
  26. int nLen = 0;
  27. // Unlike MFC, this function call is guarenteed to work.
  28. // AfxGetResourceHandle gets the handle that was passed
  29. // to DllMain().
  30. hInst = AfxGetResourceHandle();
  31. if (::FindResourceA(hInst, lpszName, (LPCSTR)RT_STRING) != NULL)
  32. nLen = ::LoadStringA(hInst, nID, lpszBuf, nMaxBuf);
  33. return nLen;
  34. }
  35. int AfxLoadStringW(UINT nID, LPWSTR lpszBuf, UINT nMaxBuf)
  36. {
  37. LPCWSTR lpszName = MAKEINTRESOURCEW((nID>>4)+1);
  38. HINSTANCE hInst;
  39. int nLen = 0;
  40. // Unlike MFC, this function call is guarenteed to work.
  41. // AfxGetResourceHandle gets the handle that was passed
  42. // to DllMain().
  43. hInst = AfxGetResourceHandle();
  44. if (::FindResourceW(hInst, lpszName, (LPCWSTR)RT_STRING) != NULL)
  45. nLen = ::LoadStringW(hInst, nID, lpszBuf, nMaxBuf);
  46. return nLen;
  47. }
  48. HINSTANCE AfxGetResourceHandle()
  49. {
  50. extern HINSTANCE g_hInst;
  51. return g_hInst;
  52. }