🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: cn.bbs.comp.program
1 messages
1 total messages Started by ���ܵ�Сʨ Sat, 18 Apr 1998 00:00
ʹ��PowerBuilder����500������(��)
#1265
Author: ���ܵ�Сʨ
Date: Sat, 18 Apr 1998 00:00
154 lines
9399 bytes
������ܼ������õ�API����
    ��������
    Windows����ϵͳ�����ļ�����һ��ĵͼ�������÷����൱��
��,����PowerBuilder��Ϊ��ʵ����һЩ�ͼ�����,�������DZ����õ�
�����(��:FUNCky for PowerBuilder��) ����C����֮�������
�����Լ��Ŀ�,���ַ������ǽ��ں�����½������ۡ�������,������
�Ƚ�����ε���WindowsAPI����ʵ�ּ򵥶��ֳ��õĵͼ�����:�ļ�
������
    ʹ��WindowsAPI���õ���������Ҫ�ô���:���������
Ҫ����Ψһ�ͼ�����,�ڷ���Ӧ��ʱ�Ͳ���Ҫͬʱ������Ŀ����
ȥ���������ʹ�õ�������ṩ���������,Ϊ�����,ʹ��
����������ṩ����̿���Ҫ���Щ��
    ʵ��
    ������������local external����:
    Function  long  LZOpenFile(string  FileName,  REF ws_ofs
truct  FileStructur e,  uint  style)
    Library "lzexpand.dll"
    Function  long  CopyLZFile(uint  SourceHandle, uint  Des
tHandle)  Library"l zexpand.dll"
    Function  long  LZClose (uint  FileHandle)  Library  "lz
expand.dll"
    ws_ofstruct�Ĵ��ڼ��ṹ����:
��1
    ��������Ĵ��ڼ�����:
    wf_copy
    //����:
     boolean
    //����:
      //string
      as_source
      //string
      as_dest
    long
        ll_SourceFileHandle, ll_DestFileHandle, ll_result
    ws_ofstruct   lstr_SourceFileStructure, lstr_DestFileStr
ucture
    //��Դ�ļ�
    ll_SourceFileHandle = LZOpenFile ( as_source, lstr_Sourc
eFileStructure, 0)
    IF ll_SourceFileHandle = -1 THEN
      MessageBox ( "�������", "�޷����ļ�: " + as_source 
)
      Return FALSE
    END IF
    //��Ŀ���ļ�
    ll_DestFileHandle = LZOpenFile ( as_dest, lstr_DestFileS
tructure, 4096 )
    IF ll_DestFileHandle = -1 THEN
    MessageBox ( "�������", "�޷������ļ�: " + as_dest )
      LZClose ( ll_SourceFileHandle )
      Return FALSE
    END IF
    //����
    ll_result = CopyLZFile ( ll_SourceFileHandle, ll_DestFil
eHandle )
    IF li_result < 0 THEN
      MessageBox ("�������","�޷������ļ�: " + as_source
    + " to file: " + as_dest )
      LZClose ( ll_SourceFileHandle )
      LZClose ( ll_DestFileHandle )
      Return FALSE
    END IF
    //�ر��ļ�
    LZClose ( ll_SourceFileHandle )
    LZClose ( ll_DestFileHandle )
    Return TRUE

    ����ԭ��
    Windows����COMPRESS.EXE��һ����ִ�г���,���ڴ������Le
mpel-ziv�㷨ѹ�����ļ�������Windows�ڲ������˼���������һ
�㷨�ĺ���,����LzCopy�������������ɽ�ѹ���ļ���ͬʱLzCopy
������ĵ��л�������˵��:"���ԭ�ļ�δ��ѹ��,�ú�����ԭ��
����"����LzCopy����Ҳ��������һ�����ٵ��ļ���������
    LzCopy��������������:ԭ�ļ���Ŀ���ļ��ľ�����ҵ���,
PowerBuilder�ṩ��F ileOpen����ص��ļ������LzCopy��
��Ҫ���Ǹ�������,������WindowsAPI�е�LzCopy����,���DZ�
��ͬʱʹ��LzOpenFile��LzClose����,��ȷ���������Ҫ���ļ����
��
    LzFileOpen��������������һ��������Ҫ�򿪵��ļ����
