Msg Box Icon Help

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
Claudio Ricardo
Posts: 367
Joined: Tue Oct 27, 2020 3:38 am
DBs Used: DBF, MySQL, MariaDB
Location: Bs. As. - Argentina

Msg Box Icon Help

Post by Claudio Ricardo »

Hi All...
How we have: Set DialogBox Row & Col
No have (or i don't found): Set Default DialogBox TitleBar Icon To "name of resource"
I wanna change default icon for app icon, If it's possible, How ? Any idea or sample please.
Thanks in advance !
Corrige al sabio y lo harás más sabio, Corrige al necio y lo harás tu enemigo.
WhatsApp / Telegram: +54 911-63016162
User avatar
salamandra
Posts: 311
Joined: Thu Jul 31, 2008 8:33 pm
DBs Used: DBF, MySQL, SQL
Location: Brazil

Re: Msg Box Icon Help

Post by salamandra »

Hola Claudio Ricardo,
Claudio Ricardo wrote: Thu Apr 01, 2021 2:29 pm Hi All...
How we have: Set DialogBox Row & Col
No have (or i don't found): Set Default DialogBox TitleBar Icon To "name of resource"
I wanna change default icon for app icon, If it's possible, How ? Any idea or sample please.
Thanks in advance !
No sé si entendi correctamente lo que precisas, mas..
Dale una ojeada a este tópico: https://hmgforum.com/viewtopic.php?f=5& ... con#p35560

Y para cambiar el icono de tu programa, SET DEFAULT ICON TO 'iconres00', donde 'iconres00' es un icono definido en tu archivo .RC
Con esta instruccion SET, otdas las ventanas que no tengan un icono definido usaran 'iconres00' .


Saludos,


Salamandra, Brazil
There is one time in which is crucial awakening. That time is now. ( Buddha )
User avatar
Claudio Ricardo
Posts: 367
Joined: Tue Oct 27, 2020 3:38 am
DBs Used: DBF, MySQL, MariaDB
Location: Bs. As. - Argentina

Re: Msg Box Icon Help

Post by Claudio Ricardo »

Gracias Salamandra...
Me evita tener que setearle el icono a cada ventana (que ya es una gran ayuda) pero no cambia
los que yo quiero, que son los del titulo de las ventanas: MsgInfo, MsgStop, MsgYesNo, Etc.
Quiero cambiar ese que viene por defecto por el mismo de las ventanas del programa !
Ahora tiene el pinguino "Tux" pero luego pondré el de la empresa cambiandolo en el .rc
Screenshot_20210401_224425.png
Screenshot_20210401_224425.png (58.69 KiB) Viewed 14707 times
Probaré lo que indican en el post que me sugerís...
Corrige al sabio y lo harás más sabio, Corrige al necio y lo harás tu enemigo.
WhatsApp / Telegram: +54 911-63016162
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Msg Box Icon Help

Post by AUGE_OHR »

hi,

as i can say "MessageBox" does not have any Icon in upper left.
https://docs.microsoft.com/en-us/window ... messagebox
also it have only 4 Constant for "build-in" Icon (see Remarks)

---

when look into c:\hmg.3.4.4\SOURCE\c_msgbox.c i saw "MessageBoxIndirect" where i can use own Icon

Code: Select all

*   MSGInfo( cText, "Help ... under construction" )
   MessageBoxIndirect ( , cText, "Help HBFM Shortcut", MB_TOPMOST, "AUGEOHR" )
MessageBoxIndirect.jpg
MessageBoxIndirect.jpg (50.66 KiB) Viewed 14671 times
have fun
Jimmy
User avatar
Claudio Ricardo
Posts: 367
Joined: Tue Oct 27, 2020 3:38 am
DBs Used: DBF, MySQL, MariaDB
Location: Bs. As. - Argentina

Re: Msg Box Icon Help

Post by Claudio Ricardo »

Hi Jimmy...
This icon i say:
Screenshot_20210402_065746.png
Screenshot_20210402_065746.png (1.77 KiB) Viewed 14634 times
In you MS page link example, messagebox no have titlebar icon ¿? HMG put it ?
I want change or directly remove it !... Like this own made modal window:
Screenshot_20210402_073014.png
Screenshot_20210402_073014.png (14.61 KiB) Viewed 14634 times
I thought there was some parameter for that and I couldn't find it.
Now I know there is not and so I make them like the last photo.

Thank you so much for helpme !
Corrige al sabio y lo harás más sabio, Corrige al necio y lo harás tu enemigo.
WhatsApp / Telegram: +54 911-63016162
User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

Re: Msg Box Icon Help

Post by bpd2000 »

Hi
Attached demo may help you
Attachments
IconChange.zip
(1.29 MiB) Downloaded 92 times
BPD
Convert Dream into Reality through HMG
User avatar
Claudio Ricardo
Posts: 367
Joined: Tue Oct 27, 2020 3:38 am
DBs Used: DBF, MySQL, MariaDB
Location: Bs. As. - Argentina

Re: Msg Box Icon Help

Post by Claudio Ricardo »

Thanks BPD... But it is for change in modal window and i need change in standard message
like: MsgInfo(), MsgStop(), MsgYesNo()
I discover: if i set MB_SYSTEMMODAL = have the icon, MB_APPLMODAL = no icon
If i change it in c_msgbox.c and recompile, bye icon :)
Corrige al sabio y lo harás más sabio, Corrige al necio y lo harás tu enemigo.
WhatsApp / Telegram: +54 911-63016162
User avatar
Claudio Ricardo
Posts: 367
Joined: Tue Oct 27, 2020 3:38 am
DBs Used: DBF, MySQL, MariaDB
Location: Bs. As. - Argentina

Re: Msg Box Icon Help

Post by Claudio Ricardo »

Una imagen vale más que mil palabras...
Screenshot_20210402_095120.png
Screenshot_20210402_095120.png (17.05 KiB) Viewed 14613 times
Muchas gracias a todos !!!
Corrige al sabio y lo harás más sabio, Corrige al necio y lo harás tu enemigo.
WhatsApp / Telegram: +54 911-63016162
User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

Re: Msg Box Icon Help

Post by bpd2000 »

Also refer function WAPI_MESSAGEBOX
BPD
Convert Dream into Reality through HMG
User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: Msg Box Icon Help

Post by mustafa »

Hola Claudio Ricardo

Para sacar icon en MsgStop, MsgInfo etc
tiene que ser la solución del Dr. Claudio Soto

https://hmgforum.com/viewtopic.php?f=5& ... n&start=10

El Sample del amigo bpd2000 ==> IconChange.zip

Añade este código y se soluciona ICON en las Ventanas ==> MsgInfo etc.etc.

Code: Select all

/*
Demo for how to use "Set Default Icon To" command
bpd2000
*/

#include "hmg.ch"

Function Main
Set Default Icon To GetStartupFolder() + "\Main.ico"

   DEFINE WINDOW Form_1 ;
      AT 0,0 ;
      WIDTH 500 HEIGHT 300 ;
      TITLE 'Demo for "Set Default Icon To"';
      MAIN
 
      @ 50, 50 BUTTON Button_1 CAPTION "&First" ACTION ModalWin("URUGUAY.ico")
      @ 50, 200 BUTTON Button_2 CAPTION "&Second" ACTION ;
      (Icochange(), ;
      InputBox ( 'Enter text. Please be so kind to read this long description ;-)' , 'InputBox Demo - Icon Changed' , 'Default Value' ) )
      @ 50, 350 BUTTON Button_3 CAPTION "&MsgInfo" ACTION ( inOX1() , inOX2() )    

    ON KEY ESCAPE OF MAIN ACTION thiswindow.release()
   END WINDOW

*-----------------------------------------  Añadir  Codigo  Dr. Claudio Soto -----------------------------*
   CREATE EVENT PROCNAME SetDialogBoxIcon() STOREINDEX nIndex
   EventProcessAllHookMessage ( nIndex, .T. )
*---------------------------------------------------------------------------------------------------------------*

   CENTER WINDOW Form_1
   ACTIVATE WINDOW Form_1
Return Nil


Procedure ModalWin(cIcoName)
 
Set Default Icon To GetStartupFolder() + "\" + cIcoName
   IF _IsWindowDefined ( "Form_2" ) == .F.
      DEFINE WINDOW Form_2 ;  
          AT 0,0;  
          WIDTH 200;  
          HEIGHT 200;
          TITLE "Icon changed" ;
          MODAL
        
          @ 10 , 10 LABEL Label_1 VALUE "See Modal Window's icon" AUTOSIZE
          @ 40 , 10 LABEL Label_2 VALUE "Effect of Set Default Icon To" AUTOSIZE
      ON KEY ESCAPE OF cFormName1 ACTION thiswindow.release()
      END WINDOW
   
      CENTER WINDOW Form_2
      ACTIVATE WINDOW Form_2
   ENDIF
Return

Procedure Icochange()
  Set Default Icon To GetStartupFolder() + "\NEW.ico"
Return 


*---------------------------  MsgStop y MsgInfo -------------------*

PROCEDURE inOX1()

Set Default Icon To GetStartupFolder() + "\Main.ico"

  MsgStop("Hola amigo1","Titulo1")

Return Nil 

PROCEDURE inOX2()

Set Default Icon To GetStartupFolder() + "\Main.ico"

  MsgInfo("Hola amigo2","Titulo2")

Return Nil 


*---------------------------------- Código Dr.Claudio Soto  ---------------------------------*

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

Saludos,Regards,Salam

Mustafa
Post Reply