Patrice Terrier
Using STATIC variables within a procedure June 18, 2009 10:16AM |
PROCEDURE SetStaticValue(LOCAL sUseString is string, LOCAL nValue is int) sUseString += "|" nhMain is int = Handle(MyWindow..Name) nStaticHandle is int = GetDlgItem(nhMain, ID_STATIC) IF nStaticHandle = 0 THEN nStaticHandle = API("USER32", "CreateWindowExA", 0, "LISTBOX", "", WS_CHILD + LBS_HASSTRINGS, 0, 0, 0, 0, nhMain, ID_STATIC, Instance, 0) END IF nStaticHandle THEN nIndex is int = SendMessage(nStaticHandle, 399, -1, &sUseString) IF nIndex > -1 THEN // We found same static SendMessage(nStaticHandle, 410, nIndex, nValue) ELSE // Add it to our static list SendMessage(nStaticHandle, 410, SendMessage(nStaticHandle, 384, 0, &sUseString), nValue) END END
FUNCTION GetStaticValue(LOCAL sUseString is string) sUseString += "|" nValue is int = 0 nhMain is int = Handle(MyWindow..Name) nStaticHandle is int = GetDlgItem(nhMain, ID_STATIC) IF nStaticHandle THEN nIndex is int = SendMessage(nStaticHandle, 399, -1, &sUseString) IF nIndex > -1 THEN // We found it nValue = SendMessage(nStaticHandle, 409, nIndex, 0) END END RESULT nValue
Al
Re: Using STATIC variables within a procedure June 18, 2009 11:36AM |
Moderator |
Patrice Terrier
Re: Using STATIC variables within a procedure June 18, 2009 12:17PM |
Michel Fages
Re: Using STATIC variables within a procedure June 18, 2009 01:12PM |
PROCEDURE SetStaticvalue(LOCAL sUseString is string, LOCAL sValue is string) as_values is dynamic array of 0 by 2 strings b_buffer is Buffer = MyWindow..Note IF MyWindow..Note<>"" THEN Deserialize(as_values, b_buffer, psdXML) END ArrayAddLine(as_values, sUseString, sValue) ArraySort(as_values, asAscending, 1) Serialize(as_values, b_buffer, psdXML) MyWindow..Note = b_buffer
PROCEDURE GetStaticValue(LOCAL sUseString is string) as_values is dynamic array of 0 by 2 strings b_buffer is Buffer = MyWindow..Note le_ind is int IF MyWindow..Note<>"" THEN Deserialize(as_values, b_buffer, psdXML) END le_ind = ArraySeek(as_values, asBinary, 1, sUseString) IF le_ind>0 THEN RESULT as_values[le_ind][2] ELSE RESULT "" END
Fabrice Harari
Re: Using STATIC variables within a procedure June 18, 2009 01:14PM |
Patrice Terrier
Re: Using STATIC variables within a procedure June 18, 2009 02:05PM |
Patrice Terrier
Re: Using STATIC variables within a procedure June 18, 2009 02:27PM |
Michel Fages
Re: Using STATIC variables within a procedure June 18, 2009 02:35PM |