����������һ���ṹ, ����ṹ���ں������ʱ�����й�����ļ���
��Ϣ����PowerBuilder��FileOpen����һ��, LzFileOpen������Դ�
�����һ���ļ����ú���ĵ��������ָ���ú����DZ�������ֻ��
��ʽ���ļ�(0),������ֻд��ʽ�����ļ�(4096)��
    �����Ǵ���Դ�ļ���Ŀ���ļ���,����ֻҪ�򵥵ؽ����ص���
�����ļ��ľ��ݸ�LzCopy����,�Ϳ�ʵ���ļ����������,���˳�
֮ǰ����LzClose�������ر��������ļ���
    �ж���һӦ���Ƿ���������

    ʵ��
    ������������local external����
    Function uint  GetModuleHandle(string ModuleName)  Libra
ry "kernel"
    Function uint  GetModuleUsage(uint  ModuleName)  Library
 "kernel"
    Function uint  FindExecutable(string  FileName,  REF str
ing Directory,  REF  string Result)  Library "shell"��������
�Ĵ��ڼ�����:
    fw_check_app_status
    //����:
     boolean
    //����:
    //
    string  as_filename
    //
    string  as_directory
    integer
     li_size = 144, li_result
    string
      ls_executable = Space ( li_size )
    integer
     li_module_usage
    uint
       li_module_handle
    li_result = FindExecutable ( as_filename, as_directory, 
ls_executable )
    IF li_result < 32 THEN Return FALSE
    //���ִ���ļ�������,��ȡ���ִ���ļ��ľ��
    li_module_handle = GetModuleHandle ( ls_executable )
    IF li_module_handle < 1 THEN
      //û������
      Return FALSE
    ELSE
      //��ȡ�ж��ٸ�ʵ������
      li_module_usage = GetModuleUsage ( li_module_handle )
      Return TRUE
    END IF

    ����ԭ��
    ��γ�����Ի�ȡij��Ӧ���Ƿ��������С�
    ������WindowsAPI�е�GetModuleHandle�������ж��Ƿ�����һ
��Ӧ���������С�Ϊ��������һ��,������Ҫ֪���ļ���ȫ·����(��
���������·��)�����ǿ��Խ������Ӧ�õ�.INI�ļ���,Ҳ����
ͨ��д��Դ����ķ�������Ƕ���ִ�г������������Ƽ����Dz�
��ǰһ�ַ���,��������ʹӦ�þ��и�������ԡ�������Ĵ��ڼ�
������,�����������û���WindowsĿ¼�в���WIN.INI�ļ�����Ϊ��
�в�ѯ��Ӧ�����ض���չ����ĵ�֮��Ĺ�������¼��WIN.INI�ļ�
�С�����������Ҫ���ĵ�һ���¾�����WIN.INI�ĵ��в�����һ����,
 ��֪��������ҪѰ�ҵ�Ӧ����ͨ���ĸ����װ��ġ����ǿ����Լ�
����WIN.INI�ļ�,���ߵ���WindowsAPI�е�FindExecutable��������
����һ��Ϣ������,����ʹ���˵ڶ��ַ�����ֻҪ����ϣ��Ѱ�ҵĿ�
ִ�г�����������ļ��������·�����ݸ�FindExecutable����,��
��õ��ÿ�ִ�г����ȫ·����������ʱ��Ҫ�ж�ij��ִ�г�����
��������,���û�о������������������,���Ϸ����Ǻ����õġ�
    һ������˿�ִ�г����ȫ·����,���ǽ���ݸ�GetModuleHa
ndle�������Ӧ����������,��ú����Ӧ�õľ������0
,˵��Ӧ�ò�û��װ��,��ʱ�˳��������Ӧ����������,���ǽ���
�õ�Ӧ�õľ��ݸ�GetModuleUsage�����������ķ���ֵ���
���������Ӧ���м�����ͬ��ʵ�������ǵ�������,����ѯ��Ӧ
����Microsoft Word,��Ӧ�ò�������ʵ��ͬʱ����,����NotePad
�����Ӧ��,�ɶ��ʵ��ͬʱ���С���Щ��Ϣ�Ի��Ƿdz����õġ�

--
�� ��Դ:���ϴ�С�ٺ���Ϣ����վ bbs.nju.edu.cn��[FROM: hsia.nju.edu.cn]
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