You've seen this! Your customer will see too. Buy this place

How to make Windows Apllication Run as Administrator?

1 1 1 1 1 How to make Windows Apllication Run as Administrator?5.00Rating 5.00 (1 Vote)

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.

Read more: How to make Windows Apllication Run as Administrator?

How to create a window on a separate desktop in Windows

1 1 1 1 1 How to create a window on a separate desktop in Windows5.00Rating 5.00 (1 Vote)

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;
}

 

The params keyword in C#

1 1 1 1 1 The params keyword in C#5.00Rating 5.00 (1 Vote)

Specifying the the C# params keyword as a function argument allows one to pass a variating number of arguments to the function. The type of the arguments should be specified preceding the params keyword. When calling the function, the arguments can be specified comma-delimited, or passwd in as a simple array. The arguments can be also omitted. When declaring a function, the params keyword should go last in the params list. No arguments are allowed after the params is specified. Also no two params are allowed in the declaration. Also notice the arguments can only be of same type only. You can specify generic object type, ut in this can you have to distinguish between arguments.

Read more: The params keyword in C#

OpenFileDialog and SaveFileDialog

1 1 1 1 1 OpenFileDialog and SaveFileDialog5.00Rating 5.00 (1 Vote)

In C#.NET development environment, the common dialog windows for opening and saving files are represented by the OpenFileDialog and SaveFileDialog classes. The classes have much in common, so let's look at them together in this article.

Read more: OpenFileDialog and SaveFileDialog

Google Drive Explanation

1 1 1 1 1 Google Drive Explanation5.00Rating 4.11 (9 Votes)

Google Drive is a cloud data storage platform, which is widely used over the globe. The copyrights are owned by Google. This app allows users to save their personal data (files, images, spreadsheets, presentations, etc.) on google cloud servers and also share the files within a company or with other users to download or even view online. The Google Drive suite includes, but not limited to Google Docs, Spreadsheets, Presentations. Google drive is similar to Microsoft Office, but with much less editing capabilities, but all data available in the cloud. Google Drive is a replacement of Google Docs. Currently, the Gooogle Drive suite has around 300 million users.

Read more: Google Drive Explanation

Database Initialization Strategies in EF 6 Code-First

1 1 1 1 1 Database Initialization Strategies in EF 6 Code-First5.00Rating 5.00 (1 Vote)

If you need to create database for your EF6 application you will need to think about initialization strategy. How to ensure the correct initialization of the database for the first time and also ensure it will not be re-created second time onwards? How to ensure it won't create a new database every time the ASP.NET Core application run? How can we deploy one database for a debug environment and another database for production environment? Entity Framework Does provide several strategies for database creation. They are called the database initialization strategies.

Read more: Database Initialization Strategies in EF 6 Code-First

RTC Wake Up option in BIOS Settings

1 1 1 1 1 RTC Wake Up option in BIOS Settings5.00Rating 4.03 (39 Votes)

The RTC Wake Up option is responsible for automatically turning on the power of the computer at a certain time and day (by "alarm clock"). Usually this feature is not used ( Disabled ). The exceptions are cases when it is necessary to periodically perform certain actions in an automatic mode - for example, to run a computer scan for viruses at night. Then this option must be enabled ( Enabled ).

Read more: RTC Wake Up option in BIOS Settings

What is Universal Windows Platform?

1 1 1 1 1 What is Universal Windows Platform?5.00Rating 4.50 (2 Votes)

The UWP (Universal Windows Platform) is a unified platform for building and running apps on Windows 10 and Windows 10 Mobile.

UWP is the evolution of earlier technologies. So, with the release of Windows 8, a new architectural platform for applications was introduced - Windows Runtime (WinRT), which allowed running applications in the so-called Modern (Metro) mode on desktops and tablets. Then, with the release of Windows 8.1 and Windows Phone 8.1, this technology was developed - there were "universal applications" that could run immediately Windows 8.1 and WP8.1. And in July 2015, the new Windows 10 OS was officially released. It uses the UWP platform, which is an evolution of the Windows Runtime.

As the name of the platform suggests, it is universal - universal for all devices in the Windows 10 ecosystem. And these are ordinary destops, tablets, mobile devices, IoT (Internet of Things) devices, Xbox, Surface Hub devices. And a UWP app can work the same on all of these platforms as long as they have Windows 10 installed.

Read more: What is Universal Windows Platform?

WM_MOUSEMOVE message

1 1 1 1 1 WM_MOUSEMOVE message5.00Rating 5.00 (1 Vote)

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.

Read more: WM_MOUSEMOVE message

Using Ninject in C# ASP.NET MVC5 Projects

1 1 1 1 1 Using Ninject in C# ASP.NET MVC5 Projects5.00Rating 4.50 (2 Votes)

The IoC containers are used for dependency injection. There are many IoC containers, we use Ninject, as it is easy to use and understand. You can install the required package via NuGet. The package is called Ninject.MVC5

After installing the package, we can already use Ninject in the project. For example, let's change the constructor of the controller as follows:


using Ninject;
//.....................
public class HomeController : Controller
{
    IRepository repo;
    public HomeController()
    {
        IKernel ninjectKernel = new StandardKernel();
        ninjectKernel.Bind<IRepository>().To<BookRepository>();
        repo = ninjectKernel.Get<IRepository>();
 
    }
    public ActionResult Index()
    {
        return View(repo.List());
    }
}

Read more: Using Ninject in C# ASP.NET MVC5 Projects

Saturday the 25th.