.DLL e IMAGENES (.BMP, .ICO, .JPG)

HMG en Español

Moderator: Rathinagiri

User avatar
SALINETAS24
Posts: 667
Joined: Tue Feb 27, 2018 3:06 am
DBs Used: DBF
Contact:

.DLL e IMAGENES (.BMP, .ICO, .JPG)

Post by SALINETAS24 »

Hola grupo.

Tengo una duda.

¿ Es posible utilizar las imágenes que se encuentran en la ".DLL", por ejemplo en la SHELL32.DLL?

En caso afirmativo, ¿como puedo saber que imágenes hay en la ".DLL"?

y por ultimo, ¿es interesante el uso de la ".DLL", o es mejor desde nuestro fichero ".RC"?

Gracias, vamos con una cervecita fresquita y en casa ;)
Como dijo el gran pensador Hommer Simpson..., - En este mundo solo hay 3 tipos de personas, los que saben contar y los que no. :shock:
User avatar
danielmaximiliano
Posts: 2646
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: .DLL e IMAGENES (.BMP, .ICO, .JPG)

Post by danielmaximiliano »

Hola Salinetas , en Minigui tienes el ejemplo C:\MiniGUI\SAMPLES\Advanced\IconView
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
SALINETAS24
Posts: 667
Joined: Tue Feb 27, 2018 3:06 am
DBs Used: DBF
Contact:

Re: .DLL e IMAGENES (.BMP, .ICO, .JPG)

Post by SALINETAS24 »

Hola Daniel, gracias por tu respuesta.
El tema es que yo estoy usando HMG y el ejemplo que tu indicas no lo tengo, aparte de que según tengo entendido no es compatible.
Sl2
Como dijo el gran pensador Hommer Simpson..., - En este mundo solo hay 3 tipos de personas, los que saben contar y los que no. :shock:
martingz
Posts: 402
Joined: Wed Nov 18, 2009 11:14 pm
Location: Mexico

Re: .DLL e IMAGENES (.BMP, .ICO, .JPG)

Post by martingz »

Salinetas en cuanto a tu ultimo punto, creo que para mi es mejor usar mis imagenes e iconos dentro de mi RC, solo cargo las que utilizo, ni una mas, y asi las tengo dentro de mi ejecutable, contras aumenta mi tamaño del exe
no he tratado lo de usar imagenes de una dll, suena interesante, tendre que investigar un poco

saludos
User avatar
danielmaximiliano
Posts: 2646
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: .DLL e IMAGENES (.BMP, .ICO, .JPG)

Post by danielmaximiliano »

SALINETAS24 wrote: Mon Apr 27, 2020 3:29 pm Hola Daniel, gracias por tu respuesta.
El tema es que yo estoy usando HMG y el ejemplo que tu indicas no lo tengo, aparte de que según tengo entendido no es compatible.
Sl2

Code: Select all

/*
 * MiniGUI Icon Viewer Demo
 *
 * Copyright (c) 2004-2005 Grigory Filatov <gfilatov@inbox.ru>
*/

#include "minigui.ch"

#define APP_TITLE "Icon viewer"
#define VERSION " v.1.0"
#define COPYRIGHT " 2004-2005 Grigory Filatov"

Static cFileName := "", lOpened := .f.

/*
 *	Main()
 */
