c# - How do I pinvoke to GetWindowLongPtr and SetWindowLongPtr on 32-bit platforms? -
I want to apologize and, and I'm looking at the information about them.
Some sources say that, on 32-bit platforms, GetWindowLongPtr is just a preprocessor macro that calls GetWindowLong, and for example user32.dll the GetWindowLongPtr does not exist as a user's login :
- There is a static method, which checks IntPtr.Size and then with either set either SetWindowLong or SetWindowLongPtr, "Legacy OSes do not support SetWindowLongPtr" "Legacy OS "means no explanation for what it means.
- GetWindowLongPtr on a state "32 bit system is just a Mac that indicates GetWindowLong".
These sources indicate that * PTR entry points are not just in the user 32.dll version, which says, with 32-bit Windows 7.
But I do not get any indication of this in accordance with the MSDN documentation MSDN, plain and simple, instead of Setwondo Long. And according to the requirements section, it appears that SetWindowLongPtr is from user32.dll since Windows 2000 (both client and server version). Again, there is no mention of entry points in the 32-bit OS.
I Doubt that the truth is somewhere in between: when you tell the C ++ compiler to target the old OS (i.e., some things that run on Win9x and NT4 To compile), then the header file set declares Windows Longprint as a macro that says Setwendol long, but the entry point is probably present in Windows 2000 and later and you will get it directly (instead of the macro Of) if you compile those platforms It is just an estimate to target the Varmas; I do not really have the resources or to know and to verify it.
It is also possible that the target platform plays a role - if you compile your app for X86 platform, then you should not call SetWindowLongPtr on a 64-bit OS again, I There is enough information to think about this question, but I do not know the answer how to get the answer. MSDN is suggesting that Set Window LongPrase is always correct.
Can anyone tell me whether it is safe to do P / Investments only and should be done with it? (Assume Windows 2000 and later). P / Ink in set / window longpets give me the correct entry point:
- What if I run an app that targets x86 platforms on a 32-bit OS?
- What if I run an app that targets the x86 platform on a 64-bit OS?
- What if I run a target x64 platform on a 64-bit OS?
I suggest that the way Windows forms do it internally :
Public Static Interrupt Gatevando Long (Handler, HWN, Int New Index) {if (IntPtr.Size == 4) {GetWindowLong32 (hWnd, nIndex); } GetWindowLongPtr64 (hWnd, nIndex); } [DllImport ("user32.dll", entrypoint = "gatewondol long", chartset = charset.auto]] Private static extant installer gatewondol long 32 (handlerfwd, int new index); [DllImport ("user32.dll", entrypoint = "gatewondol longprint", chartset = charset.auto]] Private static extenector gatewondol longprint 64 (handlerfwd, int new index);
Comments
Post a Comment