What this thread Involves: WM_QUERYENDSESSION and BringWindowToTop WmProc & WIN API
So this is my first time ever investigating or looking into Win API(s) and stuff and i've already started wrong if anyone could explain them to me in general that'd be lovely, also as i am still new i only have a basic understanding of bool and haven't really used it outside of very simplistic things and what it is, but i am trying to use the two functions BringWindowToTop found here https://msdn.microsoft.com/en-us/library/windows/desktop/ms632673(v=vs.85).aspx
BOOL WINAPI BringWindowToTop(1);
/*
Which at first gave me compiler errors but finally when it stopped that (forgot what i did)
it would run the debug and all fine but not bring it to top, so my thought here is
that it's bool and on MSDN it says as long as it returns non zero it succeeds so i put 1, help is appreciated on where i've gone wrong with that
*/
The second thing is the WM_QUERYENDSESSION, now the reason i want to use this is so that the program doesn't just get insta closed by the X so like it will detect the query returns 0 and saves data or what ever goes through a little process then exits it self but i am not even sure how it returns it etc so i haven't really attempted it so this is mainly what i need help with!
Sorry for the long thread but thank you for reading till the end
My advice is to learn the fundamentals of C++ first, before diving into the Windows API.
This is how you might invoke "BringWindowToTop" :
bool result = ::BringWindowToTop(handle);
Where "result" signifies success or failure, and "handle" is your HWND handle to the window in question. If you're creating your own window then you already have the handle, so this is trivial.
i am trying to use the two functions
The second thing is the WM_QUERYENDSESSION, now the reason i want to use this is so that the program doesn't just get insta closed by the X so like it will detect the query returns 0 and saves data or what ever goes through a little process then exits it self
WM_QUERYSESSION is not a function.
The window message you're probably looking for is WM_CLOSE, not WM_QUERYSESSION.
Typically, "cleanup" stuff (like what you intend to do) is taken care of when a WM_CLOSE message is received in a window's "WindowProc" callback.