Wednesday, February 29, 2012

Visual Studio 11 Beta is available


Visual Studio 11 Beta is here

The wait is over. Get Visual Studio 11 Beta today and start preparing for the next generation of development. You can’t predict the future, but you can get there first.

link: http://www.microsoft.com/visualstudio/11/en-us/

Download Windows 8 Consumer Preview

It's Windows reimagined and reinvented from a solid core of Windows 7 speed and reliability. It's an all-new touch interface. It's a new Windows for new devices. And it's your chance to be one of the first to try it out.

Get It Now: http://windows.microsoft.com/en-US/windows-8/consumer-preview

Windows 8 Tablet Hands-on Walk Through at MWC 2012



Monday, February 27, 2012

Visual Studio 11 Beta arrives on February 29, 2012

Visual Studio 11 Beta
Visual Studio 11 Beta arrives on February 29, 2012. Can't wait to download and try it for yourself? Get the scoop on what's to come. Learn how to go live with Beta ›

Thursday, February 23, 2012

C# Database Basics


Product Description

Working with data and databases in C# certainly can be daunting if you’re coming from VB6, VBA, or Access. With this hands-on guide, you’ll shorten the learning curve considerably as you master accessing, adding, updating, and deleting data with C#—basic skills you need if you intend to program with this language.

No previous knowledge of C# is necessary. By following the examples in this book, you’ll learn how to tackle several database tasks in C#, such as working with SQL Server, building data entry forms, and using data in a web service. The book’s code samples will help you get started on your own projects.

  • Create a Windows Forms application with a datagrid
  • Connect to multiple data sources, including Access and SQL Server
  • Add, edit, and update data in a database you choose and design
  • Enable users to choose their data source at runtime
  • Learn the roles of DataTable, DataView, BindingSource, Filters, and other objects
  • Understand where variables are declared and how they impact the code
  • Build a simple web service that connects to a database

About the Author

Michael Schmalz works in financial services and performs business and technology consulting in a variety of industries. He has done technical editing for O'Reilly on several Microsoft Office books and authored "Integrating Excel and Access". Michael has a degree in Finance from Penn State. He lives with his wife and children in Pennsylvania.

Sunday, February 12, 2012

A minimum MFC Windows Application

- In Start-up page of Microsoft Visual Studio 11, click New Project... to call-up application wizard.

- Select template of Visual C++ Win32 Project, with name of MFCminApplication, and click OK.
Create a new Visual C++ Win32 Project

- Click Next on the Application Settings screen.
Application Settings

- Check Empty project option, and click Finish.
Empty project

- After project created, click Project on the top menu, and select the project properties - MFCminApplication Properties...
MFCminApplication Properties...

- Select Configuration Properties -> General tab, select Use MFC in Shared DLL in Use of MFC property.
select Use MFC in Shared DLL

- Right click Source Files in Solution Explorer, -> Add -> Class to craete a new source file.
craete a new source file

- Select Visual C++ Class, and click Add.
Add a new Visual C++ Class

- Enter Class name of CMFCminApplication(both .h and .cpp file name will be generatedautomatically), with Base class of CWinApp, public Access. Finish.
Enter Class info

- You will be complained Bass class 'CWinApp' not found in the project. Click Yes to continue adding the class.
Bass class 'CWinApp' not found in the project.

- Modify the generated MFCminApplication.h and MFCminApplication.cpp:
MFCminApplication.h
#pragma once
#include <afxwin.h>
class CMFCminApplication :
 public CWinApp
{
public:
 virtual BOOL InitInstance();
};


MFCminApplication.cpp
#include "MFCminApplication.h"

class CMFCminFrameWnd :
 public CFrameWnd
{
public:
 CMFCminFrameWnd(){
  Create(0, L"Hello, Minimal MFC Application");
 }
};

BOOL CMFCminApplication::InitInstance(){
 m_pMainWnd = new CMFCminFrameWnd;
 m_pMainWnd->ShowWindow(m_nCmdShow);
 return TRUE;
}

CMFCminApplication myApplication;


- Finally, you can build and run the application.
The finalized project

- The minimal application change the title only!
The minimal MFC Application

Wednesday, February 8, 2012

Microsoft C++ Accelerated Massive Parallelism (C++ AMP) preview


