Announcement

Collapse

Maintenance

The forum could be offline for 30-60 minutes in the very near future for maintenance (said 3pm Pacific). I was behind on getting this notice. I do apologize.
See more
See less

Why won't the following work?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Why won't the following work?

    Shouldn't the following code place an icon on a DDT dialog based on the threads I've read? Instead I get my dialog but no icon. What am I doing wrong?


    #COMPILE EXE
    #INCLUDE "WIN32API.INC"
    #INCLUDE "COMDLG32.INC"

    FUNCTION PBMAIN () AS LONG

    $REGISTER NONE

    LOCAL hDlg AS LONG
    LOCAL hIcon AS LONG

    'Create a new dialog template
    DIALOG NEW 0, "blah blah blah...",,,300,50,0,0 TO hDlg

    'Display the dialog
    DIALOG SHOW MODAL hDlg

    'add an icon from a powerbasic sample program
    hIcon=Loadimage(BYVAL %Null, BYCOPY "c:\pbdll60\samples\pbnote\pbnote.ico",%Image_icon,0,0,%LR_loadfromfile OR %LR_defaultsize)
    DIALOG SEND hDlg,%WM_seticon,%Icon_big,hIcon

    END FUNCTION

  • #2
    Did you check the result from LoadImage() to see if it was successful?

    Did you check the result from DIALONG SEND to see if it was successful?

    { it's called 'debugging' )

    --Dave


    ------------------
    Home of the BASIC Gurus
    www.basicguru.com
    Home of the BASIC Gurus
    www.basicguru.com

    Comment


    • #3

      In addition to Dave's comments as good coding practice. You are
      showing a modal dialog and not calling the icon functions until
      after the dialog is destroyed. Move the Dialog Show code AFTER
      the icon code.



      ------------------
      Jim..
      [email protected]
      Jim..

      Comment


      • #4
        Thanks Jim...you suggestion worked!

        Comment


        • #5
          Dear Mr. Wow...

          Handles aren't allowed here, only real names. We'd appreciate it if you would re-register accurately. Thanks!

          Bob Zale
          PowerBASIC Inc.


          ------------------

          Comment

          Working...
          X