adding an icon to drdialog programs - OS2

This is a discussion on adding an icon to drdialog programs - OS2 ; Hi, does anybody know a simple way to add an icon to programs created through DRDIALOG ? (I mean both the executable icon and the icon displayed in the upper left corner - i.e. the system menu) -- bye Alessandro...

+ Reply to Thread
Results 1 to 3 of 3

Thread: adding an icon to drdialog programs

  1. adding an icon to drdialog programs

    Hi,

    does anybody know a simple way to add an icon to programs created
    through DRDIALOG ? (I mean both the executable icon and the icon displayed
    in the upper left corner - i.e. the system menu)

    --
    bye
    Alessandro

  2. Re: adding an icon to drdialog programs

    HI Alessandro

    In drdialog the icon for the program object should be created when you
    make the exe using the rexstoexe tool, make sure you have an icon of the
    same name as the exe program, and it should auto place it, eg myprog.res
    with myprog.ico, if not simply open the property to your exe and then
    drag the icon to the icon page.

    as for the icon for the system menu you are out of luck, I actually
    experimented last week on this I made a rc file

    ICON myicon.ico

    then

    rc -r myrprog.rc myrryporg.res
    to create the resource file then

    rc myrryporg.res myprog.exe, but it did not work, in fact the program
    would not even start, note that I used a different *.res name, or rc
    will delete you drdialog program res file

    adrian


    wrote:

  3. Re: adding an icon to drdialog programs

    In article ,
    adrian suri wrote:

    Hi Adrian,

    I'm not sure about what you mean... if you put in the same path any
    executable file (.exe or .cmd) and an .ico file of the same name the
    wps use that icon... I know that...

    but if I write a PM program in C I can easily make it use an icon
    even if its main window is a dialog by loading the icon and then
    sending the WM_SETICON msg...
    to make the WPS use the same icon as the icon of the executable in
    that case I have to declare it in the resource file as icon ID 1...

    Anyway, after I wrote the message I found a solution.
    I added a new function to the dialog-controls library developed by
    Chris Wohlgemuth.

    To add icons to DDRdialog applications the following steps
    are needed:

    -1) source code, global routines, init:
    the new drctl016.dll and DRDlgSetIcon must be loaded

    -2) source code, main dialog initialization:
    call DRDlgSetIcon ,
    e.g.
    call DRDlgSetIcon 100, 1

    -3) save the source code and compile it as an executable via
    RESTOEXE.

    -4) put in a RC source file the statements for all the icons to be
    used by the new DRDIALOG application; e.g.:
    ICON 1 an.ico
    ICON 2 another.ico
    ...
    It is advisable to use the id 1 for the main icon of the
    application.

    -5) compile the new RC file as a RES file; e.g.:
    RC -R icon.rc
    this will produce the icon.res file

    -6) use Martin Lafaix's RESMGR to add the icon(s) to the program
    created via RESTOEXE; e.g.:
    RESMGR -a DEMO.EXE ICON.RES
    if ICON.RES contains an icon of id 1 the WPS now uses the new
    icon as DEMO.EXE icon (to see the new icon a folder refresh or
    opening the settings DEMO.EXE might be necessary)

    -7) use LXLITE to compress the resulting executable

    Note:
    the icon cannot be loaded while running the program via the DRDIALOG
    interface or DRREXX interfaces as it must be added to the resources
    only after a separate executable has been created.

    I sent the source code of the new function to Chris...
    if he likes he can add it to the next distribution of his library...
    or if somebody else needs it I can post it here...

    BTW it would not be bad to make a little DRDIALOG program to automate
    steps 4-7 to easily produce an 'iconized' DRDIALOG program

    >In drdialog the icon for the program object should be created when you
    >make the exe using the rexstoexe tool, make sure you have an icon of the
    >same name as the exe program, and it should auto place it, eg myprog.res
    >with myprog.ico, if not simply open the property to your exe and then
    >drag the icon to the icon page.
    >
    >as for the icon for the system menu you are out of luck, I actually
    >experimented last week on this I made a rc file
    >
    >ICON myicon.ico
    >
    >then
    >
    >rc -r myrprog.rc myrryporg.res
    >to create the resource file then
    >
    >rc myrryporg.res myprog.exe, but it did not work, in fact the program
    >would not even start, note that I used a different *.res name, or rc
    >will delete you drdialog program res file


    --
    bye
    Alessandro

+ Reply to Thread