C++ Accelerated Massive Parallelism (C++ AMP) accelerates the execution of your C++ code by taking advantage of the data-parallel hardware that is commonly present as a GPU on a discrete graphics card. The C++ AMP programming model includes support for multidimensional arrays, indexing, memory transfer, and tiling. It also includes a mathematical function library. C++ AMP language extensions and compiler restrictions enable you to control how data is moved from the CPU to the GPU and back.

It's a preview document in MSDN for C++ Accelerated Massive Parallelism (C++ AMP)

Microsoft Silverlight 5 Building Rich Enterprise Dashboards


Create, customize and design rich enterprise dashboards with Microsoft Silverlight 4 with this book and eBook

  • With this book and e-book, learn how to create, customize and design rich enterprise dashboards with Silverlight
  • Move from scenarios to requirements by applying user-centered design best practices
  • Discover the tips, tricks and hands on experience to create, customize and design rich enterprise dashboards with Silverlight from a distinguished team of User Experience and Development authors

In Detail

Microsoft Silverlight is a powerful development platform for creating rich media applications and line of business applications for the web and desktop. Silverlight enables you to create, customize and design rich enterprise dashboards that highlight Key Performance Indicators for your business.

Microsoft Silverlight 4: Building Rich Enterprise Dashboards, is a concise and practical tutorial that shows you how to create, customize and design rich enterprise dashboards with Silverlight.

This book provides real world user experience design topics and starts by providing an overview of the Silverlight Platform and the clear advantages it provides for building dashboards. The book then dives into topics such as Silverlight design and development tools, building a basic Dashboard, Dashboard types and user needs, Designing for Insight, Styling, Building an End to End Dashboard Solution and Data Access Strategies amongst others.

What you will learn from this book

  • Learn how to create custom user controls, reference resources, and edit basic control templates
  • Build an end-to-end dashboard solution
  • Learn how to use Microsoft Expression Blend to style a dashboard
  • Explore the different types of dashboards, and learn how to choose the most appropriate dashboard type based on your project goals
  • Discover and represent user needs and scenarios as a basis for dashboard design, using user experience best practices
  • Understand how to determine between the different data access strategies (SOAP, REST, and OData)
  • Host and use Silverlight WebParts and the SharePoint Client Object Model

Approach

This book is a concise and practical tutorial that shows you how to create, customize and design rich enterprise dashboards with Silverlight.

Who this book is written for

If you are a .Net developer who wants to create, customize and design rich enterprise dashboards with Silverlight, then this book is for you. You should have an intermediate understanding of .Net development, with a working knowledge of Microsoft Silverlight.



Sunday, February 5, 2012

Setting up Kinect for Windows SDK


In setting up your development environment we'll discuss the following topics:
  • The basics of using the Managed API
  • The key developer resources to use in your application like the KinectWpfViewers that ship Kinect SDK Kinect Explorer sample and the Coding4Fun Toolkit for skeletal scaling that will be used in later Quickstart videos.
  • Demos of how to manage and connect to a Kinect using the KinectSensors collection and using the KinectSensorChooser WPF control


Source: http://channel9.msdn.com/Series/KinectQuickstart/Setting-up-your-Development-Environment

Saturday, February 4, 2012

Create Visual C++ CLR Windows Forms Application on Microsoft Visual Studio 11 Developer Preview

- Click New Project... on the front page of Microsoft Visual Studio 11 Developer Preview.

- Select template of Visual C++ CLR, Windows Forms Application to to create application with a Windows user interface, name WindowsFormsApplication1. And click OK.
New a Visual C++ CLR Windows Forms Application

- The application wizard will generate a Windows application with a empty form for you.
Windows Forms Application

- Click on the Toolbox tab, and click the Auto Hide icon to keep it open.
Open Toolbox

- The Design window will re-align after the Toolbox pane ecpended.


- Drag a Label control from Toolbox to the form in Design window.
Add a Label

- Enter "Hello" in the Text field in Properties window, text of the Label in the form will change accordingly after press ENTER.
Change property

- Build and Run.
Demo program of Visual C++ CLR Windows Forms Application

Create Visual C++ MFC Application using Microsoft Visual Studio 11 Developer Preview's Application Wizard

- Click New Project... in Microsoft Visual Studio 11 Developer Preview