Procedure Main
Local hWnd, w := GetDesktopRectWidth(), h := GetDesktopRectHeight()

	SET DATE GERMAN

	DEFINE WINDOW Win_1 ;
		AT GetDesktopRectTop(), GetDesktopRectLeft() ;
		WIDTH w ;
		HEIGHT h ;
		TITLE APP_TITLE ;
		ICON "MAIN" ;
		MAIN ;
		ON PAINT IconShow() ;
		ON SIZE ButtonsResize() ;
		ON MAXIMIZE IF( lOpened, DoMethod( "Win_1", "Restore" ), ButtonsResize() ) ;
		FONT "Tahoma" SIZE 9

		DEFINE STATUSBAR 
			STATUSITEM "Copyright " + Chr(169) + COPYRIGHT
			KEYBOARD
			DATE
			CLOCK
		END STATUSBAR

		@ h-90, w-270 BUTTON Btn_Open ; 
			CAPTION '&Open a file...' ; 
			ACTION OpenFile() ; 
			WIDTH 120 ; 
			HEIGHT 26 ; 
			TOOLTIP "Open a file for view of icon" ;
			BOLD

		@ h-90, w-146 BUTTON Btn_Exit ; 
			CAPTION 'E&xit' ; 
			ACTION Win_1.Release ; 
			WIDTH 120 ; 
			HEIGHT 26 ; 
			TOOLTIP "Close this program" ;
			BOLD

		DEFINE CONTEXT MENU 
			ITEM 'Open a file...'	ACTION OpenFile()
			SEPARATOR	
			ITEM 'About'			ACTION MsgAbout()
		END MENU

	END WINDOW

	ACTIVATE WINDOW Win_1

Return

/*
 *	IconShow()
 */
FUNCTION IconShow()
Local i, y, z, x, bb, IcoL, s_, w

	Win_1.Btn_Open.Setfocus

	if lOpened
		Win_1.Row := GetDesktopRectTop()
		Win_1.Col := GetDesktopRectLeft()
		Win_1.Width := GetDesktopRectWidth()
		Win_1.Height := GetDesktopRectHeight()
		z := -32
		bb := -1
		x := ExtractIconEx(cFileName, -1, s_, IcoL, 1)
		if x == 0
			lOpened := .f.
			MsgStop('Icons is missing!', 'Warning', , .f.)
			Win_1.Title := APP_TITLE
		else
			w := Win_1.Width / 32
			for i := 0 to x / w
				x := -32 ; z += 32
				for y := 0 to w
					x+=32 ; bb++
					IcoL := ExtractIcon(cFileName, bb)
					DrawIcon(_HMG_MainHandle, x, z, IcoL)
					DestroyIcon(IcoL)
				next
				if z > 95
					x := 0
				endif
			next
		endif
	endif

RETURN NIL

/*
 *	OpenFile()
 */
FUNCTION OpenFile()
Local cOpenFile := Getfile( { {"All files with icons", "*.dll;*.exe;*.ico"}, ;
		{"All files", "*.*"} }, "Open a File" )

	cFileName := cOpenFile

	if !empty(cFileName).and.file(cFileName)
		Win_1.Title := cFileName + " - " + APP_TITLE
		lOpened := .t.
		InvalidateRect( GetFormHandle("Win_1") )
		Win_1.Maximize
		Win_1.Restore
	endif

RETURN NIL

/*
 *	ButtonsResize()
 */
FUNCTION ButtonsResize()

	Win_1.Btn_Open.Row := Win_1.Height-90
	Win_1.Btn_Open.Col := Win_1.Width-270
	Win_1.Btn_Exit.Row := Win_1.Height-90
	Win_1.Btn_Exit.Col := Win_1.Width-146

RETURN NIL

/*
 *	MsgAbout()
 */
Function MsgAbout()
return MsgInfo( APP_TITLE + VERSION + " - FREEWARE" + CRLF + ;
	"Copyright " + Chr(169) + COPYRIGHT + CRLF + CRLF + ;
	"eMail: gfilatov@inbox.ru" + CRLF + CRLF + ;
	padc("This program is Freeware!", 30) + CRLF + ;
	padc("Copying is allowed!", 36), "About", , .f. )


#pragma BEGINDUMP
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
SALINETAS24
Posts: 667
Joined: Tue Feb 27, 2018 3:06 am
DBs Used: DBF
Contact:

Re: .DLL e IMAGENES (.BMP, .ICO, .JPG)

Post by SALINETAS24 »

