Skip to content

Instantly share code, notes, and snippets.

void startGame() {
int theRandomNumber = 90; /* getRandomNumber(); */
// snip
}
// startGame() is called when the button is pressed, followed by checkNumber()
void checkNumber() {
wchar_t currentGuessBuffer[4] = { 4 };
SendMessage(g_hEdit_Answer, EM_GETLINE, NULL, (LPARAM)currentGuessBuffer);
SendMessage(g_hLabelInfo2, WM_SETTEXT, 0, (LPARAM)currentGuessBuffer);
int theRandomNumber = getRandomNumber();
int currentGuess = 0;
int tries = 0;
std::string triesString = "Tries: " + tries;
SendMessage(g_hEdit_Answer, EM_SETCUEBANNER, 0, (LPARAM)L"Enter guess..");
SendMessage(g_hLabelEdit_Result, WM_SETTEXT, 0, (LPARAM)L"Guess a number between 0 and 99.");
SendMessage(g_hLabelEdit_Info, WM_SETTEXT, 0, (LPARAM)triesString.c_str());
if (SendMessage(g_hLabel, WM_SETTEXT, 0, (LPARAM)L"Guess a number between 0 and 99."))
bool x = TRUE;
else
bool x = FALSE;
}
// snip
switch (message)
{
// inside the WM_ACTIVATE case
bigFont = CreateFont(90, 20, 0, 0, 700, 0, 0, 0, 0, 0, 0, 0, 0, TEXT("Courier New"));
mediumFont = CreateFont(90, 20, 0, 0, 700, 0, 0, 0, 0, 0, 0, 0, 0, TEXT("Segoe UI"));
SendMessage(g_hEdit_Answer, WM_SETFONT, (WPARAM)bigFont, 0);
SendMessage(g_hSubmit_Answer, WM_SETFONT, (WPARAM)mediumFont, 0);
#include "commctrl.h"
#define SUBMIT_ANSWER 0x01
#define EDIT_ANSWER 0x02
#pragma comment(linker,"\"/manifestdependency:type='win32' \
name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \
processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
// ...
public class TempConverterMain extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_temp_converter_main);
// I'd prefer not to have to declare these twice, so I can use them in my subclass below