checkbox

At the start of my program, I have a window pop up that tells the user about the program. I want to add a checkbox that lets the user prevent that box from showing again. (The only MSDN page I found was for XP only, I'm using win7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <iostream>
#include <thread>

int flagint;
int batteryint;
bool stopper;
using namespace std;


#if       _WIN32_WINNT < 0x0500
  #undef  _WIN32_WINNT
  #define _WIN32_WINNT   0x0500
#endif
#include <windows.h>

#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
#define _WIN32_WINNT
#endif

int main() {
MessageBox (
        NULL,
        TEXT("This application will run in hidden mode.\nKeep in mind, it uses very little memory and processor power.\nPress CTRL+ALT+C to close this program."),
        TEXT("Battery Notifier"),
        MB_ICONINFORMATION | MB_SETFOREGROUND
    );

}
MessageBox is of no use to you, you either need to write your own DialogBox and put your controls in it, simulating standard MessageBox API, or use other people code, like this one:
http://www.codeproject.com/Articles/9579/CPPMessageBox-v

To remember user option, store some flag in registry or configuration file and read it back every time.
another problem. 'PPMSGBOXPARAMS' does not name a type. using code from the website you linked.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>
#include <thread>

int flagint;
int batteryint;
bool stopper;
using namespace std;


#if       _WIN32_WINNT < 0x0500
  #undef  _WIN32_WINNT
  #define _WIN32_WINNT   0x0500
#endif
#include <windows.h>

#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
#define _WIN32_WINNT
#endif

int main() {

int PPMessageBox(
                HWND hwnd,
                LPCTSTR lpszMessage,
                LPCTSTR lpszCaption = NULL,
                DWORD dwStyle = MB_OK | MB_ICONEXCLAMATION,
                const PPMSGBOXPARAMS * pMsgBox = NULL
                );

}
You have not included "PPMessageBox.h". As you put the problem, I assume you are a beginner in C++ programming.
Registered users can post here. Sign in or register to post.