是按照?xlspd("d:\","VFP_OPEN.docx")来调用吗
(1)是按照?xlspd("d:\","VFP_OPEN.docx")来调用吗?但调用后无任何反馈?
(2)如果返回一个句柄,那么fclose(句柄)可以关闭WPS里打开的docx文档吗?
谢谢!
以下是引用sych在2024-5-27 12:14:34的发言:查找窗口如何?如果文件被打开,标题栏应该有该文件的相应信息PROCEDURE xlspdLpara ctitle,fnameDeclare INTEGER GetDesktopWindow IN user32Declare INTEGER GetWindow IN user32 INTEGER hwnd, INTEGER wFlagDeclare INTEGER GetWindowText IN user32; INTEGER hwnd, STRING @lpString, INTEGER cchDeclare INTEGER GetModuleFileNameEx IN psapi; INTEGER hProcess,; INTEGER hModule,; STRING ModuleName,; INTEGER nSizeDeclare INTEGER GetWindowThreadProcessId IN user32; INTEGER hWnd,; INTEGER @ lpdwProcIdDeclare INTEGER OpenProcess IN kernel32; INTEGER dwDesiredAccessas,; INTEGER bInheritHandle,; INTEGER dwProcIdDeclare INTEGER CloseHandle IN kernel32 INTEGER hObjectDeclare integer GetClassName in user32; integer hwnd, ; string lpClassName, ; integer nMaxCountctitle=lower(ctitle)Local hDesktop, hFirstChild, hLastChild, cBuffer, nResult,hwnd,hCurrent,ii,jj,lwin(1)hCurrent = hDesktopii=0jj=1lwin(1)=GetDesktopWindow()hwnd=0DO whil ii<jj ii=II+1 hCurrent=lwin(ii) hFirstChild = GetWindow(hCurrent, 5) hLastChild = GetWindow(hFirstChild, 1) hCurrent = hFirstChild Do WHILE hCurrent>0 cBuffer = Space(250) nResult = GetWindowText(hCurrent, @cBuffer, Len(cBuffer)) cBuffer= SUBSTR(cBuffer, 1, nResult) If at(ctitle,lower(cBuffer))>0 HWnd=hCurrent ii=jj Exit ENDIF jj=jj+1 LOCAL lwin(jj) lwin(jj)=hCurrent If hCurrent = hLastChild Exit Endif hCurrent = GetWindow(hCurrent, 2) ENDDOENDDORetu hwnd