Error when I try to use slideshow?

237 views
Skip to first unread message

Stephen De Gabrielle

unread,
Aug 21, 2019, 11:40:45 PM8/21/19
to us...@racket-lang.org
Hi

I’m trying to help a user who is getting an error when trying to run slideshow:

I typed "#lang slideshow" into DrRacket and got the following error:

CreateIconIndirect: call failed (87)

Interactions disabled: slideshow does not support a REPL (no #%top-interaction)

They have two computers - slideshow works on a newer pc(win 10) but fails on one that has been upgraded from windows 7 to 10. I can’t determine any other difference.

Any ideas how I can help this user ?



Kind regards

Stephen

Alex Harsanyi

unread,
Aug 22, 2019, 12:58:13 AM8/22/19
to Racket Users
This may or may not work for them, but ask the user to open the "viewer.rkt" file in their racket installation (it should be in C:\Program Files\Racket\share\pkgs\slideshow-lib\slideshow) and comment out the `set-icon` call around line 1512.   That is, comment out the following block:

    (let* ([bm slideshow-bm]
           [mbm slideshow-mbm])
      (when (send bm ok?)
        (send f set-icon bm (and (send mbm ok?) mbm) 'both)))

This is the line in GitHub:

https://github.com/racket/slideshow/blob/c61c80de63cf7b2197d67c078bdc9133823c0030/slideshow-lib/slideshow/viewer.rkt#L1509

---

Others may come up with better workarounds, but this looks to me like a problem with the Racket GUI library.  Slideshow fails on my home PC but works on my work PC, both Windows 10 but different build numbers.  The problem is that the windows CreateIconIndirect API call is passed an invalid parameter (this is what code 87 means).  Not sure what the invalid parameter is (or why it is invalid), but it is probably either the bitmap or the mask.

Alex.

Stephen De Gabrielle

unread,
Aug 22, 2019, 10:19:29 AM8/22/19
to Racket Users
Thanks Alex!

Alex Harsanyi

unread,
Aug 23, 2019, 5:21:05 AM8/23/19
to Racket Users
If anyone is interested, this is the minimal program which reproduces the issue on Windows 10, version1809:

#lang racket/gui
(require racket/draw)

(define f (new frame% [label "hello"] [width 100] [height 100]))

(define bmp
 
(let* ([bm (make-object bitmap% 32 32)]
         
[dc (make-object bitmap-dc% bm)])
   
(send dc set-brush "red" 'solid)
    (send dc draw-rectangle 0 0 (send bm get-width) (send bm get-height))
    (send dc set-bitmap #f)

    bm))

(send f set-icon bmp #f '
both)
(send f show #t)


Any program which tries to set the icon on a frame will fail regardless of the icon.  Slideshow fails because it tries to set the icon on the frame.  It seems that the W32 API call CreateIconIndirect() fails because it thinks the bitmap passes in is invalid...

Alex.

Stephen De Gabrielle

unread,
Aug 23, 2019, 7:38:27 AM8/23/19
to Racket Users
Thanks Alex, your advice resolved the issue for the op, and another user reported the same problem but I expect your advice will help them too!

Thanks again
Stephen

PS I’m logging this as an issue for
https://github.com/racket/gui

Matthew Flatt

unread,
Aug 23, 2019, 9:17:08 AM8/23/19
to Alex Harsanyi, Racket Users
Thanks! After running System Update, I'm able to see the failure, too.

It looks like the problem is that the main bitmap given to
`CreateIconIndirect` is scaled, but the mask bitmap is not scaled (in
`bitmap->hbitmap`). So, replicating the error also requires a
high-resolution screen with scaling enabled.
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/e732aeef-af85-4281-b11b-933bb299
> e880%40googlegroups.com.

Stephen De Gabrielle

unread,
Aug 23, 2019, 10:13:24 AM8/23/19
to Racket Users
FYI 
Logged as https://github.com/racket/gui/issues/142

I tried to include the pertinent details including 
a) mitigation as suggested by Alex (reportedly successful)
b)  the minimal program which reproduces the issue provided by Alex

Hopefully (a) will help others experiencing this bug.

Kind regards, 
Stephen

Stephen De Gabrielle

unread,
Aug 23, 2019, 10:17:27 AM8/23/19
to Racket Users
Hi, 
It appears I hit [send] too soon; 

Matthew has *already* pushed a commit that is intended to resolve this issue.

Thank you Alex and Matthew.

Kind regards, 

Stephen
Reply all
Reply to author
Forward
0 new messages