A partir du post de Flype (voir ci-après) sur les timers et l'utilisation des API
J'ai essayé de regarder le site lié et les forum (Fr & Uk) et plus je lis moins je comprends.Flype a écrit :et concernant le fonctionnement,
dans cet exemple tu es confronté à 3 choses différentes.
1/ du langage purebasic
2/ une fonction de l'API Win32 (SetTimer)
3/ une fonction 'callback' qui sont si particulières au début.
une fonction callback est une fonction que l'on écrit soi meme (ici TimerProc) mais dont on doit absolument respecter le nombre et le type des arguments (ici hwnd.l, uMsg.l, idEvent.l, dwTime.l) spécifiés par microsoft.
http://msdn2.microsoft.com/en-us/library/ms644907.aspx
une fois écrite, cette fonction pourra être utilisée en la 'passant' à la fonction SetTimer() grace au caractère @ qui indique l'adresse mémoire de la fonction callback (TimerProc).
et donc le but final, est que SetTimer() appelle tout les x temps la fonction callback, indépendamment de ton code principal qui gère le reste de l'application.
en espèrant être assez clair.
En plus des fonctions API, des callback il y a les sendmessage...

Mon exemple de départ, peut-être trop compliqué est d'utiliser la fonction ListView_SetBkImage Macro afin de mettre une image dans un list view http://msdn2.microsoft.com/en-us/library/ms671182.aspx
Quel type de données sont HWND hwndLV, LPLVBKIMAGE plvbki ? Il me semble avoir vu un post sur les types de données des paramètres mais je ne le retrouve plusdocumentation a écrit :"Sets the background image in a list-view control. You can use this macro or send the LVM_SETBKIMAGE message explicitly.
Syntax
BOOL ListView_SetBkImage(
HWND hwndLV,
LPLVBKIMAGE plvbki
);
Parameters
hwndLV
A handle to the list-view control.
plvbki
A pointer to an LVBKIMAGE structure that contains the new background image information.
Return Value
Returns nonzero if successful, or zero otherwise. Returns zero if the ulFlags member of the LVBKIMAGE structure is LVBKIF_SOURCE_NONE.
Remarks
Because the list-view control uses OLE COM to manipulate the background images, the calling application must call CoInitialize or OleInitialize before using this macro. It is best to call one of these functions when the application is initialized and call either CoUninitialize or OleUninitialize when the application is terminating.
en cliquant sur le lien sur la structure LVBIMAGE on a les infos suivantes
Autre methode proposée SENDMESSAGEdocumentation a écrit :"
LVBKIMAGE Structure
Contains information about the background image of a list-view control. This structure is used for both setting and retrieving background image information.
Syntax
typedef struct tagLVBKIMAGE {
ULONG ulFlags;
HBITMAP hbm;
LPTSTR pszImage;
UINT cchImageMax;
int xOffsetPercent;
int yOffsetPercent;
} LVBKIMAGE, *LPLVBKIMAGE;
LVM_SETBKIMAGE Message
documentation a écrit :"Sets the background image in a list-view control. You can send this message explicitly or by using the ListView_SetBkImage macro.
Syntax
To send this message, call the SendMessage function as follows.
lResult = SendMessage( // returns LRESULT in lResult
(HWND) hWndControl, // handle to destination control
(UINT) LVM_SETBKIMAGE, // message ID
(WPARAM) wParam, // = 0; not used, must be zero
(LPARAM) lParam // = (LPARAM) (LPLVBKIMAGE) plvbki;
);
Parameters
wParam
Must be zero.
plvbki
Pointer to a LVBKIMAGE structure that contains the new background image information.
Return Value
Returns nonzero if successful, or zero otherwise. Returns zero if the ulFlags member of the LVBKIMAGE structure is LVBKIF_SOURCE_NONE.
Quelqu'un aurait-il un code pour je puisse faire des essais et comprendre le principe de raisonnement à avoir pour utiliser les fonctions API ; La documentation de microsoft étant un peu aride pour un débutant ?
Merci d'avance à tous
JF