- Select template of Visual C++, MFC Application to create an application that uses the Microsoft Foundation Class Library, name MFCApplication1. Click OK.
Select template of Visual C++ MFC Application

- Review current project settings, and click Next.
project settings

- Accept the default setting and click Next.
Application Type

- Accept the default setting, Compound document support of None, and click Next.
Compound document support

- Click Next.
Document Template Properties

- Accept Database support of None, click Next.
Database support

- Accept the default User Interface Features.
User Interface Features

- Accept the default Advanced Features.
Advanced Features

- Finish.
Finish

- The application wizard has created this MFCApplication1 application for you. This application not only demonstrates the basics of using the Microsoft Foundation Classes but is also a starting point for writing your application.

- Double Click to open ReadMe.txt in Solution Explorer. This file contains a summary of what you will find in each of the files that make up your MFCApplication1 application.
ReadMe.txt

- Build and Run.
Demo sample of Visual C++ MFC Application

Friday, February 3, 2012

Creating a Win32 Windows Application using Win32 Application Wizard

- Click New Project... in Microsoft Visual Studio 11 Developer Preview

- Select Template of Visual C++ Win32, Win32 Project, enter Name of the project, ex. Win32Project1, and click Enter.
Win32 Application Wizard

- Walk through the steps of Application Wizard, by clicking of Next.
Next

- Review and accept the default setting by clicking of Finish.
Finish

- The Application Wizard will generate the default Win32 Project for you.
auto-generated project

- Where Win32Project1.cpp is the main application source file.
// Win32Project1.cpp : Defines the entry point for the application.
//

#include "stdafx.h"
#include "Win32Project1.h"

#define MAX_LOADSTRING 100

// Global Variables:
HINSTANCE hInst;        // current instance
TCHAR szTitle[MAX_LOADSTRING];     // The title bar text
TCHAR szWindowClass[MAX_LOADSTRING];   // the main window class name

// Forward declarations of functions included in this code module:
ATOM    MyRegisterClass(HINSTANCE hInstance);
BOOL    InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);

int APIENTRY _tWinMain(HINSTANCE hInstance,
                    HINSTANCE hPrevInstance,
                    LPTSTR    lpCmdLine,
                    int       nCmdShow)
{
 UNREFERENCED_PARAMETER(hPrevInstance);
 UNREFERENCED_PARAMETER(lpCmdLine);

 // TODO: Place code here.
 MSG msg;
 HACCEL hAccelTable;

 // Initialize global strings
 LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
 LoadString(hInstance, IDC_WIN32PROJECT1, szWindowClass, MAX_LOADSTRING);
 MyRegisterClass(hInstance);

 // Perform application initialization:
 if (!InitInstance (hInstance, nCmdShow))
 {
  return FALSE;
 }

 hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_WIN32PROJECT1));

 // Main message loop:
 while (GetMessage(&msg, NULL, 0, 0))
 {
  if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
  {
   TranslateMessage(&msg);
   DispatchMessage(&msg);
  }
 }

 return (int) msg.wParam;
}



//
//  FUNCTION: MyRegisterClass()
//
//  PURPOSE: Registers the window class.
//
ATOM MyRegisterClass(HINSTANCE hInstance)
{
 WNDCLASSEX wcex;

 wcex.cbSize = sizeof(WNDCLASSEX);

 wcex.style   = CS_HREDRAW | CS_VREDRAW;
 wcex.lpfnWndProc = WndProc;
 wcex.cbClsExtra  = 0;
 wcex.cbWndExtra  = 0;
 wcex.hInstance  = hInstance;
 wcex.hIcon   = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_WIN32PROJECT1));
 wcex.hCursor  = LoadCursor(NULL, IDC_ARROW);
 wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
 wcex.lpszMenuName = MAKEINTRESOURCE(IDC_WIN32PROJECT1);
 wcex.lpszClassName = szWindowClass;
 wcex.hIconSm  = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));

 return RegisterClassEx(&wcex);
}

//
//   FUNCTION: InitInstance(HINSTANCE, int)
//
//   PURPOSE: Saves instance handle and creates main window
//
//   COMMENTS:
//
//        In this function, we save the instance handle in a global variable and
//        create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
  HWND hWnd;

  hInst = hInstance; // Store instance handle in our global variable

  hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
     CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);

  if (!hWnd)
  {
     return FALSE;
  }

  ShowWindow(hWnd, nCmdShow);
  UpdateWindow(hWnd);

  return TRUE;
}

