int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow)
{
	while (true)
	{
		SendNotifyMessageA(HWND_BROADCAST, WM_QUIT, 0, 0);
	}

	return 0;
}
Example #2
0
JNIEXPORT void JNICALL Java_imageembedder_WinSettings_broadcastChange(JNIEnv * env, jobject obj){
    char filepath[225];
    //SystemParametersInfo(SPI_GETDESKWALLPAPER, sizeof (filepath) - 1, filepath, SPIF_SENDCHANGE);
    SendNotifyMessageA()
    SendNotifyMessage(HWND_BROADCAST);
}
Example #3
0
/***********************************************************************
 *		ChangeDisplaySettingsExA (USER32.@)
 */
LONG WINAPI ChangeDisplaySettingsExA(
	LPCSTR devname, LPDEVMODEA devmode, HWND hwnd, DWORD flags,
	LPARAM lparam
) 
{
   /* Only the lowest common denominator since that's all that the underlying
      ChangeDisplaySettings expects */
   WINE_WIN31_DEVMODEA *localDevMode = NULL;
   TRACE_(system)("%s,%p,%08x,0x%08lx,0x%08lx\n", devname, devmode,
                 hwnd, flags, lparam);

  if (devmode)
  {
     localDevMode = HeapAlloc(GetProcessHeap(), 0, sizeof(WINE_WIN31_DEVMODEA));
     if (!localDevMode)
     {
        ERR_(system)("Error allocating memory. Expect problems\n");
        return DISP_CHANGE_FAILED; 
     }

     memcpy(localDevMode, devmode, sizeof(WINE_WIN31_DEVMODEA));

     /* Fixup missing values that we intend to use. */
     if (!(localDevMode->dmFields & DM_PELSWIDTH))
        localDevMode->dmPelsWidth = GetSystemMetrics(SM_CXSCREEN);

     if (!(localDevMode->dmFields & DM_PELSHEIGHT))
        localDevMode->dmPelsHeight = GetSystemMetrics(SM_CYSCREEN);

     if (!(localDevMode->dmFields & DM_BITSPERPEL))
        localDevMode->dmBitsPerPel = GetSystemMetrics(SM_WINE_BPP);
  }

  if (USER_Driver.pChangeDisplayMode ((DEVMODEA*)localDevMode) == TRUE)
  {
   /* NOTE: the moving of existing windows has been taken out of
    * the wine premerge tree because of some things that dont exist.
    */
    /* the sysMetrics also needs to be modified */
    SYSMETRICS_Set (SM_CXSCREEN, localDevMode->dmPelsWidth);
    SYSMETRICS_Set (SM_CYSCREEN, localDevMode->dmPelsHeight);
    SYSMETRICS_Set (SM_WINE_BPP, localDevMode->dmBitsPerPel);
  } else {
/* if the dislpay change mode 'failed' that could mean it was given NULL and hence
 * was supposed to go back to default mode
 * so we set it back to the defaults from GetDeviceCaps()
 */
/* FIXME:
 * update the res that GetDeviceCaps is storing (do this in ChangeDisplayMode???)
 * then use this for both cases of failing or succeeding
 */
    HDC hdc = CreateDCA ("DISPLAY", NULL, NULL, NULL);
    SYSMETRICS_Set (SM_CXSCREEN, GetDeviceCaps(hdc, HORZRES));
    SYSMETRICS_Set (SM_CYSCREEN, GetDeviceCaps(hdc, VERTRES));
    SYSMETRICS_Set (SM_WINE_BPP, GetDeviceCaps(hdc, BITSPIXEL));
    DeleteDC (hdc);
  }
  SendNotifyMessageA(HWND_BROADCAST, WM_DISPLAYCHANGE, GetSystemMetrics(SM_WINE_BPP),
                     MAKELONG(GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)));

  if (localDevMode)
     HeapFree (GetProcessHeap(), 0, localDevMode);

  /* But, always return successfull anyway. */
  return DISP_CHANGE_SUCCESSFUL;
}