::: µ¨ÆÄÀÌ Tip&Trick :::

µ¨ÆÄÀÌ Tip&Trick ¼º°Ý¿¡ ¸ÂÁö ¾Ê´Â ±¤°í,ºñ¹æ,Áú¹®ÀÇ ±ÛÀº Áï½Ã »èÁ¦Çϸç
³»¿ëÀ» º¹»çÇÏ¿© »ç¿ëÇÒ °æ¿ì ¹Ýµå½Ã ÀÌ°÷(http://www.howto.pe.kr)À» Ãâó·Î ¸í½ÃÇÏ¿© ÁÖ¼¼¿ä


Category

  ±¸Ã¢¹Î(2003-03-14 12:27:37, Hit : 14122, Vote : 1389
 http://www.delphi.pe.kr
 'ÀÀ´ä¾øÀ½' ÇÁ·Î¼¼¼­¸¦ °¨ÁöÇÏ´Â À볪´Â ¹æ¹ý

[ÆÁ]'ÀÀ´ä¾øÀ½' ÇÁ·Î¼¼¼­¸¦ °¨ÁöÇÏ´Â À볪´Â ¹æ¹ý

¾È³çÇϼ¼¿©~ ºÒ¸êÀÇ È­»ó ±¸Ã¢¹ÎÀÔ´Ï´Ù.

ÀÀ´ä¾øÀ½ ÇÁ·Î¼¼¼­¸¦ °¨ÁöÇÏ´Â À볪´Â ¹æ¹ýÀÌ Àֳ׿©

Ç×»ó Áñ°Å¿î ÇÁ·Î±×·¡¹Ö ÇϽñæ~~

// 1. The Documented way

{
  An application can check if a window is responding to messages by
  sending the WM_NULL message with the SendMessageTimeout function.

  Um zu überprüfen, ob ein anderes Fenster (Anwendung) noch reagiert,
  kann man ihr mit der SendMessageTimeout() API eine WM_NULL Nachricht schicken.
}

function AppIsResponding(ClassName: string): Boolean;
const
  { Specifies the duration, in milliseconds, of the time-out period }
  TIMEOUT = 50;
var
  Res: DWORD;
  h: HWND;
begin
  h := FindWindow(PChar(ClassName), nil);
  if h <> 0 then
    Result := SendMessageTimeOut(H,
      WM_NULL,
      0,
      0,
      SMTO_NORMAL or SMTO_ABORTIFHUNG,
      TIMEOUT,
      Res) <> 0
  else
    ShowMessage(Format('%s not found!', [ClassName]));
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  if AppIsResponding('OpusApp') then
    { OpusApp is the Class Name of WINWORD }
    ShowMessage('App. responding');
end;

// 2. The Undocumented way

{
  // Translated form C to Delphi by Thomas Stutz
  // Original Code:
  // (c)1999 Ashot Oganesyan K, SmartLine, Inc
  // mailto:ashot@aha.ru, http://www.protect-me.com, http://www.codepile.com

The code doesn't use the Win32 API SendMessageTimout function to
determine if the target application is responding but calls
undocumented functions from the User32.dll.

--> For NT/2000/XP the IsHungAppWindow() API:

The function IsHungAppWindow retrieves the status (running or not responding)
of the specified application

IsHungAppWindow(Wnd: HWND): // handle to main app's window
BOOL;

--> For Windows 95/98/ME we call the IsHungThread() API

The function IsHungThread retrieves the status (running or not responding) of
the specified thread

IsHungThread(DWORD dwThreadId): // The thread's identifier of the main app's window
BOOL;

Unfortunately, Microsoft doesn't provide us with the exports symbols in the
User32.lib for these functions, so we should load them dynamically using the
GetModuleHandle and GetProcAddress functions:
}

// For Win9X/ME
function IsAppRespondig9X(dwThreadId: DWORD): Boolean;
type
  TIsHungThread = function(dwThreadId: DWORD): BOOL; stdcall;
var
  hUser32: THandle;
  IsHungThread: TIsHungThread;
begin
  Result := True;
  hUser32 := GetModuleHandle('user32.dll');
  if (hUser32 > 0) then
  begin
    @IsHungThread := GetProcAddress(hUser32, 'IsHungThread');
    if Assigned(IsHungThread) then
    begin
      Result := not IsHungThread(dwThreadId);
    end;
  end;
end;

// For Win NT/2000/XP
function IsAppRespondigNT(wnd: HWND): Boolean;
type
  TIsHungAppWindow = function(wnd:hWnd): BOOL; stdcall;
var
  hUser32: THandle;
  IsHungAppWindow: TIsHungAppWindow;
begin
  Result := True;
  hUser32 := GetModuleHandle('user32.dll');
  if (hUser32 > 0) then
  begin
    @IsHungAppWindow := GetProcAddress(hUser32, 'IsHungAppWindow');
    if Assigned(IsHungAppWindow) then
    begin
      Result := not IsHungAppWindow(wnd);
    end;
  end;
end;

function IsAppRespondig(Wnd: HWND): Boolean;
begin
if not IsWindow(Wnd) then
begin
   ShowMessage('Incorrect window handle!');
   Exit;
end;
if Win32Platform = VER_PLATFORM_WIN32_NT then
   Result := IsAppRespondigNT(wnd)
else
   Result := IsAppRespondig9X(GetWindowThreadProcessId(Wnd,nil));
end;

// Example: Check if Word is hung/responding

procedure TForm1.Button3Click(Sender: TObject);
var
  Res: DWORD;
  h: HWND;
begin
  // Find Winword by classname
  h := FindWindow(PChar('OpusApp'), nil);
  if h <> 0 then
  begin
    if IsAppRespondig(h) then
      ShowMessage('Word is responding!')
    else
      ShowMessage('Word is not responding!');
  end
  else
    ShowMessage('Word is not open!');
end;










731   [COM/OLE] ¶°ÀÖ´Â ¸ðµç Microsoft Internet Explorer ÀÇ html ºÒ·¯¿À±â  ±è¿µ´ë 2003/03/30 6138 1489
730   [À©µµ¿ìÁî API] IEÀÇ "Áñ°Üã±â ±¸¼º" È­¸é ¶ç¿ì±â  ±è¿µ´ë 2003/03/30 6176 1956
729   [À©µµ¿ìÁî API] µ¥½ºÅ©Å¾ÀÇ ÇöÀç Ä¿¼­À§Ä¡ÀÇ Å¸ÀÌƲ¸í°ú Ŭ·¡½º¸í ±¸ÇÏ±â  ±è¿µ´ë 2003/03/29 4815 1192
728   [À©µµ¿ìÁî API] ¶°ÀÖ´Â ¸ðµç Microsoft Internet Explorer Á×ÀÌ±â  ±è¿µ´ë 2003/03/29 5069 1395
727   [½Ã½ºÅÛ] À©µµ¿ìÁî ÀüüÀÇ ¸¶¿ì½º/Å°º¸µå ÀÔ·Â ±ÝÁö  ±è¿µ´ë 2003/03/29 5645 1399
726   [³×Æ®¿÷/ÀÎÅͳÝ] ÀÎÅͳݿ¡ Á¢¼ÓµÇ¾î ÀÖ´ÂÁö °Ë»çÇÏ±â  ±è¿µ´ë 2003/03/29 5618 1342
725   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] TMemo ½ºÅ©·Ñ ´Ù¿î ½ÃÅ°±â  ±è¿µ´ë 2003/03/29 5003 1408
724   [À©µµ¿ìÁî API] Àüü È­¸é(Full Screen) ¸¸µé±â  ±è¿µ´ë 2003/03/29 5461 1374
723   [À©µµ¿ìÁî API] "½ÃÀÛ"->"ÇÁ·Î±×·¥" ¸Þ´º¿¡ Æú´õ Ãß°¡ÇÏ±â  ±è¿µ´ë 2003/03/29 5234 1314
722   [À©µµ¿ìÁî API] ÆûÀÌ Minimized µÇ¾úÀ»¶§ ±ô¹ÚÀÌ°Ô ÇÏ±â  ±è¿µ´ë 2003/03/29 6632 1707
721   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ListBox¿¡¼­ ¸¶¿ì½º À̵¿½Ã ¾ÆÀÌÅÛÀ» ÈùÆ®·Î º¸¿©ÁÖ±â  ±è¿µ´ë 2003/03/27 4433 1160
720   [½Ã½ºÅÛ] DOS ¸í·É¾î ½ÇÇàÇÏ°í °á°ú ¹Þ¾Æ¿À±â  ±è¿µ´ë 2003/03/27 5611 1340
719   [À©µµ¿ìÁî API] ¾×Ƽºê µ¥½ºÅ©Å¾¿¡ À¥ ÄÁÅÙÆ®°¡ Ç¥½ÃÁßÀÎÁö ¾Ë±â  ±è¿µ´ë 2003/03/27 4650 1255
718   [À©µµ¿ìÁî API] ÀÛ¾÷Ç¥½ÃÁÙÀÇ ½Ã°è °¨Ãß±â/º¸ÀÌ±â  ±è¿µ´ë 2003/03/27 7682 2048
717   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] Ä¿¼­(Cursor)ÀÇ À̹ÌÁö ±¸ÇÏ±â  ±è¿µ´ë 2003/03/27 4856 1338
716   [À©µµ¿ìÁî API] ½ºÅ©¸° ¼¼À̹ö On/Off  ±è¿µ´ë 2003/03/27 4396 1083
715   [À©µµ¿ìÁî API] ÈÞÁöÅë ºñ¿ì±â  ±è¿µ´ë 2003/03/27 5663 1385
714   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] IE Toolbar ¿¡ ¹öÆ° ¿Ã¸®±â  ±è¿µ´ë 2003/03/26 12724 1262
713   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ±âº» Popup Memu ¶ç¿ìÁö ¾Ê±â  ±è¿µ´ë 2003/03/26 3998 1045
712   [À©µµ¿ìÁî API] "Àӽà ÀÎÅÍ³Ý ÆÄÀÏ" ÀüºÎ Áö¿ì±â  ±è¿µ´ë 2003/03/26 5635 1307
711   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ¼³Ä¡µÈ ¸ðµç ÇÁ·Î±×·¥ Àоî¿À±â  ±è¿µ´ë 2003/03/26 5897 1520
710   [µ¥ÀÌÅͺ£À̽º] DBGrid ÀÇ ÇöÀç Ä¿¼­ÀÇ Çà/¿­ ±¸ÇÏ±â  ±è¿µ´ë 2003/03/26 5549 1315
709   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] INF ÆÄÀÏ ¼³Ä¡ÇÏ±â  ±è¿µ´ë 2003/03/26 5508 1340
708   [µ¥ÀÌÅͺ£À̽º] BDE Alias ¾øÀÌ Database µ¿ÀûÀ¸·Î ¿¬°áÇÏ±â  ½ÅÈÆÀç 2003/03/24 13057 1192
707   [COM/OLE] Win2k, Win Xp - Active X - Dax error : Access violationÇØ°á(IE»ó¿¡¼­)  ½ÅÈÆÀç 2003/03/20 14717 1292
706   [µ¥ÀÌÅͺ£À̽º] ORA-12571: TNS:packet writer failure  ±è¿µ´ë 2003/03/19 9969 1414
705   [µ¥ÀÌÅͺ£À̽º] DBGrid ÀÇ ¸ðµç Row ¸¦ Select ½ÃÅ°±â(SelectAll)  ±è¿µ´ë 2003/03/18 4616 1078
704   [µ¥ÀÌÅͺ£À̽º] index fileÀÇ °¹¼ö¿Í ¼º´É ¹®Á¦  ±è¿µ´ë 2003/03/17 5535 1413
703   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ListView¿¡ È®ÀåÀÚº° ¾ÆÀÌÄÜ ³Ö±â  ½ÅÈÆÀç 2003/03/15 7341 1240
702   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ScrollBox ¿¡ ¹è°æ±×¸² ³Ö±â  ±è¿µ´ë 2003/03/14 4272 1129
  [½Ã½ºÅÛ] 'ÀÀ´ä¾øÀ½' ÇÁ·Î¼¼¼­¸¦ °¨ÁöÇÏ´Â À볪´Â ¹æ¹ý  ±¸Ã¢¹Î 2003/03/14 14122 1389
