Check out GetUserName() or GetUserNameEx().
SmokingRope22
Posts
-
how to get username of a system -
Window Destruction MonitorI've created a hook using SetWindowsHookEx() which through the use of WH_SHELL has been able to monitor the creation of all windows. I've also been trying to use this hook to monitor destruction of windows through the use of HSHELL_WINDOWDESTROYED. The documentation claims that the hook will be called prior to the window being destroyed. It also claims the WPARAM parameter will contain an HWND to the window about to be destroyed. My problem is that the WPARAM is NULL every time my hook gets called and in no way the HWND to the window. Is there something i'm missing? A side note: HSHELL_WINDOWCREATED and HSHELL_WINDOWDESTROYED is never called by certain windows such as that of a console application however HSHELL_WINDOWACTIVATED is called by the console programs. I've been using this to 'detect' the creation of the console windows. The window is automatically activated when it launches. I still have no method for detecting console application termination.
-
Loading a list from file into a List BoxThanks, i figured out how to accomplish the same thing using serialization. It looks similar to this: // This is the saving Routine CFile f; f.Open("PrefsFile", CFile::modeCreate | CFile::modeWrite); CArchive ar( &f, CArchive::store ); ar << m_CurrentCount; // Number of objects being saved for(int i = 0; i> m_CurrentCount; // Number of objects to load for(int i = 0; i < m_CurrentCount ; i++) ar >> Prefs[i]; ar.Close(); f.Close();
-
Loading a list from file into a List BoxHi, i've just begun to learn visual C++ and i am having problems with loading a list of objects, (which are stored in a text file), and displaying them in a List Box. I've looked through two books to try and get an efficent and understandable (to me) way of doing this and have come up with either trying to do this with serialization or using the standard windows i/o of CreateFile() to open the file and ReadFile() to (obviously) read from the file but it is explained poorly in both my books and so i haven't been able to get very far. If anyone has any form of tutorial to point me at or has some time they could spend to explain a method/methods of File I/O in windows I would be most gratefull.