MessageBox with Timeout ?

MessageBox with Timeout ?

Postby Jimmy » Thu Dec 15, 2022 4:53 pm

hi,

does Fivewin have a MessageBox with Timeout :?:


how to "translate" this HMG CODE
Code: Select all  Expand view
#define ID_TIMEDOUT 32000

int WINAPI MessageBoxTimeout (HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType, WORD wLanguageId, DWORD dwMilliseconds)
{
   typedef BOOL (WINAPI *PMessageBoxTimeout)(HWND,LPCTSTR,LPCTSTR,UINT,WORD,DWORD);
_THREAD_LOCK();
   static PMessageBoxTimeout pMessageBoxTimeout = NULL;
   if (pMessageBoxTimeout == NULL)
   {
      HMODULE hLib = LoadLibrary (_TEXT("User32.dll"));
      #ifdef UNICODE
         pMessageBoxTimeout = (PMessageBoxTimeout)GetProcAddress(hLib, "MessageBoxTimeoutW");
      #else
         pMessageBoxTimeout = (PMessageBoxTimeout)GetProcAddress(hLib, "MessageBoxTimeoutA");
      #endif
   }
_THREAD_UNLOCK();
   if(pMessageBoxTimeout == NULL)
      return FALSE;
   return pMessageBoxTimeout(hWnd, lpText, lpCaption, uType, wLanguageId, dwMilliseconds);
}

//       HMG_MessageBoxTimeout (cText, cCaption, nTypeIconButton, nMilliseconds) ---> Return nRetValue
HB_FUNC (HMG_MESSAGEBOXTIMEOUT)
{
   HWND  hWnd           = GetActiveWindow();
   TCHAR *lpText        = (TCHAR *) HMG_parc (1);
   TCHAR *lpCaption     = (TCHAR *) HMG_parc (2);
   UINT  uType          = HB_ISNIL(3) ? MB_OK : (UINT) hb_parnl (3);
   WORD  wLanguageId    = MAKELANGID (LANG_NEUTRAL, SUBLANG_NEUTRAL);
   DWORD dwMilliseconds = HB_ISNIL(4) ? (DWORD)0xFFFFFFFF  : (DWORD) hb_parnl (4);
   int iRet = MessageBoxTimeout (hWnd, lpText, lpCaption, uType, wLanguageId, dwMilliseconds);
   hb_retni ((int) iRet);
}
 
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: MessageBox with Timeout ?

Postby Horizon » Thu Dec 15, 2022 5:18 pm

Like this?

Code: Select all  Expand view
Shows a DialogBox with a msg and waits some time
Syntax:
 MsgWait( <cMsg> [,<cTitle>], [<nSeconds>] ) --> nil  
 
Parameters:

 <cMsg> The message to display  
  <cTitle> The title of the dialogbox. By default "Please, wait..."  
  <nSeconds> The time in seconds to wait. By default just waits 4 seconds. MsgWait() will automatically end the DialogBox that appears.  

 
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Re: MessageBox with Timeout ?

Postby Jimmy » Thu Dec 15, 2022 5:29 pm

hi,
Horizon wrote:Like this?
Code: Select all  Expand view
 MsgWait( <cMsg> [,<cTitle>], [<nSeconds>] ) --> nil  

Yes, this will do the Job, thx
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 82 guests