700   [À©µµ¿ìÁî API] ÀÔ·ÂÀ» ±â´Ù¸®´Â Ç®½ºÅ©¸° ÄÜ¼Ö À©µµ¿ì ¸¸µé¾î º¸±â  ±¸Ã¢¹Î 2003/03/14 6859 1205
699   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ƯÁ¤ ·¹Áö½ºÆ®¸® Å° ÀÇ ¸ðµç ¸ñ·ÏÀ» Çѹ濡! Àоî¿À±â  ±¸Ã¢¹Î 2003/03/14 5358 993
698   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] Æ®·¹ÀÌ ¾ÆÀÌÄÜ¿¡ dz¼± ÈùÆ® º¸¿©ÁÖ±â  ±¸Ã¢¹Î 2003/03/14 7371 1423
697   [À©µµ¿ìÁî API] ¿ÜºÎ ÇÁ·Î±×·¥ÀÇ »óÅÂÇ¥½ÃÁÙÀÇ Text °¡Á®¿À±â  ±¸Ã¢¹Î 2003/03/14 6470 1461
696   [½Ã½ºÅÛ] IP Address À©µµ¿ì ÆûÀ§¿¡ ¸¸µé¾îº¸±â  ±¸Ã¢¹Î 2003/03/14 5977 1317
695   [½Ã½ºÅÛ] ƯÁ¤ DLL ÀÇ ÇÔ¼ö¸ñ·ÏÀ» ±¸Çغ¸ÀÚ.  ±¸Ã¢¹Î 2003/03/14 6075 1272
694   [½Ã½ºÅÛ] ¾²·¹µå ³»¿¡¼­ ÆûÀ» »ý¼ºÇغ¸ÀÚ  ±¸Ã¢¹Î 2003/03/14 6148 1249
693   [À©µµ¿ìÁî API] ¿ÜºÎ ÇÁ·Î±×·¥ ¸ð´Þ âó·³ ¶ç¿ö¼­ Á¾·áµÉ¶§ ±â´Ù¸®±â(½ÃÁ¡ ¾Ë±â)  ±¸Ã¢¹Î 2003/03/14 6014 1299
692   [ÀϹÝ/ÄÄÆ÷³ÍÆ®] ÄÄÆ÷³ÍÆ®¿¡ ¿ÀÇ´ÙÀ̾ó·Î±×¸¦ ¶ç¿ì´Â ¼Ó¼º ¸¸µå´Â ¹æ¹ý  ±¸Ã¢¹Î 2003/03/14 4237 1051

[1][2][3][4][5][6] 7 [8][9][10]..[25] [´ÙÀ½ 10°³]
 

Copyright 1999-2024 Zeroboard / skin by zero