본문 바로가기
PowerBuilder

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

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

 

 

 

파워빌더 함수 - 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) LIBRARY "Gdi32.dll" Sc..

www.entity.co.kr

 

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

파워빌더 함수 - 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

 

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

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

www.entity.co.kr

Rectangle( )


이 함수는 주어진 좌표에 의해서 사각형을 그린다. 

 

Global External Function:
FUNCTION boolean Rectangle(ulong hwnd,long x1,long y1,long x2,long y2) LIBRARY "Gdi32.dll"

Script:
Boolean rtn
ulong l_handle,l_device
long lv[4]

lv[ ] = { 10,10,275,215}
l_handle = handle(w_main)
l_device  = GetDC(l_handle)
rtn = Rectangle(l_device,lv[1],lv[2],lv[3],lv[4])

 

 

 

 

SendMessageA( )


이 함수는 지정된 윈도우에 의해서 만들어진 thread와 관련된 message message queue에 보내며 그 message가 처리될때까지 return되지 않는다. 

 

Global External Function:
FUNCTION long SendMessageA(ulong hwndle,UINT wmsg,ulong wParam,ulong lParam) Library "User32.dll"

Script:
ulong l_handle
long rtn

l_handle = handle(w_main)
rtn = SendMessageA(l_handle,274,61728,0)

 

 

 

 

SetCapture( )


이 함수들은 같이 사용되며, SetCapture()함수는 ReleaseCapture()가 호출될때까지 마우스에 락을 건다. 

 

Global External Function:
FUNCTION ulong SetCapture(ulong a) LIBRARY "User32.dll"
FUNCTION boolean ReleaseCapture( ) LIBRARY "User32.dll"

Script:
boolean rtn
ulong l_loop, u_test, u_long
u_test = handle(parent)
u_long = SetCapture(u_test)

SetPointer(SizeNWSE!)
for l_loop = 1 to 150000
next
rtn = ReleaseCapture( )

 

 

 

 

SetComputerNameA( )


이 함수는 컴퓨터(다른 컴퓨터에서 참조되는)의 이름을 변경한다. 

 

Global External Function:
FUNCTION boolean SetComputerNameA(ref string cname) LIBRARY "kernel32.dll"

Script:
boolean rtn
string l_name

l_name = "Powerbuilder"
rtn = SetComputerNameA(l_name)

if rtn then
   MessageBox("Computer name changed to 'Powerbuilder'", "You'll need to reboot for it to take effect")
else
   MessageBox("SetComputerName", "Failed")
end if

 

 

 

 

SetCurrentDirectoryA( )


이 함수는 O/S가 가리키고 있는 현재의 디렉토리를 변경한다. 파워빌더에는 이와 유사한 함수가 없다. 

 

Global External Function:
FUNCTION boolean SetCurrentDirectoryA(ref string cdir) LIBRARY "kernel32.dll"

Script:
boolean rtn
string l_dir

l_dir = "c:\My Documents"
rtn = SetCurrentDirectoryA(l_dir)
MessageBox("SetCurrentDirectory", string(rtn))

 

 

 

 

SetFocus( )


주어진 윈도우 또는 오브젝트로 포커스를 변경하는 기능을 수행한다. 파워빌더의 오브젝트.SetFocus( )와 유사하다. 

 

Global External Function:
SUBROUTINE SetFocus(long objhandle) LIBRARY "User32.dll"

Script:
SetFocus(handle(sle_1))  // This function gets the handle from PB.

 

 

 

 

SetThreadPriority( )


이 함수는 주어진 thread의 우선순위를 set한다. default값은 0이며, 그 어떤 높은 우선순위도 hold상태가 되어 더 많은 cpu time을 받을 수 있다. 우선 순위를 너무 높게 잡거나 마우스가 작동하지 않도록 하는 것은 좋지 않다. 

 

Global External Function:
FUNCTION boolean SetThreadPriority(ulong hthread, int npriority) LIBRARY "Kernel32.dll"

Script:
ulong l_handle
boolean rtn

l_handle = GetCurrentThread()
rtn = SetThreadPriority(l_handle, 2) // Set the priority of thread higher.
MessageBox("Current Thread Priority Changed", string(rtn))

 

 

 

 

Sleep( )


이 함수는 O/S가 주어진 시간(milliseconds)동안 현재의 thread를 무시하도록 한다. 이 함수가 Active상태인 동안 화면은 다시 그려지지 않는다. 

 

Global External Function:
SUBROUTINE Sleep(ulong milli) LIBRARY "Kernel32.dll"

Script:
ulong l_delay
l_delay = 2000
Sleep(l_delay)

 

 

 

 

SndPlaySoundA( ) & WaveOutGetNumDevs( )


이 함수들은 WAV파일을 파워빌더에서 플레이 한다. 파워빌더에는 이와 유사한 함수가 없다. 

 

Global External Function:
FUNCTION boolean SndPlaySoundA(string wavfile, uint flag) LIBRARY "WINMM.DLL"
FUNCTION uint WaveOutGetNumDevs() LIBRARY "WINMM.DLL"

Script:
int    lui_NumDevs, l_mode
string ls_file

l_mode  = 0
ls_file = string(c:\windows\media\chimes.wav)
lui_NumDevs = WaveOutGetNumDevs()
IF lui_NumDevs > 0 THEN
   SndPlaySoundA(ls_file, l_mode)
END IF

 

 

 

 

SwapMouseButton( )


이 함수는 마우스의 오른쪽 버튼과 왼쪽 버튼을 서로 바꾸는 일을 하며 파워빌더에는 이와 유사한 함수는 없다. 마우스의 일반(Normal) 상태를 return하기 위해 이 함수는 다시 호출되어야 한다. 

 

Global External Function:
FUNCTION boolean SwapMouseButton(boolean var) LIBRARY "User32.dll"

Script:
boolean rtn, l_mouse

rtn = SwapMouseButton(l_mouse)
If l_mouse = true Then
   MessageBox("Change Made","Right button on Left Side")
Else
   MessageBox("Change Made","Right button on Right Side")
End If

 

 

 


WinExec( )


이 함수는 주어진 파일명(파일의 경로 포함) O/S 트리거에게 전달하며 O/S트리거는 주어진 파일을 실행한후 그 결과를 Return한다. 파워빌더에서는 RUN() 함수를 사용하면 된다.(i.e. Run("c:\windows\calc.exe") 

Global External Function:
FUNCTION uint WinExec(ref string filename, uint wstyle) LIBRARY "kernel32.dll"

Script:
string ls_filename
uint rtn, wstyle

ls_filename = "c:\windows\calc.exe"
style = 1
tn = WinExec(ls_filename, wstyle)
Messagebox("Return Code", string(rtn))

 

반응형

'PowerBuilder' 카테고리의 다른 글

파워빌더 "AcceptText" 함수  (0) 2021.06.23
파워빌더 "ABS" 함수  (0) 2021.06.14
파워빌더 함수 - 3 (L ~ P)  (0) 2021.06.14
파워빌더 함수 - 2 (E ~ G)  (0) 2021.06.08
완전 압축 파워빌더의 기초문법  (0) 2021.06.07

댓글