PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 [3] 4 5

Author Topic: CWindow RC05  (Read 15668 times)

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 8937
  • Windows 10
    • PlanetSquires Software
Re: CWindow RC05
« Reply #30 on: May 04, 2016, 06:57:06 PM »

> I have also been testing the use of message crackers and dedicated message handlers.

For what I see, these aren't needed in CWindow or the custom controls. You can freely use them in your code if you like. Am I right?


Yes, you are right.

Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Josť Roca

  • Moderator
  • Guru Member
  • *****
  • Posts: 3217
Re: CWindow RC05
« Reply #31 on: May 04, 2016, 07:35:12 PM »

No problem then. I understand is usefulness for a visual designer, to no overwrite the message processing in the window procedure, but when coding by hand as I always do, when there is code that is going to be too long you simply put it in a procedure and call it. A manual and selective way of message cracking.

Josť Roca

  • Moderator
  • Guru Member
  • *****
  • Posts: 3217
Re: CWindow RC05
« Reply #32 on: May 04, 2016, 07:54:04 PM »

I have to recheck all the code removing #define unicode. Even calling the W function, something like this LoadCursorW(NULL, IDC_ARROW) compiles fine using #define unicode and reports an error if not. I will have to add more CASTs.

Josť Roca

  • Moderator
  • Guru Member
  • *****
  • Posts: 3217
Re: CWindow RC05
« Reply #33 on: May 04, 2016, 07:57:40 PM »

Well, looks like that one was the only that needed a change.

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 8937
  • Windows 10
    • PlanetSquires Software
Re: CWindow RC05
« Reply #34 on: May 04, 2016, 07:59:27 PM »

Just a little FYI for you in case you don't know.... In FB if you ever want to see the exact code that will be compile (macros expanded, etc) then just pass -pp to the compiler. It will create an intermediate file with ".pp" appended to it. It can be quite useful sometimes.
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 8937
  • Windows 10
    • PlanetSquires Software
Re: CWindow RC05
« Reply #35 on: May 04, 2016, 08:15:03 PM »

I posted that array passing and copying issue over on the FB forum. I am very curious as to why it does not work.
http://www.freebasic.net/forum/viewtopic.php?f=6&t=24667
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Josť Roca

  • Moderator
  • Guru Member
  • *****
  • Posts: 3217
Re: CWindow RC05
« Reply #36 on: May 04, 2016, 08:27:19 PM »

Thanks for the tip and the support. I have run several test programs removing the unicode define and the only problems that have found are LoadCursorW in CWindows, and a CreateFontIndirect (I forgot to add the "W") in the XpButton and PgBar3D controls.

Will write all the upcoming code without #define unicode to avoid these failures.
« Last Edit: May 05, 2016, 09:29:34 AM by Jose Roca »
Logged

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 8937
  • Windows 10
    • PlanetSquires Software
Re: CWindow RC05
« Reply #37 on: May 05, 2016, 09:26:45 AM »

FYI,

fxm responded to the fixed WSTRING array issue:  http://www.freebasic.net/forum/viewtopic.php?f=6&t=24667#p219838
It is a known problem.

Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 8937
  • Windows 10
    • PlanetSquires Software
Re: CWindow RC05
« Reply #38 on: May 05, 2016, 12:56:38 PM »

Hi Jose,

Looking at the examples that you have posted, I see that you use GetModuleHandle with an empty string for the parameter. This seems to always return 0 indicating an error. I read the api docs and I think you are better off using Null instead of an empty string?
https://msdn.microsoft.com/en-us/library/windows/desktop/ms683199(v=vs.85).aspx

   End WinMain(GetModuleHandleW(Null), Null, Command(), SW_NORMAL)

Using Null, I am getting a value returned for the hInstance.


Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Josť Roca

  • Moderator
  • Guru Member
  • *****
  • Posts: 3217
Re: CWindow RC05
« Reply #39 on: May 05, 2016, 01:58:48 PM »

Thanks very much. I will remember it.

Josť Roca

  • Moderator
  • Guru Member
  • *****
  • Posts: 3217
Re: CWindow RC05
« Reply #40 on: May 05, 2016, 02:52:44 PM »

Hi Paul,

I have read that unused Private procedures are removed by the compiler.

> fbc already removes unused private procedures/variables, but that's pretty much it.
See: http://www.freebasic.net/forum/viewtopic.php?t=23405

Could be this a solution to write wrapper procedures without adding bloat?

Josť Roca

  • Moderator
  • Guru Member
  • *****
  • Posts: 3217
Re: CWindow RC05
« Reply #41 on: May 05, 2016, 03:10:17 PM »

It works!

I wonder why they don't explain it in the documentation.

Josť Roca

  • Moderator
  • Guru Member
  • *****
  • Posts: 3217
Re: CWindow RC05
« Reply #42 on: May 05, 2016, 04:18:57 PM »

Another oddity.

This works:

Code: [Select]
DIM tbb AS TBBUTTON = (idxBitmap, idCommand, fsState, fsStyle, {0, 0, 0, 0, 0, 0}, dwData, idxString)

But this one gives Error 7: Expected ')'

Code: [Select]
DIM tbb AS TBBUTTON
tbb = (idxBitmap, idCommand, fsState, fsStyle, {0, 0, 0, 0, 0, 0}, dwData, idxString)

« Last Edit: May 05, 2016, 04:49:34 PM by Jose Roca »
Logged

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 8937
  • Windows 10
    • PlanetSquires Software
Re: CWindow RC05
« Reply #43 on: May 05, 2016, 05:54:03 PM »

Another oddity.

This works:

Code: [Select]
DIM tbb AS TBBUTTON = (idxBitmap, idCommand, fsState, fsStyle, {0, 0, 0, 0, 0, 0}, dwData, idxString)

But this one gives Error 7: Expected ')'

Code: [Select]
DIM tbb AS TBBUTTON
tbb = (idxBitmap, idCommand, fsState, fsStyle, {0, 0, 0, 0, 0, 0}, dwData, idxString)

More than likely it has to do with the code generation of each compiler version. By default, FBC 32bit outputs ASM code that is then compiled by the GNU assembler. FBC 64bit defaults to outputting C code that is then compiled with gcc (llvm eventually will be fully supported).

You can see the intermediate code generated (ASM or C) when you specify the -r command line option for the compiler.
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Josť Roca

  • Moderator
  • Guru Member
  • *****
  • Posts: 3217
Re: CWindow RC05
« Reply #44 on: May 05, 2016, 06:10:21 PM »

Sorry, but you have misunderstood me.

This one works both in 32 and 64 bit:

Code: [Select]
#ifdef __FB_64BIT__
   DIM tbb AS TBBUTTON = (idxBitmap, idCommand, fsState, fsStyle, {0, 0, 0, 0, 0, 0}, dwData, idxString)
#else
   DIM tbb AS TBBUTTON = (idxBitmap, idCommand, fsState, fsStyle, {0, 0}, dwData, idxString)
#endif

But if I dim tbb separately and then I try to do the assignment, it fails:

Code: [Select]
#ifdef __FB_64BIT__
   DIM tbb AS TBBUTTON
   tbb = (idxBitmap, idCommand, fsState, fsStyle, {0, 0, 0, 0, 0, 0}, dwData, idxString)
#else
   DIM tbb AS TBBUTTON
   tbb = (idxBitmap, idCommand, fsState, fsStyle, {0, 0}, dwData, idxString)
#endif
Pages: 1 2 [3] 4 5