View previous topic :: View next topic |
Author |
Message |
Aslan Valued Contributor
Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Mon Feb 25, 2008 4:40 pm Post subject: kernel32 and GetModuleHandle |
|
|
Can anyone tell me what is wrong with this?
I get "Library function not found" error
I'm trying to get the Module Handle of my app.
Code: | LOADLIB kernel32.dll
%%retVal = @lib(kernel32.dll,GetModuleHandle,INT:,NIL:)
info %%retVal
FREELIB kernel32.dll |
Here's my reference page: "http://msdn2.microsoft.com/en-us/library/ms683199(VS.85).aspx"
P.S This should look real familiar to you ShinobiSoft
|
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Tue Feb 26, 2008 1:54 am Post subject: |
|
|
Aslan,
There are 2 versions of this function. You can use the ASCII or Wide string version of this function. In VDS I would suggest using the ASCII version. Too call the ASCII version of the function put a capital 'A' at the end of the function name.
_________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
DaveR Valued Contributor
Joined: 03 Sep 2005 Posts: 413 Location: Australia
|
Posted: Tue Feb 26, 2008 8:09 am Post subject: |
|
|
dragonsphere wrote: | Too call the ASCII version of the function put a capital 'A' at the end of the function name. |
Ahh, that's why some functions can end in a capitol A.
_________________ cheers
Dave |
|
Back to top |
|
|
ShinobiSoft Professional Member
Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Tue Feb 26, 2008 8:39 am Post subject: Re: kernel32 and GetModuleHandle |
|
|
Aslan wrote: | P.S This should look real familiar to you ShinobiSoft |
Who me , what'd I do
Looks like DragonSphere beat me to it...
_________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
Back to top |
|
|
Aslan Valued Contributor
Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Wed Feb 27, 2008 12:00 am Post subject: The rest of the story |
|
|
Well the "A" got me past that part but now I'm stuck on the rest of it.
What this is part of is the Imagelist code Bill sent me a long time ago.
I'm only having issues adding images embedded in the VDS compiled executable as a resource to an ImageList.
In fact here's the ImageList Code in for all to enjoy.
Note: Credit for approx 80% of the following code belongs to ShinobiSoft (Bill) I just added a few more functions I'll explain later.
Code: | #################
# ImageList.dsc #
#################
#DEFINE COMMAND,GDI
#DEFINE COMMAND,KERNEL32
#DEFINE FUNCTION,KERNEL32
#DEFINE COMMAND,IMAGELIST
#DEFINE FUNCTION,IMAGELIST
#DEFINE FUNCTION,GETHANDLE
#DEFINE COMMAND,USER32
#DEFINE FUNCTION,USER32
#DEFINE FUNCTION,LOADIMAGE
:GDI
%%Result = 0
LOADLIB gdi32.dll
if @ok()
if @equal(%1,"DELETEOBJECT")
REM GDI DELETEOBJECT,<HGDIOBJ>
%%Result = @lib(gdi32.dll,DeleteObject,BOOL:,INT:%2)
end
FREELIB gdi32.dll
end
exit %%Result
:KERNEL32
LOADLIB kernel32.dll
if @equal(%1,"GETMODULEHANDLE")
if @null(%2)
%%retVal = @lib(kernel32.dll,GetModuleHandleA,INT:,NIL:)
else
%%retVal = @lib(kernel32.dll,GetModuleHandleA,INT:,STR:%2)
end
end
FREELIB kernel32.dll
exit %%retVal
:IMAGELIST
LOADLIB comctl32.dll
If @OK()
#****************************IMAGELIST COMMANDS********************************#
if @equal(%1,"CREATE")
REM IMAGELIST CREATE,<IMAGELIST>,<width>,<height>,<flags>,<initial>,<grow>
option fieldsep,"|"
parse "%%color;%%mask", %5
If @equal(%%color,color)
%5 = $0
ElsIf @equal(%%color,color)
%5 =
ElsIf @equal(%%color,color4)
%5 = $4
ElsIf @equal(%%color,color8)
%5 = $8
ElsIf @equal(%%color,color16)
%5 = $10
ElsIf @equal(%%color,color24)
%5 = $18
ElsIf @equal(%%color,color32)
%5 = $20
ElsIf @equal(%%color,colorddb)
%5 = $FE
end
If @equal(%%mask,mask)
%5 = @sum(%5,$1)
end
%%color =
%%mask =
%%himl = @lib(comctl32.dll,ImageList_Create,INT:,%3,%4,%5,%6,%7)
Dialog add,list,%2,0,0,0,0
If @NOT(%%LHandles)
Dialog add,list,LHandles,0,0,0,0
%%LHandles = 1
end
List add,LHandles,%2|%%himl
FREELIB comctl32.dll
exit
end
if @equal(%1,"ASSIGN")
REM IMAGELIST ASSIGN,<IMGLIST>,<table>,<type>
# <type> can be 0 (Normal) or 1 (Small) or 2 (State) 0r 3 (Header) {Default is Small}
if @equal(@substr(~%3,1,1),"%")
%%hwnd = @strdel(~%3,1,1)
else
%%hwnd = %3
end
If %4
%4 = %4
else
%4 = 1
end
%%himl = @GETHANDLE(%2)
If @equal(%4,3)
#Get Header handle
%%hHndl = @SENDMSG(~%3,@SUM($1000,31),0,0)
# HDM_SETIMAGELIST
%%Result = @SENDMSG(%%hHndl,@SUM($1200,8),0,%%himl)
else
%%Result = @sendmsg(~%3,4099,%4,%%himl)
end
elsif @equal(%1,"DESTROY")
REM IMAGELIST DESTROY,<IMGLIST>
%%himl = @GETHANDLE(%2)
%%Result = @lib(comctl32.dll,ImageList_Destroy,BOOL:,%%himl)
elsif @equal(%1,"SETBKCOLOR")
REM IMAGELIST SETBKCOLOR,<IMGLIST>,<COLORREF>
%%himl = @GETHANDLE(%2)
%%Result = @lib(comctl32.dll,ImageList_SetBkColor,INT:,%%himl,%3)
elsif @equal(%1,"ADD")
REM IMAGELIST ADD,<IMAGELIST>,<HBITMAP>,<HBITMAPMASK>
%%himl = @GETHANDLE(%2)
if @equal(@substr(%3,1,1),"#")
%%hInst = @KERNEL32(GETMODULEHANDLE)
%%LR_FLAGS = $0080
list add,%2,@strdel(%3,1)
else
%%hInst = 0
%%LR_FLAGS = $0090
list add,%2,%3
end
%%hbm = @USER32(LOADIMAGE,%%hInst,%3,0,0,0,%%LR_FLAGS)
%%hbmMask = @USER32(LOADIMAGE,%%hInst,%4,0,0,0,%%LR_FLAGS)
%%Result = @lib(comctl32.dll,ImageList_Add,INT:,%%himl,%%hbm,%%hbmMask,%4)
GDI DELETEOBJECT,%%hbm
GDI DELETEOBJECT,%%hbmMask
elsif @equal(%1,"ADDMASKED")
REM IMAGELIST ADDMASKED,<IMGLIST>,<image>,<maskColor>,<width>,<height>
%%himl = @GETHANDLE(%2)
if @equal(@substr(%3,1,1),"#")
REM Load from this executable as a resource
%%hInst = @KERNEL32(GETMODULEHANDLE)
%%LR_FLAGS = $0080
list add,%2,@strdel(%3,1)
else
REM Load from file
%%hInst = 0
%%LR_FLAGS = $0110
list add,%2,%3
end
%%bmp = @USER32(LOADIMAGE,%%hInst,%3,0,%5,%6,%%LR_FLAGS)
%%Result = @lib(comctl32.dll,ImageList_AddMasked,INT:,INT:%%himl,INT:%%bmp,INT:%4)
GDI DELETEOBJECT,%%bmp
elsif @equal(%1,"ADDICON")
REM IMAGELIST ADDICON,<IMGLIST>,<image>,<width>,<height>
%%himl = @GETHANDLE(%2)
if @equal(@substr(%3,1,1),"#")
REM Load from this executable as a resource
%%hInst = @KERNEL32(GETMODULEHANDLE)
%%LR_FLAGS = $0080
list add,%2,@strdel(%3,1)
else
REM Load from file
%%hInst = 0
%%LR_FLAGS = $0110
list add,%2,%3
end
%%bmp = @USER32(LOADIMAGE,%%hInst,%3,1,%4,%5,%%LR_FLAGS)
%%Result = @lib(comctl32.dll,ImageList_AddIcon,INT:,INT:%%himl,INT:%%bmp)
USER32 DESTROYICON,%%bmp
elsif @equal(%1,"ICONFROMFILE")
%%himl = @GETHANDLE(%2)
%3 = %3@chr(0)
%I = @Binary(DWORD,0)
If @null(%4)
%4 = 0
end
list add,%2,@strdel(%3,1)
LOADLIB shell32.dll
If @equal(%5,Large)
%X = @lib(shell32.dll,ExtractIconEx,INT:,INT:@addr("%3"),INT:%4,INT:@addr("%I"),NIL:,INT:1)
else
%X = @lib(shell32.dll,ExtractIconEx,INT:,INT:@addr("%3"),INT:%4,NIL:,INT:@addr("%I"),INT:1)
end
%%hIcon = @val(%I)
%%Result = @lib(comctl32.dll,ImageList_AddIcon,INT:,INT:%%himl,INT:%%hIcon)
FREELIB shell32.dll
GDI DESTROYICON,%%hIcon
end
FREELIB comctl32.dll
exit
end
#**********************IMAGELIST FUNCTIONS*************************************#
if @equal(%1,"GETHANDLE")
REM @IMAGELIST(GETHANDLE,<IMAGELIST>)
list seek,LHandles,0
If @match(LHandles,%2)
%%Fsep = @Fsep()
option fieldsep,"|"
parse ";%%Result", @item(LHandles)
else
error 4
end
elsif @equal(%1,"GETBKCOLOR")
REM @IMAGELIST(GETBKCOLOR,<IMGLIST>)
%%himl = @GETHANDLE(%2)
%%Result = @lib(comctl32.dll,ImageList_GetBkColor,INT:,INT:%%himl)
elsif @equal(%1,"GETIMAGECOUNT")
REM @IMAGELIST(GETIMAGECOUNT,<IMGLIST>)
%%himl = @GETHANDLE(%2)
%%Result = @lib(comctl32.dll,ImageList_GetImageCount,INT:%%himl)
elsif @equal(%1,"GETIMAGEINDEX")
REM @IMAGELIST(GETIMAGEINDEX,<IMGLIST>,<image>)
list seek,%2,0
%%Result = @match(%2,%3)
If @ok()
%%Result = @index(%2)
else
%%Result = -1
end
elsif @equal(%1,"GETINDEXIMAGE")
REM @IMAGELIST(GETINDEXIMAGE,<IMGLIST>,<imgIndex>)
list seek,%2,%3
If @ok()
%%Result = @item(%2)
else
%%Result = -1
end
end
FREELIB comctl32.dll
exit %%Result
end
exit
:GetHandle
list seek,LHandles,0
If @match(LHandles,%1)
%%Fsep = @Fsep()
option fieldsep,"|"
parse ";%%Result", @item(LHandles)
else
error 4
end
exit %%Result
:USER32
%%Result = 0
LOADLIB user32.dll
if @ok()
if @equal(%1,"GETWINDOWLONG")
REM @USER32(GETWINDOWLONG,<HWND>,<INT>)
if @equal(@substr(%2,1,1),"%")
%%hwnd = @strdel(%2,1,1)
else
%%hwnd = %2
end
%%Result = @lib(user32.dll,GetWindowLongA,INT:,%%hwnd,INT:%3)
elsif @equal(%1,"SETWINDOWLONG")
REM @USER32(SETWINDOWLONG,<HWND>,<INT>,<LONG>)
if @equal(@substr(%2,1,1),"%")
%%hwnd = @strdel(%2,1,1)
else
%%hwnd = %2
end
%%Result = @lib(user32.dll,SetWindowLongA,INT:,%%hwnd,INT:%3,@binary(DWORD,%4))
REM ////////////////////////////////////////////////////////
REM // DEVICE CONTEXT FUNCTIONS
REM ////////////////////////////////////////////////////////
elsif @equal(%1,"CREATECOMPATIBLEDC")
REM @USER32(CREATECOMPATIBLEDC,<HDC>)
%%Result = @lib(user32.dll,CreateCompatibleDC,INT:,%2)
elsif @equal(%1,"DELETEDC")
REM @USER32(DELETEDC,<HDC>)
%%Result = @lib(user32.dll,DeleteDC,BOOL:,%1)
elsif @equal(%1,"GETDC")
REM @USER32(GETDC,<HWND>)
if @equal(@substr(%2,1,1),"%")
%%hwnd = @strdel(%2,1,1)
else
%%hwnd = 0
end
%%Result = @lib(user32.dll,GetDC,INT:,%%hwnd)
elsif @equal(%1,"GETSTOCKOBJECT")
REM @USER32(GETSTOCKOBJECT,<INT>)
%%Result = @lib(user32.dll,GetStockObject,INT:,%2)
elsif @equal(%1,"RELEASEDC")
REM @USER32(RELEASEDC,<HWND>,<HDC>)
if @equal(@substr(%2,1,1),"%")
%%hwnd = @strdel(%2,1,1)
else
%%hwnd = 0
end
%%Result = @lib(user32.dll,ReleaseDC,INT:,%%hwnd,%3)
elsif @equal(%1,"LOADIMAGE")
REM @USER32(LOADIMAGE,<HINSTANCE>,<LPSTR>,<INT>,<INT>,<INT>,<INT>)
%%Result = @lib(user32.dll,LoadImageA,INT:,%2,STR:%3,INT:%4,INT:%5,INT:%6,%7)
REM ////////////////////////////////////////////////////////
REM // RECTANGLE FUNCTONS
REM ////////////////////////////////////////////////////////
elsif @equal(%1,"INFLATERECT")
REM @USER32(INFLATERECT,<LPRECT>,<INT>,<INT>)
%%Result = @lib(user32.dll,InflateRect,BOOL:,%2,%3,%4)
elsif @equal(%1,"PTINRECT")
REM @USER32(PTINRECT,<RECT>,<PT>)
%%Result = @lib(user32.dll,PtInRect,BOOL:,%2,%3)
REM ////////////////////////////////////////////////////////
REM // WINDOW FUNCTIONS
REM ////////////////////////////////////////////////////////
elsif @equal(%1,"GETCLIENTRECT")
REM @USER32(GETCLIENTRECT,<HWND>)
if @equal(@substr(%2,1,1),"%")
%%hwnd = @strdel(%2,1,1)
else
%%hwnd = %2
end
%A = @fill(16,@chr(0))
%%Result = @lib(user32.dll,GetClientRect,BOOL:,%%hwnd,@addr("%A"))
if @equal(%%Result,1)
%%buf = @val("%A")
%%Result = %%buf
else
%%Result = 1
end
elsif @equal(%1,"INVALIDATERECT")
REM USER32 INVALIDATERECT,<HWND>,<RECT>,<BOOL>
if @equal(@substr(%2,1,1),"%")
%%hwnd = @strdel(%2,1,1)
else
%%hwnd = %2
end
%%Result = @lib(user32.dll,InvalidateRect,BOOL:,%%hwnd,%3,%4)
elsif @equal(%1,"UPDATEWINDOW")
REM USER32 UPDATEWINDOW,<HWND>
if @equal(@substr(%2,1,1),"%")
%%hwnd = @strdel(%2,1,1)
else
%%hwnd = %2
end
%%Result = @lib(user32.dll,UpdateWindow,BOOL:,%%hwnd)
elsif @equal(%1,"DESTROYICON")
REM USER32 DESTROYICON,<HWND>
%%Result = @lib(user32.dll,DestroyIcon,BOOL:,INT:%2)
elsif @equal(%1,"MAKEINTRESOURCE")
REM USER32 MAKEINTRESOURCE,<INT>
%%Result = @lib(user32.dll,MAKEINTRESOURCE,WORD:,INT:%2)
end
FREELIB user32.dll
end
exit %%Result
|
Here's and example script to use with the above code. Plus I attached dis.bmp and en.bmp.
Code: | ###############
# TestApp.dsc #
###############
#DEFINE COMMAND,tItem
#INCLUDE ImageList.dsc
#Resource add,bitmap,dis.bmp
#Resource add,bitmap,en.bmp
Title TestApp
DIALOG CREATE,TestApp,-1,0,479,322
DIALOG ADD,BUTTON,Close,286,402,64,24,Close
DIALOG ADD,TABLE,TABLE1,8,8,463,266,AU[30]|Dev ID[80]|Type[80]
DIALOG SHOW
IMAGELIST CREATE,ItemImages,30,16,color32|mask,0,1
IMAGELIST ASSIGN,ItemImages,Table1,1
IMAGELIST SETBKCOLOR,ItemImages,$FFFFFFFF
REM Remove the "#" before each bmp file to use them not embedded
IMAGELIST ADDMASKED,ItemImages,#dis.bmp,$FFFFFF,30,16
IMAGELIST ADDMASKED,ItemImages,#en.bmp,$FFFFFF,30,16
List add,Table1,1@tab()DevId goes here@tab()Test
tItem Image,Table1,0,0,1
List add,Table1,0@tab()DevId2 goes here@tab()Test2
tItem Image,Table1,1,0,0
:Evloop
wait event
goto @event()
:CloseBUTTON
:Close
exit
:tItem
# tItem IMAGE,<Table>,<tIndex>,<Column>,<iImage>
If @equal(%1,IMAGE)
%X = @SENDMSG(@WINEXISTS(~%2),4150,$2,$2)
%L = @binary(DWORD,$2)@binary(DWORD,%3)@binary(DWORD,%4)@binary(DWORD,0)@binary(DWORD,0)@binary(DWORD,0)@binary(DWORD,0)@binary(DWORD,%5)@binary(DWORD,0)
%X = @SENDMSG(@WINEXISTS(~%2),4102,0,%L)
End
exit |
Description: |
|
Filesize: |
1.49 KB |
Viewed: |
34399 Time(s) |
|
Description: |
|
Filesize: |
1.49 KB |
Viewed: |
34398 Time(s) |
|
|
|
Back to top |
|
|
ShinobiSoft Professional Member
Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Wed Feb 27, 2008 4:00 am Post subject: |
|
|
Aslan wrote: | I'm only having issues adding images embedded in the VDS compiled executable as a resource to an ImageList. |
Hi Aslan,
Have you tried the ImageList_LoadBitmap() function to load an included
resource?
You can also use LoadBitmap() and LoadImage() and the use the handle obtained to call ImageList_Add() to add it to the imagelist.
I can provide an example if needed.
_________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
Back to top |
|
|
Aslan Valued Contributor
Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Wed Feb 27, 2008 5:00 am Post subject: |
|
|
ShinobiSoft wrote: | Have you tried the ImageList_LoadBitmap() function to load an included resource?
You can also use LoadBitmap() and LoadImage() and the use the handle obtained to call ImageList_Add() to add it to the imagelist.
I can provide an example if needed. |
Isn't LoadImage() the same as in the code above?
Code: | %%bmp = @USER32(LOADIMAGE,%%hInst,%3,0,%5,%6,%%LR_FLAGS)
REM @USER32(LOADIMAGE,<HINSTANCE>,<LPSTR>,<INT>,<INT>,<INT>,<INT>)
%%Result = @lib(user32.dll,LoadImageA,INT:,%2,STR:%3,INT:%4,INT:%5,INT:%6,%7) |
If you can whip one up real quick that would be great
Can you make it work with the example above?
|
|
Back to top |
|
|
ShinobiSoft Professional Member
Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Wed Feb 27, 2008 12:21 pm Post subject: |
|
|
Ok. Here goes... The following is kinda vague. I hope it points you in the
right direction. I'm too tired at the moment to go thru all of this line for
line at the moment. However, if a more detailed example is required I can
provide one after I get a little shut-eye...
Insert the following snippett in the above imagelist.dsc file under the
"IMAGELIST" command heading.
Code: |
elsif @equal(%1, "LOADIMAGE")
REM IMAGELIST LOADIMAGE,<HINSTANCE>,<LPCSTR>,<INT>,<INT>,<COLORREF>,<UINT>,<UINT>
%%Result = @lib(user32.dll, ImageList_LoadImage,INT:,INT:%2, STR:%3, INT: %4, INT:%5, INT:%6, INT:%7, INT:%8)
if @greater(%%Result,0)
REM Add %%Result to the LHandle list, etc...
end
|
To use the inserted code ->
Code: |
REM Use with a resource name
IMAGELIST LOADIMAGE,@KERNEL32(GetModuleHandle), en.bmp, 30, 0, $FFFFFF,0,0
REM Or use with a resource id
REM The following assumes that the resource en.bmp was included
REM as a resource like ->
REM #resource add,BITMAP,en.bmp,1
IMAGELIST LOADIMAGE,@KERNEL32(GetModuleHandle), @USER32(MAKEINTRESOURCE, 1), 30, 0, $FFFFFF, 0, 0
|
The Micro$oft PSDK states that an application that uses resources should
always refer to the resources by ordinal number instead of names to help
keep memory consumption to a minimum.
If I'm not mistaken VDS 5 provides a means for supplying an integer
identifier (ordinal id) for it's #resource directive included resources. The
ordinal ID should be the last parameter to the #resource directive
immediately following the resource name.
_________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
Back to top |
|
|
Aslan Valued Contributor
Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Wed Feb 27, 2008 4:56 pm Post subject: |
|
|
Thanks Bill
Now since this creates a new imagelist, how can I get the image added to the already existing imagelist that is assigned to the table.
To clarify: If I already have an imagelist created that has other images in it and it's already assigned to the table, can I transfer/copy the image from the ImageList created from the Image_LoadImage process?
I am assuming that for every embedded image I want to load there will be a new imagelist created.
Would the following thought process apply?:
1. Get embedded image with Imagelist_LoadImage function thereby creating a new imagelist.
2. Add/Copy image from new imagelist to existing imagelist
3. Destroy new imagelist
4. Repeat for every embedded image.
I hope that made sense
|
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Thu Feb 28, 2008 9:53 pm Post subject: |
|
|
Bill,
I thought "MAKEINTRESOURCE" was a #define macro not a function? Didn't think it was exported?
_________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
Aslan Valued Contributor
Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Thu Feb 28, 2008 11:07 pm Post subject: |
|
|
dragonsphere wrote: | Bill,
I thought "MAKEINTRESOURCE" was a #define macro not a function? Didn't think it was exported? |
Is this what you are refering to DragonSphere?
Quote: | This macro converts an integer value to a resource type compatible with Windows resource-management functions. This macro is used in place of a string containing the name of the resource.
LPTSTR MAKEINTRESOURCE(
WORD wInteger;
);Parameters
wInteger
Specifies the integer value to be converted.
Return Values
The return value is the specified value in the low-order word and zero in the high-order word.
Remarks
The return value should be passed only to the Microsoft® Win32® resource-management functions, as the lpType parameter.
The MAKEINTRESOURCE macro is defined as follows.
#define MAKEINTRESOURCE(i) (LPTSTR) ((DWORD) ((WORD) (i)))
| http://msdn2.microsoft.com/en-us/library/ms930224.aspx
|
|
Back to top |
|
|
Aslan Valued Contributor
Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Thu Feb 28, 2008 11:51 pm Post subject: |
|
|
Aslan wrote: | Now since this creates a new imagelist, how can I get the image added to the already existing imagelist that is assigned to the table.
|
In an attempt to answer my own question I think I could use ImageList_ExtractIcon to get the image handle to use with ImageList_Add, ImageList_AddMasked, or ImageList_AddIcon.
I haven't had a chance to test it yet.
The following assumes LOADLIB and FREELIB commands are present an some cleanup is needed after execution
Code: | %%hmod = @lib(kernel32.dll,GetModuleHandleA,INT:,NIL:)
%%img = en.bmp
%%clr = $FFFFFF
%w =30
REM Load image resource from self and get the handle to the image list the ImageList_LoadImage() macro created
%%tmp_himl = @lib(user32.dll,ImageList_LoadImage,INT:,INT:%%hmod,STR:%%img,INT:%w,INT:0,INT:%%clr,INT:0,INT:0)
REM Get the handle for the image in the new image list / index is 0
%%bmp = @lib(comctl32.dll,ImageList_ExtractIcon,INT:,INT:0,INT:%%tmp_himl,INT:0)
REM Get Handle of image list assigned to the Table
%%himl = @sendmsg(@winexists(~Table1),@sum($1000,2),1,0)
REM Add the icon to the image list assigned to the Table
%%Result = @lib(comctl32.dll,ImageList_AddIcon,INT:,INT:%%himl,INT:%%bmp)
REM Destroy the image list the ImageList_LoadImage() macro created
%%Result = @lib(comctl32.dll,ImageList_Destroy,BOOL:,%%tmp_himl) |
|
|
Back to top |
|
|
ShinobiSoft Professional Member
Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Fri Feb 29, 2008 1:08 am Post subject: |
|
|
dragonsphere wrote: | Bill,
I thought "MAKEINTRESOURCE" was a #define macro not a function? Didn't think it was exported? |
Actually you're right Johnny. I wasn't paying attention, but had noticed it
in the ImageList code posted above.
_________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|