Set font size in Win32 API EDIT Window

i have recently been attempting to write a small text editor application, and the main problem i found was migrating notepad settings over to my application, the font for 10pt was stored as 100.

obviously, i needed to divide by 10, but when i did this, the font came out so small it was unreadable.

after some digging, i found the following works perfectly.

int m_height = -MulDiv(g_point_size/10, GetDeviceCaps(m_dc, LOGPIXELSY), 72);

once you have done this, just SendMessage to the EDIT you want to set the font size of, and bingo, we have a correct font size


BBC iPlayer Full Screen Flash – Google Chrome Extention

Google Chrome extension that takes BBC iPlayer streams, both live and catch-up and removes the site around the player, and then makes the player 100% width and 100% height of the browser window.

This extension helps for those of us with multiple monitors who cant full screen flash on the second monitor and then be able to do stuff on the main monitor without the flash player poping back into the browser.

Try it and see.

Download


C++ Multi CPU Aware Threading Code

Licence: BSD

This is an example piece of code that shows how to count the number of processors/cores there are in a system, create a thread for each and assign each thread to a specific processor. Useful if you want to write applications that do a lot of heavy processing and you wish to make use of dual/tri/quad core processors to make everything that bit better.

#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>

HANDLE *m_threads = NULL;
DWORD_PTR WINAPI threadMain(void* p);

DWORD_PTR GetNumCPUs() {
  SYSTEM_INFO m_si = {0, };
  GetSystemInfo(&m_si);
  return (DWORD_PTR)m_si.dwNumberOfProcessors;
}

int wmain(int argc, wchar_t **args) {
  DWORD_PTR c = GetNumCPUs();

  m_threads = new HANDLE[c];

  for(DWORD_PTR i = 0; i < c; i++) {
    DWORD_PTR m_id = 0;
    DWORD_PTR m_mask = 1 << i;

    m_threads[i] = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)threadMain, (LPVOID)i, NULL, &m_id);
    SetThreadAffinityMask(m_threads[i], m_mask);

    wprintf(L"Creating Thread %d (0x%08x) Assigning to CPU 0x%08x\r\n", i, (LONG_PTR)m_threads[i], m_mask);
  }

  return 0;
}

DWORD_PTR WINAPI threadMain(void* p) {

  return 0;
}