1. Hello again Al or anybody

I'm trying to compose a Print Preview with win32lib.ew.
That will display .jpg, .gif, .bmp, .ico, .tiff, .wmf, .emf, etc...
I guess the trick is to convert all pics to bitmaps and then manipulate them.
I thought that was what ALS_DJ.exe did (convert).

I created a Library using the Euviewer files. (Which is the same as the Deluxe
Slide Show library).
For lack of a better name I call it ssclass.

include win32lib.ew

--ssclass group--
include GlobalVars.ew  
include LLFuncs.ew as LLF
include WConst.ew as Alc
include WM_Const.ew as Awc
include WinMain.ew as Win
include WinCalls.ew as win
include ReTrack.ew as Track
include Menu.ew as Menu
include GdiPlus_Win98,XP.ew
include Viewer_Globals.ew

I fixed it so I don't get any namesake clashes.

The problem I'm getting is,
d:\eu\ssclass\ReTrack.ew:152 in function GetHandle()
subscript value 17 is out of bounds reading from sequence of length 0

What is the sequence that is length 0?

 The window I am trying to paste the picture into is created with win32lib.ew.
Could this make a difference? Must it be created within the ssclass group?

I want the program to be written in win32lib.ew because the bulk of the program
is already written in win32lib.

Any help appreciated,


Don Cole

new topic     » topic index » view message » categorize

2. Re: Hello again Al or anybody

What is line 152 of ReTrack.ew?  For that matter, what is ReTrack.ew?

new topic     » goto parent     » topic index » view message » categorize

3. Re: Hello again Al or anybody

Sorry about that last post, I realize now that ReTrack.ew is part of WinClass.

Well, the sequence appears to be Win_Handles, if that helps any.

new topic     » goto parent     » topic index » view message » categorize

4. Re: Hello again Al or anybody

Thank you Evan for your response.

But how does Win_Handles build it's sequence and how long should it be?

Don Cole

new topic     » goto parent     » topic index » view message » categorize

5. Re: Hello again Al or anybody

I believe I found the problem,
I'm creating the window with win32lib.ex and tring to manipulate it with
winClass.

Don Cole

new topic     » goto parent     » topic index » view message » categorize

6. Re: Hello again Al or anybody

Hi there Don,


I can tell you that the ID's created with WinClass are not compatible
with those of WinLib, however, the 'window handles' are!  This means
you can use many function calls for windows using WinClass even if the
windows were created with WinLib (now that you've got the two working
together).  The only trick is to get the actual handle using
WinLibs way of doing this -- last time i checked it was getHandle(), but
who knows by now :)  Once you get the handle you can pass it to
WinClass functions (in many cases).

An example would be with the SendMessage() call:

  atom hWnd,retv
  hWnd=WinLib:getHandle(winlib_id) --or however you are calling this
  retv=win:SendMessage(hWnd,MESSAGE,wParam,lParam) --a WinClass lib call

Note that you MUST use the winlib's id, not one created by winclass.

To get the handle for a window in WinClass, use:
  atom hWnd
  hWnd=Track:GetHandle(winclass_id)

It's also possible to create an ID in WinClass that refers to a window
created with WinLib, but to do this you'd have to create the window
in WinLib and then port it to another ID in WinClass by calling the
GetNextID() function in ReTrack.ew, then call SetHandle(), then
SetParentID().  You'd have to decide which lib to handle events with
i guess.  Note however i havent actually tried this (yet) hee hee.



Take care,
Al

And, good luck with your Euphoria programming!

My bumper sticker: "I brake for LED's"

 From "Black Knight":
"I can live with losing the good fight,
 but i can not live without fighting it".
"Well on second thought, maybe not."

new topic     » goto parent     » topic index » view message » categorize

7. Re: Hello again Al or anybody

Al Getz wrote:
> 
> Hi there Don,
> 
> 
> I can tell you that the ID's created with WinClass are not compatible
> with those of WinLib, however, the 'window handles' are!  This means
> you can use many function calls for windows using WinClass even if the
> windows were created with WinLib (now that you've got the two working
> together).  The only trick is to get the actual handle using
> WinLibs way of doing this -- last time i checked it was getHandle(), but
> who knows by now :)  Once you get the handle you can pass it to
> WinClass functions (in many cases).
> 
> An example would be with the SendMessage() call:
> 
>   atom hWnd,retv
>   hWnd=WinLib:getHandle(winlib_id) --or however you are calling this
>   retv=win:SendMessage(hWnd,MESSAGE,wParam,lParam) --a WinClass lib call
> 
> Note that you MUST use the winlib's id, not one created by winclass.
> 
> To get the handle for a window in WinClass, use:
>   atom hWnd
>   hWnd=Track:GetHandle(winclass_id)
> 
> It's also possible to create an ID in WinClass that refers to a window
> created with WinLib, but to do this you'd have to create the window
> in WinLib and then port it to another ID in WinClass by calling the
> GetNextID() function in ReTrack.ew, then call SetHandle(), then
> SetParentID().  You'd have to decide which lib to handle events with
> i guess.  Note however i havent actually tried this (yet) hee hee.
> 
> 
> Al
> 
> 
> My bumper sticker: "I brake for LED's"
> 
>  From "Black Knight":
> "I can live with losing the good fight,
>  but i can not live without fighting it".
> "Well on second thought, maybe not."


Hello Al thank you for your response,

If I do convert a Winlib ID to a WinClass ID I'm still going to come up with an
integer larger than 0. Which brings me back to the problem in line 152 of
reTrack:
subscript value 17(or whatever the winClass ID is) is out of bounds reading from
sequence of length 0.