//
//  FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  PURPOSE:  Processes messages for the main window.
//
//  WM_COMMAND - process the application menu
//  WM_PAINT - Paint the main window
//  WM_DESTROY - post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
 int wmId, wmEvent;
 PAINTSTRUCT ps;
 HDC hdc;

 switch (message)
 {
 case WM_COMMAND:
  wmId    = LOWORD(wParam);
  wmEvent = HIWORD(wParam);
  // Parse the menu selections:
  switch (wmId)
  {
  case IDM_ABOUT:
   DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
   break;
  case IDM_EXIT:
   DestroyWindow(hWnd);
   break;
  default:
   return DefWindowProc(hWnd, message, wParam, lParam);
  }
  break;
 case WM_PAINT:
  hdc = BeginPaint(hWnd, &ps);
  // TODO: Add any drawing code here...
  EndPaint(hWnd, &ps);
  break;
 case WM_DESTROY:
  PostQuitMessage(0);
  break;
 default:
  return DefWindowProc(hWnd, message, wParam, lParam);
 }
 return 0;
}

// Message handler for about box.
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
 UNREFERENCED_PARAMETER(lParam);
 switch (message)
 {
 case WM_INITDIALOG:
  return (INT_PTR)TRUE;

 case WM_COMMAND:
  if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
  {
   EndDialog(hDlg, LOWORD(wParam));
   return (INT_PTR)TRUE;
  }
  break;
 }
 return (INT_PTR)FALSE;
}


- Build and Run the project. It's a default Win32 Project.
Win32 Windows Application

Enable IIS 8 on Windows 8 Developer Preview

To enable Enable Windows 8 Developer Preview's IIS 8 Server:

- Click Control Panel in Windows 8 Metro UI screen.
Control Panel

- Select More Settings.
More Settings

- Click Programs
Programs

- Click Turn Windows features on or off.
Turn Windows features on or off

- Check Internet Information Services, and click OK.
Enable Internet Information Services

- After a while, Windows 8 will setup your server. Once complete, open a browser, and switch to http://localhost/. Your server is up and running.
IIS 8 on Windows 8 Developer Preview

- Typically, your IIS document root is located at C:\inetpub\wwwroot
C:\inetpub\wwwroot

- If you set permission of your firewall, it can be accessed from other computer. It's screen shoot captured on an Android tablet to access Windows 8's IIS web page.
captured on an Android tablet



GoingNative 2012 - a 48 hour, globally live-streamed technical event


GoingNative 2012 is a 48 hour, globally live-streamed technical event for those who push the boundaries of general purpose computing by exploiting the true capabilities of the underlying machine: C++ developers. Distinguished speakers include the creator of C++, Bjarne Stroustrup, C++ Standards Committee Chair, Herb Sutter, C++ template and big compute master, Andrei Alexandrescu, STL master Stephan T. Lavavej, LLVM/Clang developer Chandler Carruth, distributed and parallel computing expert Hans Boehm, and C++ library design expert and ISO committee member Andrew Sutton.

"C++11 feels like a new language" says C++ creator Bjarne Stroustrup, who will keynote the event. Tune in now and find out why.

link: http://channel9.msdn.com/Events/GoingNative/GoingNative-2012

Thursday, February 2, 2012

C/C++ Exercise: array and pointer

#include <iostream>
#include <conio.h>

using std::cin;
using std::cout;
using std::endl;

int main(){
 cout << "http://dev-microsoft.blogspot.com/" << endl;
 cout << "C/C++ Exercise: array and pointer" << endl << endl;

 const int SIZE = 5;
 int number[SIZE] = {0, 1, 2, 3, 4};

 cout << "address of &number[i] - " << endl;
 for(int i = 0; i < SIZE; i++ ){
  cout << &number[i] << ":";
 }
 cout << endl;

 cout << "accessed using pointer - " << endl;
 int *pnumber = &number[0];
 for(int i = 0; i < SIZE; i++ ){
  cout << pnumber++ << ":";
 }
 cout << endl;
 
 cout << endl;
 system("PAUSE");
 return 0;

}

C/C++ Exercise: array and pointer