显示标签为“wince interface”的博文。显示所有博文
显示标签为“wince interface”的博文。显示所有博文

2013年8月11日星期日

How to make program auto-run in WINCE without desktop

1. Write a little program (ShellExe.exe) to start the application software (For example: MyApp.exe)and Explorer.exe
(1) Use VS2005 to build a smart device program (Attention: in the setting guide please choose the program type as WINDOWS application program)
(2) Program code as below. (The guide will generate a lot of code, for example, window process function and so on. They are useless. Delete them and keep the head file and WinMain function would be enough)
#define MYAPP_PATH (L"\\Storage Card\\MyApp.exe") //application software path( at SD card,of course you can change the path according to the real situation)
#define MYAPP_STARTUP (L"\\Storage Card\\MyAppStartup.txt") //the file in this path used to identify if the application software started yet. The file should be build in the application software(MyApp.exe)
int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPTSTR    lpCmdLine,
                   int       nCmdShow)
{
 PROCESS_INFORMATION processinfo;
 WIN32_FIND_DATA stFindData;
 HANDLE hFile = INVALID_HANDLE_VALUE;
 //wait until SD card file load finished
 int nCount = 20; //This value should be big enough. Or it may can’t wait until SD card load file.
 while(nCount--)
 {
  hFile = ::FindFirstFile(MYAPP_PATH, &;stFindData);
  Sleep(500);
  if(INVALID_HANDLE_VALUE != hFile)
  {
   break;
  }
 }
 //if the file loading overtime, enter into Window Explore, return
 if(0 >;= nCount)
 {
  // start explorer.exe
  CreateProcess(L"\\Windows\\explorer.exe",NULL,NULL,NULL,NULL
   CREATE_NEW_CONSOLE,NULL,NULL,NULL,&;processinfo);
  return 0;
 }
 FindClose(hFile);

 SHELLEXECUTEINFO ShExeInfo={0};
 //execute MyApp.exe
 ShExeInfo.cbSize = sizeof(SHELLEXECUTEINFO);
 ShExeInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
 ShExeInfo.hwnd = NULL;
 ShExeInfo.lpVerb = NULL;
 ShExeInfo.lpFile = MYAPP_PATH;
 ShExeInfo.lpParameters = L"";
 ShExeInfo.lpDirectory = NULL;
 ShExeInfo.nShow = SW_SHOW;
 ShExeInfo.hInstApp = NULL;
 ShellExecuteEx(&;ShExeInfo);
 while(1)
 {
  //open the exist file which is build in the application program (MyApp.exe)
  hFile = CreateFile(MYAPP_STARTUP, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
  // if the file is not exist, that means the application program have not started yet.
  if(hFile == INVALID_HANDLE_VALUE)
  {
   //sleep 10ms
   Sleep(10);
  }
  else
  {
   // close the file
   CloseHandle(hFile);
   // delete the file
   DeleteFile(MYAPP_STARTUP);
   // start explorer.exe
   CreateProcess(L"\\Windows\\explorer.exe",NULL,NULL,NULL,NULL
    CREATE_NEW_CONSOLE,NULL,NULL,NULL,&;processinfo);
   break;
  }
 }
 return 0;
}
2. Modify the regedit
 change:
 [HKEY_LOCAL_MACHINE\init]
 "Launch50"="explorer.exe"
 "Depend50"=hex:14,00, 1e,00
 as:
 [HKEY_LOCAL_MACHINE\init]
 "Launch50"="ShellExe.exe"
 "Depend50"=hex:14,00, 1e,00

3. Put the content “ ShellExe.exe    $(_FLATRELEASEDIR)\ShellExe.exe         NK  S” in the ”FILES” label of files X:\WINCE600\PLATFORM\SMDK2450\CESYSGEN\files\platform.bib
and
C:\WINCE600\PLATFORM\SMDK2450\FILES\platform.bib.
4. Copy the built ShellExe.exe executive file to the system file folder. For example, the “FILES” folder in mini 2440 directory. If it is fast-compile, copy it to the directory: \RelDir\smdk2450_ARMV4I_Release.


5. Now we can start to compile. If you have compiled NK, then can use [generate]->;[Make Run-Time Image] to run fast-compile.

2013年7月10日星期三

Wecon human machine interface(HMI) solutions--custom components definition


. Introduction:
 Custom components are maded for customers' need, can set the public ports as your wish.
.Sections:
1. the attribution of custom components on "Levistudio" soft
(Levistudio is the unique software WECON Technology Co.Ltd provided, to setup and manage your 
own projects)
   1) outline-size of components
   2) function address-process the according operation by setting the value of the address as 
      function code
   3) DLL profile name-choose the dll profile you want to use (the profile provided by       
customers)
   4) whether use timer-default as don't
   5) the time of timer-the rang is above 100ms,when the last attribution is applicable
2. the profiles customers need to provide-2 ****.dll profiles and a manual
   1) one of the dll profile is used by PC. Place it under dll_pc folder in Levistudio       installation catalogue.
   2) another dll profile is used by HMI. Place it under dll_hmi folder in Levistudio             installation catalogue.
   3) a manual for this dll
三. the call graph of HMI and dll
四. exact solution of custom compoment-bottle blowing machine
1.bottle blowing machine introduction: alias hollow blowing machine, is a rapidly developed 
way of plastics processing. The finnal products of bottle blowing machine contains:multilayer film and kinds of polyolefin hollow containers
2.the status of bottle blowing machine is as follows:
1) off-line simulation scene as follows:

Customize the size and shape is available.
The custom components can meet the customer's need in greater degree.
It brings the customers brand new sense about utilization,with its highlights.
Suggestion is always welcomed with us.