DEFAULT ICON (for example using inputbox)

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: DEFAULT ICON (for example using inputbox)

Post by esgici »

Please clarify : it seems that this DEFAULT ICON not only for InputBox :?

TIA
Viva INTERNATIONAL HMG :D
trmpluym
Posts: 303
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands

Re: DEFAULT ICON (for example using inputbox)

Post by trmpluym »

Correct, when you do not define a icon for a window, this icon is used.

Here the help from HMG MiniGui

The main icon defined by user could be used as default icon to all other windows.

SYNTAX

SET DEFAULT ICON TO <cIconName>
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

DEFAULT ICON (for example using inputbox)

Post by Pablo César »

I did not tested this upto now.

Thank you Claudio !

I made like this:

SET DEFAULT ICON TO "youtube.ico"

And I got this:
Tela01.png
Tela01.png (30.83 KiB) Viewed 2827 times
But MsgInfo and C_MsgBox are display other default icon. I guess this is from API ?

Is this normal ?
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

Re: DEFAULT ICON (for example using inputbox)

Post by bpd2000 »

Pablo César wrote:But MsgInfo and C_MsgBox are display other default icon. I guess this is from API ?

Is this normal ?
+1
BPD
Convert Dream into Reality through HMG
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: DEFAULT ICON (for example using inputbox)

Post by srvet_claudio »

Pablo César wrote:But MsgInfo and C_MsgBox are display other default icon. I guess this is from API ?

Is this normal ?
Yes, is normal,
but ...

Code: Select all

#include "hmg.ch"

Function main()

   SET DEFAULT ICON TO "DefaultIcon.ICO"

	DEFINE WINDOW Form_1 ;
		AT 0,0 ;
		WIDTH 640 ;
		HEIGHT 480 ;
		MAIN ;

		@ 50 ,100 BUTTON Button_1 ;
			CAPTION "Press" ;
			ACTION MsgInfo ("Text","Title")


	END WINDOW

   CREATE EVENT PROCNAME SetDialogBoxIcon() STOREINDEX nIndex
   EventProcessAllHookMessage ( nIndex, .T. )

	CENTER WINDOW Form_1

	ACTIVATE WINDOW Form_1

Return



FUNCTION SetDialogBoxIcon
STATIC hIcon := 0, Old_hWnd := 0
LOCAL hWnd := EventHWND()

   IF Old_hWnd <> hWnd .AND. GetClassName ( hWnd ) == "#32770"
      Old_hWnd := hWnd

      IF hIcon == 0
         hIcon := HMG_LOADICON ( _HMG_DefaultIconName )
      ENDIF

      IF hIcon <> 0
         #define GCLP_HICON   (-14)
         SetClassLongPtr (hWnd, GCLP_HICON, hIcon) 
      ENDIF
   ENDIF

RETURN NIL



#pragma BEGINDUMP

#include "SET_COMPILE_HMG_UNICODE.ch"
#include "HMG_UNICODE.h"


#include <windows.h>
#include "hbapi.h"


HB_FUNC ( HMG_LOADICON )
{
   TCHAR *cIconName = (TCHAR *) HMG_parc (1);
   HICON hIcon = NULL;
   if ( cIconName != NULL )
   {    hIcon = LoadImage (GetModuleHandle (NULL), cIconName, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_LOADTRANSPARENT);
        if ( hIcon == NULL )
             hIcon = LoadImage (NULL, cIconName, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_LOADTRANSPARENT | LR_LOADFROMFILE);
   }
   HMG_retnl ((LONG_PTR) hIcon);
}

#pragma ENDDUMP
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

DEFAULT ICON (for example using inputbox)

Post by Pablo César »

Yeahhh !

Thank you Claudio.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
serge_girard
Posts: 3166
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: DEFAULT ICON (for example using inputbox)

Post by serge_girard »

Thanks Grigory and Claudio !

Serge
There's nothing you can do that can't be done...
User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

Re: DEFAULT ICON (for example using inputbox)

Post by bpd2000 »

srvet_claudio wrote:
Pablo César wrote:But MsgInfo and C_MsgBox are display other default icon. I guess this is from API ?

Is this normal ?
Yes, is normal,
but ...
Thank you
BPD
Convert Dream into Reality through HMG
Post Reply