Microsoft Study Bible

October 28, 2009

Linus Torvalds thumb up to Windows 7

Filed under: Windows — Tags: , , — Jackson @ 5:34 am

The release of Windows 7 throws a rock to the market of operating system, and makes a big splash. Especially, the rivals of the Microsoft have different attitudes to this. Apple once claimed that it is a good opportunity for apple to snatch pc users and would provide official support for windows 7 through Boot Camp software a few days ago.

Although the other important rival Linux have not declared his opinion to Windows 7, the father of Linux Linus Torvalds thumbed up to Windows 7.When Torvalds attend a seminar exhibition held in Japanese, right to the conference center ,the Microsoft was holding large-scale publicity conference .During meeting break, Torvalds was pulled across the street to “make fun of Microsoft”. Unexpectedly ,Linus Torvalds thumbed up ,which was taken photo of .This picture will go down in  history for ever .

423b4be4-33b5-48ad-b82a-e3c59cd1beb6

October 16, 2009

How to manipulate the library with unmanaged codes?

We could use the library Shell API in Windows 7 and unmanaged codes to manage the libraries .When downloading the software, we often used the folder to classify kinds of resources. For example, among those software, the resource which were downloaded were organized in “All downloads” .In fact, those resources could be stored in different directories and partitions on your hard disk. To be more conveniently use Windows-Explorer to access all of those resources, there is need to create a “MyDownload” library, which is corresponding to the Classified Management way of the “All downloads” file, and manage all of resources downloaded in.

   To better display how to manipulate the library with Shell API, we create a simple console application with Visual C++. In the main function, we’ll create and do the operation of library.

 #include “stdafx.h”
// the introduction of header files

#include <shobjidl.h> // introduce Shell API
#include <objbase.h>
// define  IID_PPV_ARGS  macro
#include <Knownfolders.h> // introduce FOLDERID

