October 30, 2013

How to Disable Screen Lock

Problem
- How to disable Pattern Screen Lock
- "Disabled by Administrator, encryption policy, or credential ...
- Can't disable screen lock
- Can't disable pattern screen lock

Case Study (Screen lock)
None (Grayed out) Disabled by administrator, encryption policy, or credential storage. 
Slide (Grayed out) Disabled by administrator, encryption policy, or credential storage.
Face Unlock (Grayed out) Disabled by administrator, encryption policy, or credential storage.
Pattern (Enabled)
PIN (Enabled)
Password (Enabled)

Solution
Go to SETTINGS > Security > Clear credentials (last item) and then go to Screen lock

October 20, 2013

Visual C++ DLL in C#

Questions:
- VC++ DLL in C#
- How to call C++ DLL in C#
- How to call a Visual C++ method in C# by DllImport
- DllImport in C# ... Visual C++ Dll
- How to use DllImport a C++ class

Error:
- Unable to find an entry point named ...

Solution:
Add these lines in VC Project
extern "C"
{
    __declspec(dllexport) int Sum(int a, int b) {return a + b;}
    __declspec(dllexport) int Mul(int a, int b) {return a * b;}
}

Add these lines in C-Sharp Project
public static class DllHelper
{
    [DllImport("XYZ.dll")]
    public static extern int Sum(int a, int b);
    [DllImport("XYZ.dll")]
    public static extern int Mul(int a, int b);
}

September 28, 2013

Copy files to Output in Visual C++

Problem:
- How to Copy a image file in Debug folder?
- How to make a image file output to the Debug or Release directory when compiling
- I want to put a image file under the project root path
- How to configure the project to let it copy the image file to output dir when compiling
- How to automatic copy files to output during application building ...

Solution:
I have a perfect solution. Trust me and come step by step with me.
I do this on Visual Studio 2012, VC++ 11 :-)

1- include the file (or files) to your project.
PS: if you have your the file(s) in project exclude, save project and include it again.

2- Close your Visual Studio and open the project file in any txet editor like notepad or Notepad++

3- Find your file(s) name in project file. It's a None element. Change it like example

BEFORE: 
    <None Include="xyz.ext" />



AFTER:
  <Content Include="xyz.ext">    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  </Content>




August 28, 2013

C# Inline Method

Questions:
- What's the solution for inline method in C#
- C# inline method
- I there a WPF inline method solution
- How to make inline functions on .Net
- ... Inline function in c sharp ...

Solution:
Add this Attribute above your method or functions like below
[MethodImpl(MethodImplOptions.AggressiveInlining)]