블로그 이미지
smstock

카테고리

분류 전체보기 (54)
취미 (8)
공부 (32)
낙서장 (12)
Total
Today
Yesterday

달력

« » 2024.12
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31

공지사항

태그목록

최근에 올라온 글

메시지 박스 출력후 일정 시간 후에 자동으로 사라지게 하는 기능이 필요하면 넣으면 되겠다

#pragma once

#include <windows.h>
#include <tchar.h>

//Functions & other definitions required-->
typedef int (__stdcall *MSGBOXAAPI)(IN HWND hWnd,
         IN LPCSTR lpText, IN LPCSTR lpCaption,
         IN UINT uType, IN WORD wLanguageId, IN DWORD dwMilliseconds);
typedef int (__stdcall *MSGBOXWAPI)(IN HWND hWnd,
         IN LPCWSTR lpText, IN LPCWSTR lpCaption,
         IN UINT uType, IN WORD wLanguageId, IN DWORD dwMilliseconds);

int MessageBoxTimeoutA(IN HWND hWnd, IN LPCSTR lpText,
        IN LPCSTR lpCaption, IN UINT uType,
        IN WORD wLanguageId, IN DWORD dwMilliseconds);
int MessageBoxTimeoutW(IN HWND hWnd, IN LPCWSTR lpText,
        IN LPCWSTR lpCaption, IN UINT uType,
        IN WORD wLanguageId, IN DWORD dwMilliseconds);

#ifdef UNICODE
 #define MessageBoxTimeout MessageBoxTimeoutW
#else
 #define MessageBoxTimeout MessageBoxTimeoutA
#endif

//#define MB_TIMEDOUT 32000

int MessageBoxTimeoutA(HWND hWnd, LPCSTR lpText,
        LPCSTR lpCaption, UINT uType, WORD wLanguageId,
        DWORD dwMilliseconds)
{
 static MSGBOXAAPI MsgBoxTOA = NULL;

 if (!MsgBoxTOA)
 {
  HMODULE hUser32 = GetModuleHandle(_T("user32.dll"));
  if (hUser32)
  {
   MsgBoxTOA = (MSGBOXAAPI)GetProcAddress(hUser32,
    "MessageBoxTimeoutA");
   //fall through to 'if (MsgBoxTOA)...'
  }
  else
  {
   //stuff happened, add code to handle it here
   //(possibly just call MessageBox())
   return 0;
  }
 }

 if (MsgBoxTOA)
 {
  return MsgBoxTOA(hWnd, lpText, lpCaption,
   uType, wLanguageId, dwMilliseconds);
 }

 return 0;
}


int MessageBoxTimeoutW(HWND hWnd, LPCWSTR lpText,
        LPCWSTR lpCaption, UINT uType, WORD wLanguageId, DWORD dwMilliseconds)
{
 static MSGBOXWAPI MsgBoxTOW = NULL;

 if (!MsgBoxTOW)
 {
  HMODULE hUser32 = GetModuleHandle(_T("user32.dll"));
  if (hUser32)
  {
   MsgBoxTOW = (MSGBOXWAPI)GetProcAddress(hUser32,
    "MessageBoxTimeoutW");
   //fall through to 'if (MsgBoxTOW)...'
  }
  else
  {
   //stuff happened, add code to handle it here
   //(possibly just call MessageBox())
   return 0;
  }
 }

 if (MsgBoxTOW)
 {
  return MsgBoxTOW(hWnd, lpText, lpCaption,
   uType, wLanguageId, dwMilliseconds);
 }

 return 0;
}

Posted by smstock
, |

최근에 달린 댓글

최근에 받은 트랙백

글 보관함