Popping up a message box from a library in C code used in a C++ program
-
I am writing a c++ .exe MFC program, using a library written in C code. from the C code, I want a message box to pop up when an error has been detected. I tried using MessageBox function but it says too few actual parameters. The function prototype the MessageBox function is: int MessageBox( HWND hWnd, // handle to owner window LPCTSTR lpText, // text in message box LPCTSTR lpCaption, // message box title UINT uType // message box style ); does the problem lies with the hWnd handle? how can i get the handle to the window from the library in C code? Pls help. hearties
-
I am writing a c++ .exe MFC program, using a library written in C code. from the C code, I want a message box to pop up when an error has been detected. I tried using MessageBox function but it says too few actual parameters. The function prototype the MessageBox function is: int MessageBox( HWND hWnd, // handle to owner window LPCTSTR lpText, // text in message box LPCTSTR lpCaption, // message box title UINT uType // message box style ); does the problem lies with the hWnd handle? how can i get the handle to the window from the library in C code? Pls help. hearties
You could pass NULL to the hWnd parameter or use ::GetActiveWindow to attach the box to the current active window Michael :-)