본문 바로가기
PowerBuilder

파워빌더 함수 - 1 (A~D)

by 엔터티 2021. 6. 7.
반응형

목차

    Arc( )

    주어진 좌표를 이용하여 아크를 그린다. 

    Global External Function:
    FUNCTION boolean Arc(ulong hwnd, long r1, long r2, long r3, long r4, long a1, long a2, long a3, long a4) LIBRARY "Gdi32.dll"
    Script:
    Boolean rtn
    ulong l_handle, l_device
    long lv[8]
    l_handle = handle(w_main)  // 'w_main' is the name of the sample window.
    l_device = GetDC(l_handle)
    lv[ ]  = {10,40,300,220,0,0,180,0}
    rtn = Arc(l_device, lv[1], lv[2], lv[3], lv[4], lv[5], lv[6], lv[7], lv[8])

    Beep( )

    삑 소리가 나게 한다. 

    Global External Function:
    FUNCTION boolean Beep(long freq,long dur) LIBRARY "Kernel32.dll"
    Script:
    Boolean rtn
    Long ll_freq, ll_dur
    ll_freq = 500
    ll_dur = 20
    rtn = Beep(ll_freq, ll_dur)
    

    BringWindowToTop( )

    타겟 윈도우에게 가장 위쪽으로 나오도록 메시지를 보낸다. 파워빌더의 오브젝트명.bringtotop = true과 동일하다. 

    Global External Function:
    FUNCTION boolean BringWindowToTop(ulong w_handle) LIBRARY "User32.dll"
    Script:
    Boolean rtn
    ulong l_handle
    l_handle = handle(w_win2)
    rtn = BringWindowToTop(l_handle)
    

    Chord( )

    주어진 좌표에 기반을 둔 현(사각형, 타원(?))을 그린다. 

    Global External Function:
    FUNCTION boolean Chord(ulong hwnd,long x1,long y1,long x2,long y2,long r1, long r2, long r3, long r4) LIBRARY "Gdi32.dll"
    Script:
    boolean rtn
    ulong l_handle, l_device
    long lv[8]
    l_handle = handle(w_main)
    l_device = GetDC(l_handle)
    // This can be done in one line:   i.e.  l_device = GetDC(handle(w_main))
    lv[ ] = {5,5,200,200,0,0,200,300}
    rtn = Chord(l_device, lv[1], lv[2], lv[3], lv[4], lv[5], lv[6], lv[7], lv[8])

     

    CloseHandle( )

    이 함수는 열려있는 오브젝트의 핸들을 release한다. 

    Global External Function:
    FUNCTION boolean CloseHandle(ulong w_handle) LIBRARY "Kernel32.dll"
    Script:
    boolean rtn
    ulong l_handle
    l_handle = FindWindowA(0,"<window or object name>")  // Usually you would already have the handle.
    rtn = CloseHandle(l_handle)
    

     

    CloseWindow( )

    타켓 윈도우를 미니마이즈시킨다.(닫지 않는다) 

    Global External Function:
    FUNCTION boolean CloseWindow(ulong w_handle) LIBRARY "User32.dll"
    Script:
    boolean rtn
    ulong l_handle
    l_handle = FindWindowA(0,"File manager")  // Be sure to use the exact title of the window you are targeting.
    rtn = CloseWindow(l_handle)
    

    CopyFileA( )

    이 함수는 파일을 복사한다. 

    Global External Function:
    FUNCTION boolean CopyFileA(ref string cfrom, ref string cto, boolean flag) LIBRARY "Kernel32.dll"
    Script:
    string l_from, l_to
    boolean l_flag, rtn
    l_flag = false
    l_from = "c:\pwrs\pb5i32\ex\code\beach.bmp"
    l_to = "c:\test.bmp"
    rtn = CopyFileA(l_from, l_to, l_flag)
    MessageBox("CopyFile", string(rtn))

    CreateDirectoryA( )

    새로운 디렉토리 폴더를 생성한다. 

    Global External Function:
    FUNCTION boolean CreateDirectoryA(ref string pathname, int sa) LIBRARY "Kernel32.dll"
    Script:
    boolean rtn
    string l_dir
    l_dir = "API Demo"
    rtn = CreateDirectoryA(l_dir, 0)
    If rtn then
       MessageBox("New Directory Created", "API Demo directory is located under pwrs.")
    else
       MessageBox("CreateDirectory", "Failed")
    end if

     

    DeleteFileA( )

    지정된 파일을 삭제한다. 

    Global External Function:
    FUNCTION boolean DeleteFileA(ref string filename) LIBRARY "Kernel32.dll"
    Script:
    string l_file
    boolean rtn
    l_file = string(sle_to.text)
    rtn = DeleteFileA(l_file)
    MessageBox("DeleteFile", string(rtn))

    DeleteMenu( )

    이 함수는 지정된 메뉴아이템을 삭제하는데 사용된다. 

    Global External Function:
    FUNCTION boolean DeleteMenu(ulong mhand, uint upos, uint flag) LIBRARY "user32.dll"
    Script:
    ulong m_handle
    boolean rtn
    m_handle = GetSystemMenu(handle(w_main), false) // Need to get the handle of the system menu first.
    rtn = DeleteMenu(m_handle, 1, 0)  // The second argument, the '1', refers to the position in the menu.
    Messagebox("Return Code", string(m_handle))
    Messagebox("Return Code", string(rtn))

    DestroyWindow( )

    이 함수는 타겟윈도우에게 Destory메시지를 보낸다. 파워빌더의 Close("윈도우명")과 동일하다. 

    Global External Function:
    FUNCTION boolean DestroyWindow(ulong w_handle) LIBRARY "USER32.DLL"
    Script:
    boolean rtn
    ulong l_handle
    open(w_win2) // Open a test window
    l_handle = handle(w_win2)
    rtn = DestroyWindow(l_handle)

     

    DllRegisterServer( )

    이 함수는 OCX가 자동적으로 등록되도록 해 준다. 이 함수는 constructor이벤트에서 파워빌더 에플리케인션이 이 동작되고 있는 동안에 동적으로 OCX를 등록할때 사용된다.

    Global External Function:
    FUNCTION long DllRegisterServer() LIBRARY "c:\windows\ocxname.ocx"
    Script:
    Long ll_rtn
    ll_rtn = DllRegisterServer()
    //Note:   A return code of zero most likely means the OCX is already registered.

     

     

    파워빌더 함수 - 2 (E ~ G)

    2021.06.07 - [PowerBuilder] - 파워빌더 함수 - 1 (A~D) 파워빌더 함수 - 1 (A~D) Arc( ) 주어진 좌표를 이용하여 아크를 그린다. Global External Function: FUNCTION boolean Arc(ulong hwnd, long r1, long r2..

    www.entity.co.kr

     

     

    파워빌더 함수 - 3 (L ~ P)

    LoadLibraryA( ) 이 함수는 dll을 (활성)메모리에 로드합니다. 32비트에서만 사용할 수 있습니다. Global External Function: FUNCTION ulong LoadLibraryA(string modname) LIBRARY "Kernel32.dll" Script: ulong..

    www.entity.co.kr

     

     

    파워빌더 함수 - 4 (R ~ W)

    파워빌더 함수 - 1 (A~D) Arc( ) 주어진 좌표를 이용하여 아크를 그린다. Global External Function: FUNCTION boolean Arc(ulong hwnd, long r1, long r2, long r3, long r4, long a1, long a2, long a3, long a4..

    www.entity.co.kr

     

    반응형

    댓글