Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
LoadCursor Help
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Divers
Thread ID:
00798912
Message ID:
00799355
Vues:
24
This doesn't work either (defining a window fist):
Any idea what I am doing wrong?
CLEAR
DEFINE WINDOW mywindow FROM 0,0 TO 15,79;
     DOUBLE SHADOW COLOR SCHEME 10 TITLE "Test Input Window"
ACTIVATE WINDOW mywindow
DO Decl

#DEFINE GUITHREADINFO_SIZE  48 

LOCAL lnThreaddId 
lnThreadId = 0  && the foreground thread 

PRIVATE cBuffer, nFlags 
cBuffer = Chr(GUITHREADINFO_SIZE) +; 
    Repli(Chr(0), GUITHREADINFO_SIZE-1) 

IF GetGUIThreadInfo(lnThreadId, @cBuffer) = 0 
    ? "Error code:", GetLastError() 
    RETURN 
ENDIF 

lnhandle= wnd(13, "Window that has the keyboard focus") 
iok=CreateCaret(@lnhandle,0,150,150)
iok2=ShowCaret(@lnhandle)

myans=.f.
@10,1 sAY "Changed caret size?" GET myans PICTURE "Y"
READ
IF WEXIST('mywindow')
	RELEASE WINDOWS mywindow
ENDIF
RETURN

PROCEDURE wnd(lnOffs, lcTitle) 
    hWindow = buf2dword(SUBSTR(cBuffer, lnOffs,4)) 
    lcCaption = GetWindowCaption(hWindow) 
    ? lcTitle, LTRIM(STR(hWindow)) + ", [" + lcCaption + "]"
    RETURN hWindow

PROCEDURE decl 
    DECLARE INTEGER GetLastError IN kernel32 
    DECLARE INTEGER GetGUIThreadInfo IN user32; 
        INTEGER idThread, STRING @lpgui 
    DECLARE INTEGER GetCurrentThreadId IN kernel32 
    DECLARE INTEGER GetWindowText IN user32; 
            INTEGER hwnd, STRING @lpString, INTEGER cch     
	DECLARE INTEGER CreateCaret IN user32;
		INTEGER hwnd,;
		INTEGER hBitmap,;
		INTEGER nWidth,;
		INTEGER nHeight
	DECLARE INTEGER ShowCaret IN user32 ;
		INTEGER hwnd

FUNCTION buf2dword(lcBuffer) 
RETURN Asc(SUBSTR(lcBuffer, 1,1)) + ; 
    BitLShift(Asc(SUBSTR(lcBuffer, 2,1)),  8) +; 
    BitLShift(Asc(SUBSTR(lcBuffer, 3,1)), 16) +; 
    BitLShift(Asc(SUBSTR(lcBuffer, 4,1)), 24) 

FUNCTION GetWindowCaption(lnWindow) 
    LOCAL lnLength, lcText 
    lcText = SPACE(250) 
    lnLength = GetWindowText(lnWindow, @lcText, Len(lcText)) 
RETURN Iif (lnLength>0, Left(lcText, lnLength), "#empty#") 
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform