Objective: get the icon of a file (word,excel,pdf,...)
In L4G, I use the ExtractAssociatedIconA function to obtain a handle for an icon stored as a resource in a file or an icon stored in the executable file associated with a file.
And I associate it with a button using the SendMessageA function.
Example code:
DEFINE VARIABLE FILENAME AS CHARACTER NO-UNDO.
DEFINE VARIABLE IconInd AS INTEGER NO-UNDO.
DEFINE VARIABLE hIcon AS INTEGER NO-UNDO.
DEFINE VARIABLE iOldIcon AS INTEGER NO-UNDO.
DO WITH FRAME {&FRAME-NAME}:
IF NUM-ENTRIES(RowObject.com_cha:SCREEN-VALUE,CHR(9)) > 0 THEN
DO i = 1 TO NUM-ENTRIES(RowObject.com_cha:SCREEN-VALUE,CHR(9)):
VIEW hbutton[i] hfillin[i].
hbutton[i]:SELECTABLE = TRUE.
ASSIGN DisplayName = ENTRY(i,RowObject.com_cha:SCREEN-VALUE,CHR(9)).
IF Filename <> "" THEN
DO:
RUN ExtractAssociatedIconA(INPUT 0,INPUT-OUTPUT NomFich,INPUT-OUTPUT IconInd,OUTPUT hIcon).
RUN SendMessageA( hButton[i]:HWND, {&BM_SETIMAGE}, {&IMAGE_ICON}, 0, OUTPUT iOldIcon).
RUN SendMessageA( hButton[i]:HWND, {&BM_SETIMAGE}, {&IMAGE_ICON}, hIcon, OUTPUT iOldIcon).
END.
I want to do the same thing with a RadGridView? I've added an ima column as type GridViewImageColumn and in the :
METHOD PRIVATE VOID GridLien_CellFormatting I'd like to put the image
RUN SendMessageA( e:CellElement:?????? {&BM_SETIMAGE}, {&IMAGE_ICON}, hIcon, OUTPUT iOldIcon).
Can you help me?
Thank you