[GIS] How to create a Button with custom Icons in Mapinfo 10

mapbasicmapinfo

I am using mapinfo 10 and I have created dll with Pelles C with 16*16 and 24*24 bmp images. I placed the dll file into folder containing .mbx file but I get error :

Unableable to locate external icon resource.

Am I missing something.

Code:

Create ButtonPad "mybuttonpad"  As
        ToggleButton
        ID 1001
        Icon 8001 File "icon.dll"
          Calling vendor_ButtonAction
          HelpMsg "ICONTEST"
Show

Best Answer

Two things to try:

1. Add the full path to your icon.dll. I normally create a constant aĆ³utside the main procedure and refer to this for all my buttons:

Define FILE_ICONS_DLL  ApplicationDirectory$() & "Icons.dll"

Sub Main
   Create ButtonPad "mybuttonpad"  As
        ToggleButton
        ID 1001
        Icon 8001 File FILE_ICONS_DLL
          Calling vendor_ButtonAction
          HelpMsg "ICONTEST"

2. If that doesn't fix it, try to use lower numbers for you icons, for instance 1 (and 2). Also I assume that you added the small icons as no 8001 and the larger as no 8002. Right?

Related Question