This is called from:
retv=win:InvalidateRect(GetHandle(Window1),0,1)--Window1 is created with
winlib32.ew.
in SetWindowGraphics


Don Cole

new topic     » goto parent     » topic index » view message » categorize

8. Re: Hello again Al or anybody

don cole wrote:
> 
> Al Getz wrote:
> > 
> > Hi there Don,
> > 
> > 
> > I can tell you that the ID's created with WinClass are not compatible
> > with those of WinLib, however, the 'window handles' are!  This means
> > you can use many function calls for windows using WinClass even if the
> > windows were created with WinLib (now that you've got the two working
> > together).  The only trick is to get the actual handle using
> > WinLibs way of doing this -- last time i checked it was getHandle(), but
> > who knows by now :)  Once you get the handle you can pass it to
> > WinClass functions (in many cases).
> > 
> > An example would be with the SendMessage() call:
> > 
> >   atom hWnd,retv
> >   hWnd=WinLib:getHandle(winlib_id) --or however you are calling this
> >   retv=win:SendMessage(hWnd,MESSAGE,wParam,lParam) --a WinClass lib call
> > 
> > Note that you MUST use the winlib's id, not one created by winclass.
> > 
> > To get the handle for a window in WinClass, use:
> >   atom hWnd
> >   hWnd=Track:GetHandle(winclass_id)
> > 
> > It's also possible to create an ID in WinClass that refers to a window
> > created with WinLib, but to do this you'd have to create the window
> > in WinLib and then port it to another ID in WinClass by calling the
> > GetNextID() function in ReTrack.ew, then call SetHandle(), then
> > SetParentID().  You'd have to decide which lib to handle events with
> > i guess.  Note however i havent actually tried this (yet) hee hee.
> > 
> > 
> > Al
> > 
> > 
> > My bumper sticker: "I brake for LED's"
> > 
> >  From "Black Knight":
> > "I can live with losing the good fight,
> >  but i can not live without fighting it".
> > "Well on second thought, maybe not."
> 
> 
> Hello Al thank you for your response,
> 
> If I do convert a Winlib ID to a WinClass ID I'm still going to come up with
> an integer larger than 0. Which brings me back to the problem in line 152 of
> reTrack:
> subscript value 17(or whatever the winClass ID is) is out of bounds reading
> from sequence of length 0.
> 
> This is called from:
> retv=win:InvalidateRect(GetHandle(Window1),0,1)--Window1 is created with
> winlib32.ew.
> in SetWindowGraphics
> 
> 
> Don Cole

Hi again Don,

Well, if you had called GetNextID() that shouldnt be the case, because
GetNextID() calls NextID(), which either creates a new sequence element
(in Win_Handles) or reuses a previous element that is no longer in use.
Thus, calling InvalidateRect should work ok because GetNextID() forces
the sequence in question to be long enough to support the ID passed
to GetHandle().  Another way of saying this is that the ID returned
from GetNextID() will never be higher than the length of that sequence.
I'm also assuming nothing was modified in ReTrack.ew of course.

Here's a quick example...

Before the next Create call Win_Handles might be {}.
Now the function call:
Window1=Window:Create(...)
Now
  Window1=1
and
  Win_Handles={12345678}
which is one window handle stored and the window id is 1.

If another Create is called then the next id would be 2, and
  Win_Handles={12345678,87654321}
(the second handle is stored in position #2 of the sequence.)
This means when GetHandle is called it will always have a handle
to return, even if it's zero because RemoveID was perhaps called.


Hope this makes sense smile


Take care,
Al

And, good luck with your Euphoria programming!

My bumper sticker: "I brake for LED's"

 From "Black Knight":
"I can live with losing the good fight,
 but i can not live without fighting it".
"Well on second thought, maybe not."

new topic     » goto parent     » topic index » view message » categorize

9. Re: Hello again Al or anybody

Al Getz wrote:

> 
> Before the next Create call Win_Handles might be {}.
> Now the function call:
Belive it or not I'm following you so far.
> Window1=Window:Create(...)
Now is this a winlib Create or a winClass Create?

Because I'm getting : variable DefaultEvents has not been assigned a value in
NextID().

I'm only doing a winlib Create at this point.(before I call GetNextID())


Hope that makes sense.



Don Cole

new topic     » goto parent     » topic index » view message » categorize

10. Re: Hello again Al or anybody

don cole wrote:
> 
> Al Getz wrote:
> 
> > 
> > Before the next Create call Win_Handles might be {}.
> > Now the function call:
> Belive it or not I'm following you so far.
> > Window1=Window:Create(...)
> Now is this a winlib Create or a winClass Create?
> 
> Because I'm getting : variable DefaultEvents has not been assigned a value in
> NextID().
> 
> I'm only doing a winlib Create at this point.(before I call GetNextID())
> 
> 
> Hope that makes sense.
> 
> 
> Don Cole

Hi Don,

Ok, that's a different error now.  To fix this:

If you're planning on using any WinClass events you'll have to include
either MessageMap.ew early on, or make your own MessageMap.ew .
If you're NOT planning on using these events, i think you can get away
with calling
  Track:SetLastEventID(1)      --note '1' inside
  Track:SetDefaultEventsSize() --note nothing inside
although i never tried this so far.

I think this covers it.



Take care,
Al

And, good luck with your Euphoria programming!

My bumper sticker: "I brake for LED's"

 From "Black Knight":
"I can live with losing the good fight,
 but i can not live without fighting it".
"Well on second thought, maybe not."

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu