Thread View: cn.bbs.comp.program
1 messages
1 total messages
Started by ���ܵ�Сʨ
Sat, 18 Apr 1998 00:00
ʹ��PowerBuilder����500������(��)
Author: ���ܵ�Сʨ
Date: Sat, 18 Apr 1998 00:00
Date: Sat, 18 Apr 1998 00:00
93 lines
6432 bytes
6432 bytes
������һ��Ӧ��ʵ��
������������local external����
Subroutine BringWindowToTop(int hWnd) Library "User"
Function uint GetNextWindow(uint hWnd, int Flag) Li
brary "user"
Function uint GetWindowText(uint hWnd, REF string Ti
tle, uint Size ) Lib rary "user"
Function uint ShowWindow(uint hWnd, int CmdShow)
Library "user"
Function integer IsIconic(uint hWnd) Library "user
"
Function integer OPenIcon(uint hWnd) Library "user
"
Function integer FindWindow(string ClassName, stri
ng WindowName) Li brary "user"
Function integer FindWindow(long ClassName, strin
g WindowN ame) Library "user"
Function integer FindWindow(string ClassName, long
WindowName) Library "user"
��������Ĵ��ڼ�����:
fw_make_app_active
//����:boolean
//����:
//string as_title
boolean lb_cont = TRUE
integer li_result, li_size
string ls_title
uint li_handle
li_handle = Handle ( this )
li_size = Len ( at_title ) + 1
//li_handle = FindWindow ( 0, "Control Panel" )
DO WHILE lb_cont
li_handle = GetNextWindow ( li_handle, 1 )
If li_handle = Handle ( this ) THEN Return FALSE
li_result = GetWindowText ( li_handle, ls_title, li_size
)
IF ls_title = as_title THEN lb_cont = FALSE
LOOP
//ShowWindow ( li_handle, 3 )
IF IsIconic ( li_handle ) > 0
THEN
OpenIcon ( li_handle )
ELSE
BringWindowToTop ( li_handle )
END IF
Return TRUE
����ԭ��
�����һ��Ӧ����㴰�����õ������������FindWindow
���������ҡ�FindWin dow��������������:Ҫ�ҵĴ��ڵ�����ʹ���
�ı��⡣ע��,������local external�����������ַ�ʽ��������һ
����������Ϊ������null��Ϊ"ͨ���"�ֱ���������Ϊ�˴�
��null,���뽫�������Ͷ����long��,��ֵΪ0������������ҪΪÿ
һ�ֿ��ܵĵ�����ʽ����һ��local external������������ʹ��
�������ʱ,PowerBuilder�Զ��ж�Ҫ����һ����ʽ��
����,�ڴ��ں���fw_make_app_active��,���ǿ����������ֶ�ʹ
FindWindow��������C ontrolPanel���ڡ�������ֻҪ��FindWindow
����صĴ��ھ��ݸ�BringWindowToTop ����Ϳ��Լ���Contr
olPanel�����ˡ�
������������������ȱ��:
1.��֪��ij��Ӧ�õĶ��㴰�ڵ�ȫ�����統ʹ��Microsoft
Wordʱ,��ǰ���ĵ�������Ҳ�������ڴ��ڵı����ϡ����,����
�����,Ѱ�Ҷ��㴰����Ҫ��һ�ַ�����
2.���Ҫ����Ĵ���������С��״̬,BringWindowToTop����
������������
ʵ����,�����ᵽ�ĵڶ�������Ƚ�����������Ǽ���IsIconi
c�����ж�Ҫ����Ĵ����Ƿ���С�����������С��״̬,��ʹ��Br
ingWindowsToTop�����������С��״̬, ����OpenIcon��������
��ô��ڡ����ַ���ֻ�ٶ��Դ�����С��ǰ�Ĵ�С��λ����ʾ�ô���
������Ҳ������Show Window��������Ҫ��ʾ������Ӧ�õĴ���ʩ��
���Ŀ��ơ�
������,���Ǵ���һ������ʹ������������ʽ��ʾ����
���Dz�ͬ����ڷ�ʽ�IJ������:
��1
����ڶ�������ʱ,����������������������:GetNextWindow��G
etWindowsText��������ǽ�һ�����ھ��ݸ�GetNextWindow����
,���ڸ����������������Ӵ���֮��ѭ�������һ�����㴰�ھ�
��ݸ�ú���,�ú��������ж��㴰��֮��ѭ��������ϣ��õ�
���Ǻ�һ�ַ�ʽ,������������Ҫ��ȡ�Լ�Ӧ�õĶ��㴰�ھ��
�������ڶ��㴰��֮��ѭ��ʱ,��GetWindowText��������ǵ�
���⡣�ú������������:���ھ��һ�����Է��ر�����ַ���
�������ַ����ȡ�����Ҫ����������һ������,��Ϊ����
������Ҫƥ��������ڱ���,����Ҫƥ���ܱ�֤���Ƿ�����ҪѰ�ҵ�
���ڵij��ȡ�����,������ǰ�"Microsoft Word"���ݸ�������ں�
��ʱ,��������ж��ı��ij��Ȳ������1,����ֻ������Ҫ�Ƚϵ���
��ij��ȴ��ݸ���GetWindowText����,�ú����ڶ��㴰��֮��ѭ��
,Ѱ���Ը��ַ�ͷ�Ĵ��ڡ��������û�з���ƥ��,����ѭ������
���Լ���Ӧ�ô���ʱ�˳�ѭ������ʱ,���Ǽ��˳�����
--
[m[1;32m�� ��Դ:���ϴ�С�ٺ���Ϣ����վ bbs.nju.edu.cn��[FROM: hsia.nju.edu.cn][m
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads