Premius
  • Home
  • Windows Software
  • Presentation Control
  • Website Transfer Services
  • Blog
    • Internet Marketing
    • Mailing Lists
    • SEO
    • C++
    • PHP
    • Web Design
    • Windows
    • Android
    • Linux
    • JavaScript
    • C# .NET
    • iPhone

C++

  • Home
  • Blog
  • C++
Blog Categories
  • Internet Marketing
  • Mailing Lists
  • SEO
  • C++
  • PHP
  • Web Design
  • Windows
  • Android
  • Linux
  • JavaScript
  • C# .NET
  • iPhone
11 Sep

How to make Windows Apllication Run as Administrator?

With the evolution of Windows, the security requrements has been also risen up. In Windows 10 all applications are run under a lowered user account, which has no access to system folders, system registry entries and so on. The app is limited to something like a sandbox. But what to do if you need to acces to system files and registry keys? You need to run your application as a computer Administrator. This is done through the Windows process called "Elevation". How to run Windows Application as elevated or Administrator account? You will need to add a special entry in your .manifest file when you build your application. A Manifest file is a special sattelite file for your .exe that tells the system how to treat your program. If you don't have a .manifest file, you will need to create one. Also, your file should be linked as Embedded Manifest only. Side-by-side manifests are not supported for elevation.

By premius C++/MFC Read more: %s
07 Sep

How to create a window on a separate desktop in Windows

It's not a secret that Windows 10 has several desktops. The previous Windows versions had separate desktops as well, but only the default was accessible by applications by default. When you need to create a window on a separate desktop, you can use the sample code from this article.

The code below creates a separate thread for the desktop and runs a separate message loop in it. This is necessary because the default application message loop is not intended to rum on multiple desktops. 

 


void CreateDesktop2()
{
	CString sDeskName;
	sDeskName.Format("DeskTop%x",GetTickCount());
		
	HDESK hDesktop2 = CreateDesktop(sDeskName,
	NULL,NULL,0,STANDARD_RIGHTS_ALL|DESKTOP_CREATEMENU|DESKTOP_CREATEWINDOW|
	DESKTOP_ENUMERATE|DESKTOP_HOOKCONTROL|DESKTOP_READOBJECTS|
	DESKTOP_SWITCHDESKTOP|DESKTOP_WRITEOBJECTS,NULL);
	if(hDesktop2 == NULL)
		AfxMessageBox("Error in CreateDesktop",MB_OK,0);
	HDESK hUserDesktop = GetThreadDesktop(GetCurrentThreadId());
	HTHREAD hThread = (HANDLE)_beginthreadex(NULL,0,DeskThread,this,0,(unsigned*)&m_dwThreadId);
}
UINT DeskThread(LPVOID lpParam)
{
	MSG msg;
	
	SetThreadLocale(LOCALE_SYSTEM_DEFAULT);
	SetThreadDesktop(hBlockDesktop);
	if (p->m_wnd_desk.Create())
	{
                /// CREATE YOUR WINDOW HERE
		///p->m_waker_dlg.Create(CWakerDlg::IDD,&p->m_wnd_desk);
		while(::GetMessage(&msg,0,0,0)!=0)
		{
			if (!IsDialogMessage(p->m_waker_dlg.m_hWnd,&msg))// to process keyboard messages
			{
				::TranslateMessage(&msg);
				::DispatchMessage(&msg);
			}
		}
	}
	else
	{
		::MessageBox(0,"DeskThread failed",NULL,MB_OK);
	}
	p->m_waker_dlg.DestroyWindow();
	p->m_wnd_desk.DestroyWindow();
	SetThreadDesktop(p->m_hUserDesktop);
	SwitchDesktop(p->m_hUserDesktop);
	
	_endthreadex(0);
	return 0;
}

 

By premius C++/MFC
24 Apr

WM_MOUSEMOVE message

The WM_MOUSEMOVE Message is posted to a window when the cursor moves. If the mouse is not currently captured, this message is posted to the window that contains the cursor. If the mouse is captured, the WM_MOUSEMOVE message is posted to the window that has captured the mouse. A window receives this message through the windows procedure function.

By premius C++/MFC Read more: %s
27 Sep

How do I make a JSON object with multiple arrays?

{
"cars": {
"Nissan": [
{"model":"Sentra", "doors":4},
{"model":"Maxima", "doors":4}
],
"Ford": [
{"model":"Taurus", "doors":4},
{"model":"Escort", "doors":4}
]
}

 

Source: https://stackoverflow.com/questions/11197818/how-do-i-make-a-json-object-with-multiple-arrays/11197949

By premius C++/MFC
27 Sep

Arrays in JSON

Example

[ "Ford", "BMW", "Fiat" ]


Arrays in JSON are almost the same as arrays in JavaScript.

In JSON, array values must be of type string, number, object, array, boolean or null.

In JavaScript, array values can be all of the above, plus any other valid JavaScript expression, including functions, dates, and undefined.

Arrays can be values of an object property:

Example
{
"name":"John",
"age":30,
"cars":[ "Ford", "BMW", "Fiat" ]
}

The objects returned from most Server APIs are highly nested:

{
"id": "0001",
"type": "donut",
"name": "Cake",
"ppu": 0.55,
"batters":
{
"batter":
[
{ "id": "1001", "type": "Regular" },
{ "id": "1002", "type": "Chocolate" },
{ "id": "1003", "type": "Blueberry" },
{ "id": "1004", "type": "Dog's Food" }
]
},
"topping":
[
{ "id": "5001", "type": "None" },
{ "id": "5002", "type": "Glazed" },
{ "id": "5005", "type": "Sugar" },
{ "id": "5007", "type": "Powdered Sugar" },
{ "id": "5006", "type": "Chocolate with Sprinkles" },
{ "id": "5003", "type": "Chocolate" },
{ "id": "5004", "type": "Maple" }
]
}

SourceŃ‹: https://www.w3schools.com/js/js_json_arrays.asp  https://adobe.github.io/Spry/samples/data_region/JSONDataSetSample.html

By premius C++/MFC
  1. Introduction to JSON
  2. cJSON: Lightweight JSON parser
  3. How to change the master sound volume in Windows Programatically
  4. Is MFC dead? Does MFC have a future?
    • 1
    • 2
Get in Touch
ABOUT PREMIUS

Premius develops Windows and Android software, Magento extensions, and provides professional technology services including website transfer and market research.

Professional services

LATEST POSTS
  • Support page for Prayerbook app

    8:08 PM Oct 6th

  • Support page for StIoannCitates app

    8:08 PM Oct 6th

  • Privacy Policy for optinskiestartsi app

    2:43 PM Mar 29th

CONTACT US
  • info@premius.net

  • www.premius.net

  • Developer Blog

PRODUCTS
  • NetAdmin
  • Presentation Control
  • PC Shutdown Timer
  • Website Transfer
Premius

© Copyright 2026 Premius. All Rights Reserved.