int _tmain(int argc, _TCHAR* argv[])
{
    
// COM initialization
    CoInitialize(NULL);
    
// use Shell API to create a library

    IShellLibrary *pIShelLibrary;
    HRESULT hr = SHCreateLibrary(IID_PPV_ARGS(&pIShelLibrary));
    
if (SUCCEEDED(hr))
    {
        
// if the library are successfully created,add the paths of the different files to it.

        IShellItem *pIShellItem;
        SHAddFolderPathToLibrary(pIShelLibrary,
        L
“C:\\Users\\Public\\Pictures”);
        SHAddFolderPathToLibrary(pIShelLibrary,
        L
“C:\\Users\\Public\\Music”
);
        SHAddFolderPathToLibrary(pIShelLibrary,
        L
“D:\\Tools”
);
        SHAddFolderPathToLibrary(pIShelLibrary,
        L
“D:\\Video”
);
        
// store current library into the directories of the system library .
        // that is to say ,to add a new library
MyDownload

        hr = pIShelLibrary->SaveInKnownFolder(FOLDERID_Libraries ,
        L
“MyDownload”
,
        LSF_MAKEUNIQUENAME,
        &pIShellItem);
      
// release the object.
       pIShellItem->Release();
       pIShelLibrary->Release();
  }
    
// release COM

    ::CoUninitialize();
    
return 0;

 

In this code, at first, we introduce the header files that Shell API required .Then in the main function, because those APIs all are based on .COM, we should firstly do COM initialization .After initialization, we can do the operation of the libraries by Shell API. In the code example, we create a new library object with SHCreateLibrary function, and use SHAddFolderPathToLibrary function to add the paths on the hard disk into the library, that is, to use the library to manage the files under these paths. Afterwards, we stored this library created into FOLDERID_Libraries, that is, create a new library definition file under this directoryFinally, we need to release the object COM .After the above steps, we could see the library created in the file browser.

September 25, 2009

Programming with libraries in Windows 7, VS2010??

Windows 7 has its share of highly visible user interface tweaks. After getting past the oohs and aahs of the spiffed-up taskbar, you’ll likely find the new look of good old Explorer the most dramatic difference. Click the Windows Explorer icon on the taskbar, or open Computer from the Start menu, and you’ll get a window that displays not only the standard expandable hard drive labels but also a new feature called Libraries. Before Windows 7 can be useful, you need to understand how it organizes your data with Libraries, the new features in Windows 7.

So, how to perform most of the management operations on a library?

As developers and programmers, how to explore the libraries in Windows7?

  In win7 OS, we can manually manage and create the libraries, and add and delete the folder. Howeverthe developers’  most concern is how to perform management operations in libraries and use libraries in applications .In order to use the libraries, Windows 7 provide the new IShellLibrary API to empower your applications to manipulate libraries.

  This can help ensure that applications remain in sync with user files and Windows since any change made to a library structure will be reflected in the application that is monitoring that library – giving us developers great power and great responsibility.

cfbc519f-ea08-41c8-b106-214cc9b894d2

On the above image ,the top layer is User Interface APIs ,which contains CFDNavigation bar Tree Controls, and so on. With User Interface APIs, we can call the new edition of CFD that support libraries to make the applications could support this new feature in libraries when our applications was opened or stored.

Here is a look at this feature in the application instance.

private void button1_Click(object sender, EventArgs e)
  
    {
  
        string strPath;
  
        // create the new edition of the common file dialog
  
        System.Windows.Forms.SaveFileDialog _fd = new System.Windows.Forms.SaveFileDialog();
          // set the properties of the Dialog

         fd.Title = “ Please select the location to save the file “;
          fd.FileName = “[ Select the folder
-]“;
  
        fd.Filter = “Library|no.files”; // set the options and only choose Library
  
        // Display the Dialog
  
        if (_fd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  
            {
  
            // Get the result the uses chose .
  
            string dir_path = System.IO.Path.GetDirectoryName(_fd.FileName);
  
            if (dir_path != null && dir_path.Length > 0)
                  {

                         strPath = dir_path;
  
                }
  
            }
  
            //use the path the users chose to do subsequent process
      }

 

  In addition to User Interface APIs, we’ll pay more attention to Shell API. With Shell API, we could perform management in libraries .In fact, we could modify the file .library-ms, and the system will read the information from the file to reorganize the data in libraries after the file is modified. This group Shell API has packed a number of .com objects. We could manipulate libraries with these objects, of which there are several ones in common usage below:

 IShellLink: this object could be a file, a folder or a link to the executable file.

IShellFolder: this object is to represent a folder object.

IShellLibrary:

Besides, Shell APIs also provide multiple auxiliary functions, which are used to manipulate the libraries .For example:

1.     Create a library and open a library that already exists.

2.     Add the folder to the library or delete a folder in library.

3.     Attain a folder list of a library.

4.     Attain or set the options of the library.

5.     Attain or set the icon of the library.

Through these Shell APIs, we can completely manipulate the library in the Operating System.

 

 

 

September 16, 2009

How to perform operations on libraries in Windows 7?

After creating the library, we’ll use Shell API to perform operations on libraries, such as to set the icon of the library, and the default path to save the library, or enumerate all of the folders in the library, and so on.

 

  #include “stdafx.h”
#include <shobjidl.h>
#include <objbase.h>
// IID_PPV_ARGS macro
#include <Knownfolders.h>
#include <Shlguid.h.>
int _tmain(int argc, _TCHAR* argv[])
{
   CoInitialize(NULL);
    
// Create the library
    //manipulate the library

    IShellLibrary *pslLibrary;
    
// load the library that already exists and manage it .
    HRESULT hr = SHLoadLibraryFromParsingName(L
“C:\\Users\\Win7\\
    AppData\\Roaming\\Microsoft\\Windows\\Libraries\\
    MyDownload.library-ms
“,
    STGM_READWRITE, IID_PPV_ARGS(&pslLibrary));
    
if(SUCCEEDED(hr))
    {
        
// To set the icon of the library

        hr = pslLibrary->SetIcon(L
“C:\\Windows\\System32\\SHELL32.dll,-14″);
        
// To set the type of the library

        hr = pslLibrary->SetFolderType(FOLDERTYPEID_GenericLibrary);
        
//traverse all folders in the library in the loop.
        IShellItemArray *psiaFolders;
        hr = pslLibrary->GetFolders(LFF_STORAGEITEMS,
        IID_PPV_ARGS(&psiaFolders));
        IEnumShellItems *penumShellItems;
        psiaFolders->EnumItems(&penumShellItems);
        DWORD dwCount =
0
;
        psiaFolders->GetCount(&dwCount);
        IShellItem *psiFolder;
      
// traverse all folders the library managed in the loop.
       for(DWORD dwIndex = 0
; dwIndex < dwCount; ++dwIndex )
            {
                
// To obtain the folder

                 psiaFolders->GetItemAt(dwIndex, &psiFolder );
                 WCHAR strFolderName[
256] = L“”;
                  LPWSTR *pName = (LPWSTR*)strFolderName;
                  
// To obtain the name of the folder.


                  hr = psiFolder->GetDisplayName(SIGDN_NORMALDISPLAY,

                 (LPWSTR*)pName);
                 if(SUCCEEDED(hr))
                 {
                
// To compare the name of the folder with the “Tools”
                 // That is ,to find the folder named “Tools”

 

                     if(wcscmp( *pName, L“Tools”) == 0)
                     {
                    
// if the “Tools ”folder could be found ,

//and the folder would be set the default folder for the library to save the file.
                   hr = pslLibrary- >SetDefaultSaveFolder(DSFT_PRIVATE, psiFolder);
                      }
                  }
              }
              
// To submit the changes to the library.
          pslLibrary->Commit();
          pslLibrary->Release();
          }
    }
        ::CoUninitialize();
    
return 0
;
}

In this code, we firstly use SHLoadLibraryFromParsingName function to load the library from its definition file and create an IShellLibrary object.

Then we could do the operation on the library with the operation functions provided by the IShellLibrary object. In the code, we modified the icon of the library by using SetIcon function, which accepted a string as a parameter and assigned the name of DLL and Icon Index.

Afterwards we modified the type of the library by using SetFolderType function ,which could accept GUID as the parameter ,which defined the types of the library ,which could be one of the following types: Generic types, picture, music, video, document and so on. When setting the type of library, we can change the Windows explorer view of the library, and enable the search and the view options specially designated for the library type. The next step is to traverse all folders in the library in the loop and find the folder named “Tools” and the folder will be set the default folder for the library to save the file. By default, when we chose a library to save the files in CFD, the system would use the first folder to save the files .However; we could re-specify the default location of the library by modifying the default folder. At last, we can call Commit function to submit the changes to the library, and that is, to write these changes to the library definition files, in order to complete the operation on the library. 

 

 

 

 

 

September 7, 2009

Turn off UAC or Give up Windows 7?

Filed under: Windows — Tags: , , , , , , — Jackson @ 8:57 pm

My Reviews about UAC in Windows 7 (Part 2)
三 Turn off the UAC
But some users of Win7 would like to use the window control strategy, rather than the new and advanced security technology of Windows 7 called User Account Control. What should they do with the UAC, either give up Win7 or choose some other OS? My answer is there is no need to choose other operating systems; just one simple operation could make it. The system admin just turned the level to the fourth, that is to say, turned off the UAC, which make the OS Win7 the same like the previous edition ones that didn’t have UAC.
Like Windows XP, Win7 that had turned off UAC would never notify the system administrator if there is any change in system configuration. For example, when the user as an administrator access to the Operating System, any changes in OS by the application won’t automatically notify the administrator, and will become directly applicable.
123

1231
Overall, the UAC experience is much improved in Windows 7 than in Windows Vista. The number of clicks (by default) is drastically reduced in Windows 7 when compared to Windows Vista. The ultimate goal of the UAC is to provide user the control over what changes can happen to the system and not to annoy users with more number of prompts.
However,if some malicious programs inserted into and system, would secretly change system settings or configurations such as webpage, the registry etc. When the users with a general or common account accessed to the OS, any changes that the users have no relevant authority to do have would meet with a refusal, such as the installation and upgrade of the application, the changes in the system configuration, and so on. Unless the user sent an oral notice to the admin to adjust the authority, the users could not do those changes.
It should be noted that only when the system administrator must restart the computer, the adjustment that the admin changed the high level to the fourth would come into force.
When UAC was turned off, kinds of applications would cause damage to the OS. Because the application could access to and modify the protected areas, the private data and so on, that is to say, the application had the same privilege as the admin. Besides, some malicious programs could also secretly do communication and data transmission with other computers on networks, even the hosts on the Internet, which would attack and damage the OS.

September 1, 2009

August 14, 2009

virtual machines replace dual booting ????

Filed under: Windows — Tags: , , , , , , — Jackson @ 4:13 am

When your soft ware application can not performance or install on your OS( such as Windows xp Pro x64 or Windows 7 or some other new and unfamiliar operating sysem ),may you’ll consider dual booting.Of course ,this is not a bad choice.
Yes ,you can have dual operating systems,but you can’t run both at once.you must shut down everyting you are doing .Start the slow, annoying ,painful process to reboot into the second OS. Much more to your annoyance,you had to re-install all applications .Some day,you find one of two operating systems useless or you want to install a new or better functional Operating System.So,you want to remove that from your C:drive and you are afraid that it will cause nuisance to your computer or the operating system.
Maybe ,you will step back!!!

If you use the virtual machines ,maybe everything will go easy!!
For example ,your OS is Windows xp 16-bit version or 32 bit -version,you can
run the Windows XP Professional x64 Edition into a virtual machine .So,you can run one of them you need ,without shutting down any work you are doing.You can choose the operating system to run your application.
the favorite is running a virtual machine on your computer is essentially the same as running a full second computer.
But for more normal workloads, I find the performance quite acceptable

But ,the VM can’t answer all things.
The Virtual machine does not support FireWire and USB 2.0 while you need to have USB support in your VM enviornment.Also,A VM will have an influence on your guest and host machines.Obiviously,if you guest machine are running a game ,your host machine can’t perform well.

Maybe ,both of the VM and dual booting have their advantages .
Maybe,We can share your better ideas.

August 10, 2009

Windows 7 will support vpc7

Filed under: Windows — Tags: , , , , , , , — Jackson @ 11:46 pm

The big feature of Windows 7 is to support vpc7,a new version of Virtual PC,which make the application directly integrate into the Win7 desktop and start menu.And,VPC7 can replace VM with the same technology as used by TS RemoteApps ,running as if the application were local.

characteristic:
a full fledged desktop virtualization program .The xp applications can be integrated into your Windows7 host,at the same time ,you can create more VMs to protect your host OS.For example,you can install a program that you don’t trust or not be safe in the VM.Even if the programe crashes ,it will damage your host OS.Or,use the virtualized web browser ,not a “real” one .
how to create a VM. (more…)

Windows 7 To Break Backwards Compatibility, mistake or not?

Filed under: Windows — Tags: , , , , , — Jackson @ 11:06 pm

Windows 7 To Break Backwards Compatibility, mistake or not?

Previous versions of Windows provided backwards compatibility with older versions of windows, making it easy for users to upgrades as their favorite programs would still work.

However,Windows 7 will not be binary compatible with older versions.By not being binary compatible with previous versions of Windows and being built from the ground up, will give Windows 7 significant performance improvements.but it will increase the upgrade pain for users who may find that some of their existing applications will no longer work and will need upgrading. (more…)

May 22, 2009

MSDN Subscribers can acess Visual Studio 2010 Beta 1

Filed under: Developer tools and applications — Tags: , — admin @ 10:43 pm

One of the many benefits of being an MSDN Subscriber is early (and sometimes exclusive) access to early bits. Today the long awaited beta of Visual Studio 2010 and .NET Fx 4 will appear on the MSDN Subscribers site. It’s not there yet but it will appear later on today. Keeping an eye on Twitter is usually a good way to see when it hits

Later in the week (probably Wednesday) updated documentation will be released on the Visual Studio 2010 homepage.

We’re very keen for you to download, install and evaluate Visual Studio 2010. Most importantly we really need your feedback so we can improve it.

For those of you who’ve been soldiering on with the PDC CTP VM, I’m sure this will come as a welcome relief.

It should work just fine on Windows 7 RC.

Older Posts »

Powered by WordPress

Close
E-mail It