Author Topic: AfxWin - a start  (Read 13334 times)

0 Members and 1 Guest are viewing this topic.

Arnold

  • Guest
Re: AfxWin - a start
« Reply #30 on: October 11, 2018, 05:45:31 AM »
Regarding WTypes.inc (Reply 15): Many of these constants are of type sys in Oxygenbasic, which is a 32-bit value in Win32 and a 64-bit value in Win64. Maybe it is possible to add some of these typedefs directly into Oxygen? I assume Charles has already managed somehow to do this with some structs. I often use: MSG msg in my message loop and I am surprised that this works.

Aurel

  • Guest
Re: AfxWin - a start
« Reply #31 on: October 11, 2018, 10:29:39 AM »
Yes i see
but no mather with or without byVal still not work
I tried all possible combination and nothing.
I almost give up because of this from o2

Aurel

  • Guest
Re: AfxWin - a start
« Reply #32 on: October 11, 2018, 10:33:46 AM »
Quote
MSG msg in my message loop and I am surprised that this works.
Yeah ..that's true and some things are not documented and some are not explained
i even look into source code to try to find what might be wrong and i found some strange
declaration so I sespect there are inbuilt into o2 and cose similar troubles.

JRS

  • Guest
Re: AfxWin - a start
« Reply #33 on: October 11, 2018, 12:03:50 PM »
José is on the right path using C headers as a base. We should support those efforts for maintainable includes.

  • Guest
Re: AfxWin - a start
« Reply #34 on: October 11, 2018, 01:36:30 PM »
Yes i see
but no mather with or without byVal still not work
I tried all possible combination and nothing.
I almost give up because of this from o2

If it doesn't work for you it must be that you have a wrong declare, or that you aren't passing the parameters correctly, or both.
« Last Edit: October 11, 2018, 01:54:24 PM by José Roca »

  • Guest
Re: AfxWin - a start
« Reply #35 on: October 11, 2018, 01:45:17 PM »
Using the typedefs means that you can use the C declare directly in the source code

Code: [Select]
int MessageBoxA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType);

and what the compiler sees is

Code: [Select]
int MessageBoxA(sys hWnd, char* lpText, char* lpCaption, uint uType)

The advantage is that you don't need to change anything, so much less work and no mistakes. I wish I could have been able to do it this way when I translated the headers to Power Basic.

> Maybe it is possible to add some of these typedefs directly into Oxygen?

It is up to Charles to consider if its worthwile to add these aliases to the language or not.
« Last Edit: October 11, 2018, 01:56:02 PM by José Roca »

JRS

  • Guest
Re: AfxWin - a start
« Reply #36 on: October 11, 2018, 02:16:39 PM »
Quote
The advantage is that you don't need to change anything, so much less work and no mistakes. I wish I could have been able to do it this way when I translated the headers to Power Basic.

Your docs and this direction with includes compensates for all the pain we inflicted on each other chasing the light.

Arnold

  • Guest
Re: AfxWin - a start
« Reply #37 on: October 11, 2018, 11:56:36 PM »
I am not against the idea of using typedef. During my experiments to port BCX code to Oxygenbasic I tried this myself (and gave up due to my lack of experience). I just want to point out if it is possible to avoid naming conflicts like HWND hwnd, HFONT hfont etc. Charles uses typedefs with OpenGl too. To overcome some difficulties in one of the NeheTutorials (NeheTut08.o2bas) I had to use #case capital, typedef sys SYS, typedef char CHAR to run the app. If it is possible to avoid misinterpretations, then helper files like WTypes.inc would be of an invaluable help.

  • Guest
Re: AfxWin - a start
« Reply #38 on: October 12, 2018, 12:29:09 AM »
With typedefs there are not name conflicts. As I said, using WTpes.inc,

Code: [Select]
int MessageBoxA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType);

becomes

Code: [Select]
int MessageBoxA(sys hWnd, char* lpText, char* lpCaption, uint uType)

You would have conflicts if you will use #define or macros, because then it will become

Code: [Select]
int MessageBoxA(sys sys, char* lpText, char* lpCaption, uint uType)

Like #define and macros, typedefs do text substitution, but only if it is a data type, not the name of a variable.

Its usefulness is that you don't need to translate/adapt the C declares, structures, etc., but you can copy and paste them and the typedefs will do the substitution. If Charles implements them in the compiler, it would be a welcome addition to the O2 support for C headers.

« Last Edit: October 12, 2018, 12:42:27 AM by José Roca »

JRS

  • Guest
Re: AfxWin - a start
« Reply #39 on: October 12, 2018, 08:46:36 AM »
I would love to see Charles finish his C header feature filling in the holes so you can get your wrappers created.

JRS

  • Guest
Re: AfxWin - a start
« Reply #40 on: October 12, 2018, 02:34:21 PM »
José,

Are you saying you can live with your WTypes.inc as a crutch until O2 becomes more C header file friendly?

I think the C header feature O2 offers makes it much more attractive than FB or PB compilers.
« Last Edit: October 12, 2018, 02:45:58 PM by John »

José Roca

  • Guest
Re: AfxWin - a start
« Reply #41 on: October 12, 2018, 03:05:57 PM »
> Are you saying you can live with your WTypes.inc as a crutch until O2 becomes more C header file friendly?

Of course.

> I think the C header feature O2 offers makes it much more attractive than FB or PB compilers.

It makes much easier to adapt the C headers, but parameter checking must be improved.

JRS

  • Guest
Re: AfxWin - a start
« Reply #42 on: October 12, 2018, 03:22:51 PM »
It is very self motivating to watch you work.  You define commitment. We need more folks like Charles, you, Roland and Mike driving this project home.

JRS

  • Guest
Re: AfxWin - a start
« Reply #43 on: October 12, 2018, 04:05:59 PM »
Quote
It makes much easier to adapt the C headers, but parameter checking must be improved.

Can you explain that to me in more detail?

José Roca

  • Guest
Re: AfxWin - a start
« Reply #44 on: October 12, 2018, 04:11:55 PM »