extract Icon with HMG

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
AUGE_OHR
Posts: 2117
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

extract Icon with HMG

Post by AUGE_OHR »

hi,

i want to extract Icon from EXE using HMG

there is a Sample in MiniGUI Extended Version using
ExtractIcon() / ExtractIconEX() but HMG have only ExtractIcon()

so how with HMG :idea:
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2117
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: extract Icon with HMG

Post by AUGE_OHR »

hi,

this is the MiniGUI Code

Code: Select all

#include "minigui.ch"
#include "i_winuser.ch"
#include "common.ch"

PROCEDURE MAIN(cFile,cSavePath)

DEFAULT cSavePath TO GetTempFolder()

   IF EMPTY(cFile)
      MsgInfo("need File ")
      QUIT
   ELSEIF !FILE(cFile)
      MsgInfo("File "+cFile+ " not Found")
      QUIT
   ENDIF

   SaveThisIcon( cFile, 0 ,cSavePath)

RETURN

FUNCTION SaveThisIcon( cSrcName, nI ,cSavePath)
LOCAL cPath := Pathonly(cSrcName)
LOCAL cIcoName

   cIcoName := STRTRAN(cSrcName,cPath,"")
   cIcoName := cSavePath+"\"+STRTRAN(UPPER(cIcoName),".EXE",".ICO")
   SaveIcon( cIcoName, cSrcName, nI )

RETURN NIL

FUNCTION SaveIcon( cIconName, cIconSrc, nItem )
LOCAL aIcons := ExtractIconEx( cIconSrc, nItem )
RETURN C_SaveHIconToFile( cIconName, aIcons )

FUNCTION Pathonly(cIn)
LOCAL nPosi, cRet := ""

   nPosi:= RAT("\",cIn)
   if nPosi > 0
      cRet := SUBSTR(cIn,1,nPosi)
   endif
RETURN cRet
have fun
Jimmy
Post Reply