danielmaximiliano wrote: Mon Apr 27, 2020 6:36 pm
SALINETAS24 wrote: Mon Apr 27, 2020 3:29 pm Hola Daniel, gracias por tu respuesta.
El tema es que yo estoy usando HMG y el ejemplo que tu indicas no lo tengo, aparte de que según tengo entendido no es compatible.
Sl2

Code: Select all

/*
 * MiniGUI Icon Viewer Demo
 *
 * Copyright (c) 2004-2005 Grigory Filatov <gfilatov@inbox.ru>
*/

#include "minigui.ch"

#define APP_TITLE "Icon viewer"
#define VERSION " v.1.0"
#define COPYRIGHT " 2004-2005 Grigory Filatov"
Muchas gracias por tu rápida respuesta y por tu ejemplo, pero no puedo compilarlo ya que utilizo HMG y este ejemplo es para MINIGUI y muchas funciones o son distintas o no existen.
Un saludo.

Code: Select all

Harbour 3.2.0dev (r1703241902)
Copyright (c) 1999-2016, http://harbour-project.org/
C:/DOCUME~1/PROPIE~1/CONFIG~1/Temp/hbmk_3q7t9v.dir/DLL.o:DLL.c:(.data+0x38): undefined reference to `HB_FUN_GETDESKTOPRECTWIDTH'
C:/DOCUME~1/PROPIE~1/CONFIG~1/Temp/hbmk_3q7t9v.dir/DLL.o:DLL.c:(.data+0x48): undefined reference to `HB_FUN_GETDESKTOPRECTHEIGHT'
C:/DOCUME~1/PROPIE~1/CONFIG~1/Temp/hbmk_3q7t9v.dir/DLL.o:DLL.c:(.data+0x98): undefined reference to `HB_FUN_GETDESKTOPRECTLEFT'
C:/DOCUME~1/PROPIE~1/CONFIG~1/Temp/hbmk_3q7t9v.dir/DLL.o:DLL.c:(.data+0xa8): undefined reference to `HB_FUN_GETDESKTOPRECTTOP'
C:/DOCUME~1/PROPIE~1/CONFIG~1/Temp/hbmk_3q7t9v.dir/DLL.o:DLL.c:(.data+0x238): undefined reference to `HB_FUN_EXTRACTICONEX'
C:/DOCUME~1/PROPIE~1/CONFIG~1/Temp/hbmk_3q7t9v.dir/DLL.o:DLL.c:(.data+0x278): undefined reference to `HB_FUN_DRAWICON'
C:/DOCUME~1/PROPIE~1/CONFIG~1/Temp/hbmk_3q7t9v.dir/DLL.o:DLL.c:(.data+0x298): undefined reference to `HB_FUN_DESTROYICON'
collect2.exe: error: ld returned 1 exit status
hbmk2: Error: Ejecutando enlazador. 1
gcc.exe C:/DOCUME~1/PROPIE~1/CONFIG~1/Temp/hbmk_3q7t9v.dir/DLL.o C:/DOCUME~1/PROPIE~1/CONFIG~1/Temp/hbmk_3q7t9v.dir/hbmk_2eej3b.o C:/hmg.3.4.4/SAMPLES/EJEMPLOS_FORO/ICO_DLL/_temp.o    -pthread  -static-libgcc  -static-libstdc++  -static -lpthread -mwindows -Wl,--start-group -lhmg -lcrypt -ledit -leditex -lgraph -lini -lreport -lhfcl -lmsvfw32 -lvfw32 -lhbmysql -lmysql -lhbfimage -lhbpgsql -lsddmy -lhbvpdf -lhbct -lhbwin -lhbmzip -lminizip -lhbmemio -lhbmisc -lhbtip -lsqlite3 -lhbsqlit3 -lsddodbc -lrddsql -lhbodbc -lodbc32 -lhbhpdf -lhbnetio -lxhb -lpng -llibhpdf -lhbzebra -lhbextern -lhbdebug -lhbvmmt -lhbrtl -lhblang -lhbcpage -lgtcgi -lgtpca -lgtstd -lgtwin -lgtwvt -lgtgui -lhbrdd -lhbuddall -lhbusrrdd -lrddntx -lrddcdx -lrddnsx -lrddfpt -lhbrdd -lhbhsx -lhbsix -lhbmacro -lhbcplr -lhbpp -lhbcommon -lhbmainwin -lkernel32 -luser32 -lgdi32 -ladvapi32 -lws2_32 -liphlpapi -lwinspool -lcomctl32 -lcomdlg32 -lshell32 -luuid -lole32 -loleaut32 -lmpr -lwinmm -lmapi32 -limm32 -lmsimg32 -lwininet -lhbpcre -lhbzlib   -Wl,--end-group -oDLL.exe  -Lc:/hmg.3.4.4/harbour/lib/win/mingw -Lc:/hmg.3.4.4/lib

hbmk2: Error: Función(es) referenciada, no encontrada, pero desconocida:
       GETDESKTOPRECTWIDTH(), GETDESKTOPRECTHEIGHT(), GETDESKTOPRECTLEFT(),
       GETDESKTOPRECTTOP(), EXTRACTICONEX(), DRAWICON(), DESTROYICON()
Como dijo el gran pensador Hommer Simpson..., - En este mundo solo hay 3 tipos de personas, los que saben contar y los que no. :shock:
User avatar
danielmaximiliano
Posts: 2646
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: .DLL e IMAGENES (.BMP, .ICO, .JPG)

Post by danielmaximiliano »

Salinetas : en mi computador funciona el ejemplo. uso HMG.3.4.4 :?
2020-04-28 11_18_37-Greenshot.png
2020-04-28 11_18_37-Greenshot.png (94.67 KiB) Viewed 2845 times
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
SALINETAS24
Posts: 667
Joined: Tue Feb 27, 2018 3:06 am
DBs Used: DBF
Contact:

Re: .DLL e IMAGENES (.BMP, .ICO, .JPG)

Post by SALINETAS24 »

Hola Daniel, yo solo uso HMG.3.4.4 y no me funciona.
Es más, he rastreado la búsqueda de las funciones en los fuentes y no se encuentran, solo he encontrado esto en C_WINDOW.C

Code: Select all

HB_FUNC (GETDESKTOPWIDTH) 
HB_FUNC (GETDESKTOPHEIGHT)
HB_FUNC (GETDESKTOPREALTOP) 
HB_FUNC (GETDESKTOPREALLEFT) 
HB_FUNC (GETDESKTOPREALWIDTH) 
HB_FUNC (GETDESKTOPREALHEIGHT) 
//        GetDesktopWindow () --> hWndDesktop
HB_FUNC ( GETDESKTOPWINDOW )
   HWND hWnd = GetDesktopWindow();
Sl2
Como dijo el gran pensador Hommer Simpson..., - En este mundo solo hay 3 tipos de personas, los que saben contar y los que no. :shock:
User avatar
AUGE_OHR
Posts: 2096
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: .DLL e IMAGENES (.BMP, .ICO, .JPG)

Post by AUGE_OHR »

hi,

you need to "extract" HB_FUNC from extended Version to use that Code with HMG.
also you need to modify Code

Code: Select all

   IcoL := ExtractIcon(cFileName, bb)
   DrawIcon(_HMG_MainHandle, x, z, IcoL)
which is

Code: Select all

#translate <p:Application,App>.Handle          => _HMG_MainHandle
have fun
Jimmy
User avatar
SALINETAS24
Posts: 667
Joined: Tue Feb 27, 2018 3:06 am
DBs Used: DBF
Contact:

Re: .DLL e IMAGENES (.BMP, .ICO, .JPG)

Post by SALINETAS24 »

Gracias, lo pruebo.
Sl2
Como dijo el gran pensador Hommer Simpson..., - En este mundo solo hay 3 tipos de personas, los que saben contar y los que no. :shock:
Post Reply