http://pbdc.cafe24.com 발췌
/*
설명 : 파워빌더에서 API 를 사용하여 현재 OS 의
      Process 를 읽어 들이는 로직입니다.
*/

// Declare External Function
/*
Function Long GetWindow(long hWnd , long wCmd ) Library "User32"
Function Long GetWindowLong(long hWnd , long wIndx ) Library "User32" Alias For "GetWindowLongA"
Function Long GetWindowText(long hWnd, ref string lpSting, long nMaxCount) Library "User32" Alias For "GetWindowTextA"
Function Long GetWindowTextLength(long hWnd ) Library "User32" Alias  For "GetWindowTextLengthA"

Function Name                 : of_GetProcess
Arguments                  : Long   al_whandle
                        : Ref String as_title[]
                        : Ref String as_handle[]
Return                 : -

ulong                 GW_HWNDFIRST=0
ulong                 GW_HWNDNEXT =2
ulong                 GWL_STYLE = -16
*/

// Script
Long     ll_hwCurr
Long     ll_hwme
Long     ll_intLen
Long     ll_active
Long     ll_lngStyle
Long     ll_pointer

String   ls_strTitle
String   ls_TaskTitle[]
String   ls_TaskHandle[]
  

// Firt Task Window GET
ll_hwCurr = GetWindow(al_whandle, GW_HWNDFIRST)  

// Current Window Handle
ll_hwme = al_whandle

// All Task Window Loop
DO WHILE ll_hwCurr > 0
                //mle_memory.text += String(ll_hwCurr) +'~r~n'
                // Window Style
                ll_lngStyle = GetWindowLong(ll_hwCurr, GWL_STYLE)
                ll_active = ll_lngStyle

                // Current Handle <> Fetch Handle AND Window Style > 0
                IF ll_hwCurr <> ll_hwme AND ll_active > 0 THEN

                                // Window Text Length
                                ll_intLen   = GetWindowTextLength(ll_hwCurr) + 1
                                ls_strTitle = Space(ll_intLen)

                                // Window Text GET
                                ll_intLen   = GetWindowText(ll_hwCurr,ls_strTitle,ll_intLen)

                                                // Exists Task Window
                                                IF ll_intLen > 0 THEN
                                                                 ll_pointer++
                                                                 as_title[ll_pointer]  = ls_strTitle
                                                                 as_handle[ll_pointer] = String(ll_hwCurr)

                                                END IF
                 END IF

                 // Feth Task Window
                 ll_hwCurr = GetWindow(ll_hwCurr, GW_HWNDNEXT)

LOOP

RETURN 1  
Posted by 민서정
l