Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jul 1st, 2011  |  syntax: C  |  size: 0.55 KB  |  views: 55  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. void WIN_SetWMCaption(_THIS, const char *title, const char *icon)
  2. {
  3. #ifdef _WIN32_WCE
  4.         /* WinCE uses the UNICODE version */
  5.         LPWSTR lpszW = SDL_iconv_utf8_ucs2((char *)title);
  6.         SetWindowText(SDL_Window, lpszW);
  7.         SDL_free(lpszW);
  8. #else
  9.         Uint16 *lpsz = SDL_iconv_utf8_ucs2(title);
  10.         size_t len = WideCharToMultiByte(CP_ACP, 0, lpsz, -1, NULL, 0, NULL, NULL);
  11.         char *cvt = SDL_stack_alloc(char, len + 1);
  12.         WideCharToMultiByte(CP_ACP, 0, lpsz, -1, cvt, len, NULL, NULL);
  13.         SetWindowText(SDL_Window, cvt);
  14.         SDL_stack_free(cvt);
  15.         SDL_free(lpsz);
  16. #endif
  17. }
clone this paste RAW Paste Data