May 09, 2024, 08:00:32 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


WINDOW conversion Error!

Started by misturx, April 21, 2008, 09:13:28 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

misturx

I am trying to return WINDOW as a DOUBLE in a EB created dl. Instead of using mywin as WINDOW. I would like to use mywin as DOUBLE but the compiler keeps telling me
" Compiling...
gmdlltest.eba
File: C:\Program Files\EBDev\projects\gm_projects\gmdlltest.eba (30) no appropriate conversion exists - )
Error(s) in compiling "C:\Program Files\EBDev\projects\gm_projects\gmdlltest.eba"

Is there some way to accomplish this conversion.

sapero

The DOUBLE type is currently 64-bit variable, while WINDOW holds 832-bits of data. It is not easy to compress the structure 13 times.
Maybe I don't understand what youre trying to do.

Barney

There is no way to accomplish this conversion except by divine intervention. WINDOW is a special TYPE variable which contains other  variables and there is no way it can be converted into a DOUBLE.

Perhaps you'd like to use window handle which is defined within WINDOW TYPE i.e. you can use myWin.hwnd as a direct handle to a created window. You can even convert it to DOUBLE variable but the point of that exercise is beyond me. Why on Earth would you like to keep window stuff in a DOUBLE?

Barney

misturx

April 21, 2008, 01:55:04 PM #3 Last Edit: April 21, 2008, 02:12:23 PM by misturx
The reason I am trying to use double is because the other programming language only accepts a double for its window handle. Anyway thanks for your help guys. I forgot to mention that I am trying to create a browser dll in EB.

Ionic Wind Support Team

That wouldn't be possible in any language.  A DOUBLE precision variable is an IEEE floating point number, not suitable for a simple UINT windows handle. 

The Microsoft Windows OS uses a handle (32 bit integer) to represent all GUI objects, whether it be a brush, pen, bitmap, window, dialog or control.  The handle is available through Emergence BASIC's WINDOW type.  As Barney had pointed out MyWindow.hwnd is the 32 bit OS handle to the created window.

Perhaps the language you are trying to interface with uses the word DOUBLE to mean something else.

Quote
I forgot to mention that I am trying to create a browser dll in EB.

EB already has a built in web browser control.

Paul.

Ionic Wind Support Team

REDEBOLT

April 22, 2008, 12:09:30 PM #5 Last Edit: April 22, 2008, 12:16:52 PM by REDEBOLT
The other programming language has the following definition:

QuoteCBHNDL function
Purpose
In a Callback Function, return the window handle of the caller.

Syntax
WindowHandle??? = CBHNDL

Remarks
When a user clicks on a button, types into a text box, or generally interacts with any  control in a dialog, Windows sends a %WM_COMMAND message to the control callback function. If no control callback function is defined, the message is sent to the dialog callback function. In either type of callback, CBHNDL returns the window handle of the parent dialog.

CBHNDL will also return the window handle for all other types of messages that flow through dialog callback functions. For example, %WM_PAINT, %WM_INITDIALOG, etc. As it is possible to share a control callback function with multiple controls, it is also possible to share a dialog callback function with multiple dialogs. In such cases, CBHNDL can be used to make a clear distinction between each dialog.

If we consider a conventional callback procedure definition:

FUNCTION DlgCallback(BYVAL hDlg???, BYVAL wMsg&, BYVAL wParam&, BYVAL lParam&) _
  EXPORT AS LONG


The handle is sent to the callback as the hDlg??? parameter. hDlg may be a Long-integer or Double-word variable (i.e., hDlg& or hDlg???), but a Double-word variable is recommended.

Restrictions
This function is only valid inside a Callback Function.

In the above definition, hDlg??? refers to a double-word or DWORD which is a 32-bit unsigned integer.
Regards,
Bob

barry

In your earlier posts you said "double" but the documentation you quote says "dword".  These are very different things.  Power Basic uses an integer size of 16 and a dword is a double length unsigned integer.  The same thing in Ebasic is a uint since Ebasic takes the ingeger size to be 32 bits.

A double in either language refers to a 64 bit floating point number.  The IEEE standard specifies a single precision floating point number as 32 bits and most languages refer to that as a "float" or as a "single", meaning a single precision floating point number.  Since more precision is often needed a 64 bit floating point number, called a "double" is usually supported.

Floating point numbers are stored in a very different format than integers.  They are approximations of numbers, not precise numbers, and they wouldn't be used for such things as handles or pointers.  Doing so would be impractical and very problematic.

You might want to google "floating point" and read up on it.  There are good explanations of floating point all over the web and it's a very important thing to be aware of when you're programming.  I'm suggesting this with the assumption that it's new to you.  If you just misread something and already know about it, oh well. :)

Barry

LarryMc

Good explanation Barry

For the life of me I couldn't imagine what language would use a double as a window handle since that is a WINDOWS defined thing.


Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

REDEBOLT

Quote from: Larry McCaughn on April 22, 2008, 12:37:31 PM
Good explanation Barry

For the life of me I couldn't imagine what language would use a double as a window handle since that is a WINDOWS defined thing.

Larry

I think the confusion arises from the other programming language refers to "double-word" or "DWORD" which is an uint in EBasic.

Regards,
Bob

LarryMc

LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

misturx

Just to clear the air and confusion the language I am referring to is GML Game maker language which only accepts DOUBLES AND STRINGS when defining dll functions. The game maker window handle will only accept DOUBLE from a dll for a handle. In BCX Basic I would write a dll this way:
function copy(hwin as DOUBLE) AS DOUBLE EXPORT
SendMessage((HWND)(INT)hwin,WM_COPY,0,0)
function = 1
End Function


The hwin would be the window handle of course.