You made a few mistakes translating GetCurrentHwProfile to Pascal:
Figures it was me... :-)
1. parameter to GetCurrentHwProfile should be TProfileInfo, not PProfileInfo (using "var" parameter already forces passing HWProfile by reference)
That's awfully odd, because according to the Win32 API reference the function GetCurrentHwProfile requires a pointer, which pProfileInfo is (tProfileInfo is just the type definition). Guess I have some more reading to do.
2. result of GetCurrentHwProfile should be LongBool (4 bytes), not boolean (1 byte)
But in your code it's still a boolean, but it now works (it returns TRUE). And, when I change "Results : longbool" in the var declaration I get "Hint: Type size mismatch, possible loss of data / range check error" at the "writeln ('Results: ',Results,' - ',GetLastError);" statement (and with either declaration the function returns TRUE, so I assume it's working with both). Does that mean longbool isn't really necessary?
Guess I have even more reading to do then I thought!
3. most important, TProfileInfo.GUID and TProfileInfo.Name are not AnsiStrings. They are just char arrays, see attached code for correct declararions.
Another oddity, because the API reference says they're null-terminated strings. So shouldn't an ansistring work for that too?
And where did you get those length numbers from, the ones you used for those const definitions? I can't seem to find them anywhere, and it appears that in order to get the info to display properly you need to assign specific lengths to those char strings.
4. This is not important for FPC 1.0.x, but for newer FPC remember to declare WinAPI functions as "stdcall" (FPC 1.0.x just used "stdcall" by default).
I'll make note of that.
I'm attaching corrected version of your program.
Thanks for that -- you were a big help!
Regards, Jim Wilson
_______________________________________________ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal