Forum > General

How to hide window buttons (Minimize, Maximize and Close) in a Windows app

<< < (4/5) > >>

KodeZwerg:
I really suggest to upgrade from GetWindowLong to GetWindowLongPtr and same for SetWindowLong to SetWindowLongPtr for a compatible to 32 and 64 bit always working solution.

440bx:

--- Quote from: KodeZwerg on December 11, 2022, 05:27:40 pm ---I really suggest to upgrade from GetWindowLong to GetWindowLongPtr and same for SetWindowLong to SetWindowLongPtr for a compatible to 32 and 64 bit always working solution.

--- End quote ---
Yes, that is a good suggestion.

An alternative is to define 32bit (Set/Get)(Window/Class)LongPtr functions to point to the non-Ptr names in 32bit (since there are no xxxPtr names in the 32bit dll) and show them as returning a ptrint (which will automatically expand or contract to the bitness of the code being compiled.) and do the opposite for the 64 bit definitions of the non-Ptr functions.

That way the xxxPtr functions exist in both 32bit and 64bit making them the right choice no matter the program bitness.  no need for $ifdef WIN64 to determine which API should be called since with that definition the xxxPtr functions exist in both bitnesses.





Libra07:
Thank you ASerge! This is exactly what I wanted! I wanted to prevent the user from accidentally or lazily closing the console without exiting normally. If the user wants, he can close it in the taskbar menu or through the program manager. Perfect just like that!

KodeZwerg:
@440bx, you really just need to replace the non-Ptr with the Ptr variant, the rest the OS do for you. No need anything else.

Libra07:
KodeZwerg and 440bx, thanks for your suggestions!
I replaced the commads:
 GetWindowLong ->  GetWindowLongPrt
 SetWindowLong ->  SetWindowLongPrt
It seems that everything works perfectly, the parameters were basically the same.

I see in the microsoft.com develiopment page there are a lot of variants
GetWindowLongPtrA function  /  GetWindowLongPtrW function
SetWindowLongPtrA function  /  SetWindowLongPtrW function

I think these 2 types are because of ANSI / Unicode.
But I can use the simple GetWindowLongPtr too. So I use now the simple GetWindowLongPtr / SetWindowLongPtr.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version