Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I need help
#1
This code will not run on my machine. It is a Windows 10 pro system.  The compiler says the code is OK. But error Invalid Handle on line 25 generates.
Does anyone know what is wrong?


Attached Files
.bas   whatswrong.bas (Size: 1.1 KB / Downloads: 9)
Reply
#2
I think its the 33 for hardware image thats off, should be 32 is my guess.

This works, i put something on the screen to have something to show
Code: (Select All)
Dim s As Long
Dim s32 As Long
Dim s10 As Long

s = _NewImage(1200, 700, 32)

Screen s
_ScreenMove 0, 0
_Delay .3 ' seem to get blank screen first delay to get full screen setup

For i = 1 To 1000
    Print "Hello World! ";
Next
s32 = _ScreenImage

_PutImage , s32, s
s10 = _CopyImage(s32, 32) ' <<<< not 33
_FreeImage s32

_Delay 5
Cls

_Delay 2
_PutImage (0, 0), s10, s

_Delay 5
System

I added some mods for smoother working IMHO
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#3
Has something to do with it being a s10 being a hardware Image 


When I change the _CopyImage to s10 to a , 32 instead of a 33 the error goes away.

I'm not an expert on Hardware images,   They work differently and are more ephemeral than
software Image handles.
Reply
#4
You guys are close, but missing the point entirely.

Line 25 is an error as hardware images don't have a destination handle to go to.  They go to their own designated screen automagically.

This is the line in question:
Code: (Select All)
_PutImage (0, 0), s10, s

This is the correct syntax:
Code: (Select All)
_PutImage (0, 0), s10

It's that simple.  Big Grin

Now the problem after it compiles and runs is that hardware images only last a single frame.  That END immediately after is going to erase the screen instantly and go to the standard software screen of "Press any key to quit".

Notice how I've trapped that hardware display inside a loop here so you can see it and interact with it, before the program ends:

Code: (Select All)
Dim s As Long

Dim s32 As Long

Dim s10 As Long

s = _NewImage(1300, 1000, 32)

Screen s

s32 = _ScreenImage
_Delay .2
_PutImage (0, 0), s32, s

s10 = _CopyImage(s32, 33)

_FreeImage s32

Sleep

Cls , 0
Color , 0
Sleep
_KeyClear
_DisplayOrder _Hardware , _Software
Do
_PutImage (0, 0), s10
Print "INSIDE THE HARDWARE LOOP!"
_Limit 30
_Display
Loop Until _KeyHit > 0

End

The only real change (besides some stuff for the display loop) was just removing that destination parameter on the hardware image.
Reply
#5
Code: (Select All)
Dim s As Long
Dim s32 As Long
Dim s10 As Long

s = _NewImage(1200, 700, 32)

Screen s
_ScreenMove 0, 0
_Delay .3 ' seem to get blank screen first delay to get full screen setup

For i = 1 To 1000
Print "Hello World! ";
Next
s32 = _ScreenImage

_PutImage , s32, s
s10 = _CopyImage(s32, 33)
_FreeImage s32

_Delay 2
Cls
_KeyClear

_Delay 2
Do
_Limit 30
_PutImage (0, 0), s10
Loop Until Len(InKey$)
Reply
#6
(01-31-2026, 07:10 PM)SMcNeill Wrote: You guys are close, but missing the point entirely.

Line 25 is an error as hardware images don't have a destination handle to go to.  They go to their own designated screen automagically.

This is the line in question:
Code: (Select All)
_PutImage (0, 0), s10, s

This is the correct syntax:
Code: (Select All)
_PutImage (0, 0), s10

It's that simple.  Big Grin

Now the problem after it compiles and runs is that hardware images only last a single frame.  That END immediately after is going to erase the screen instantly and go to the standard software screen of "Press any key to quit".

Notice how I've trapped that hardware display inside a loop here so you can see it and interact with it, before the program ends:

Code: (Select All)
Dim s As Long

Dim s32 As Long

Dim s10 As Long

s = _NewImage(1300, 1000, 32)

Screen s

s32 = _ScreenImage
_Delay .2
_PutImage (0, 0), s32, s

s10 = _CopyImage(s32, 33)

_FreeImage s32

Sleep

Cls , 0
Color , 0
Sleep
_KeyClear
_DisplayOrder _Hardware , _Software
Do
    _PutImage (0, 0), s10
    Print "INSIDE THE HARDWARE LOOP!"
    _Limit 30
    _Display
Loop Until _KeyHit > 0

End

The only real change (besides some stuff for the display loop) was just removing that destination parameter on the hardware image.

maybe so, but the question remains did Frederick originally intend on using a hardware image? becuase he does not explicitly state that he was and his code looks like an experiment with images, I wont know for sure until he says one way or the other. I hope he will reply to this and not be another hit and run.
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#7
(01-31-2026, 07:10 PM)SMcNeill Wrote: You guys are close, but missing the point entirely.

Line 25 is an error as hardware images don't have a destination handle to go to.  They go to their own designated screen automagically.

This is the line in question:
Code: (Select All)
_PutImage (0, 0), s10, s

This is the correct syntax:
Code: (Select All)
_PutImage (0, 0), s10

It's that simple.  Big Grin

Now the problem after it compiles and runs is that hardware images only last a single frame.  That END immediately after is going to erase the screen instantly and go to the standard software screen of "Press any key to quit".

Notice how I've trapped that hardware display inside a loop here so you can see it and interact with it, before the program ends:

Code: (Select All)
Dim s As Long

Dim s32 As Long

Dim s10 As Long

s = _NewImage(1300, 1000, 32)

Screen s

s32 = _ScreenImage
_Delay .2
_PutImage (0, 0), s32, s

s10 = _CopyImage(s32, 33)

_FreeImage s32

Sleep

Cls , 0
Color , 0
Sleep
_KeyClear
_DisplayOrder _Hardware , _Software
Do
    _PutImage (0, 0), s10
    Print "INSIDE THE HARDWARE LOOP!"
    _Limit 30
    _Display
Loop Until _KeyHit > 0

End

The only real change (besides some stuff for the display loop) was just removing that destination parameter on the hardware image.

Thank You for the information. You are correct. I removed the destination and added a loop runs good.
Reply
#8
Frederick:
Quote:Thank You for the information. You are correct. I removed the destination and added a loop runs good.

Ok thanks for reply @Frederick  I have closure Smile
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#9
(01-31-2026, 06:05 PM)bplus Wrote: I think its the 33 for hardware image thats off, should be 32 is my guess.

This works, i put something on the screen to have something to show
Code: (Select All)
Dim s As Long
Dim s32 As Long
Dim s10 As Long

s = _NewImage(1200, 700, 32)

Screen s
_ScreenMove 0, 0
_Delay .3 ' seem to get blank screen first delay to get full screen setup

For i = 1 To 1000
    Print "Hello World! ";
Next
s32 = _ScreenImage

_PutImage , s32, s
s10 = _CopyImage(s32, 32) ' <<<< not 33
_FreeImage s32

_Delay 5
Cls

_Delay 2
_PutImage (0, 0), s10, s

_Delay 5
System

I added some mods for smoother working IMHO

Check this out


Attached Files
.bas   checkout.bas (Size: 475 bytes / Downloads: 6)
Reply


Forum Jump:


Users browsing this thread: