2012年9月28日 星期五

error LNK2019: unresolved external symbol WinMain referenced in function WinMainCRTStartupHelper

Problem: 
I add an console project to my main project, and I got the error message as title in linking phase.
error LNK2019: unresolved external symbol WinMain referenced in function WinMainCRTStartupHelper

Solve:
Right click on project -> Properties -> Linker -> Entry Point -> type 'wmain'
It is because my project entry point is _tmain and it will link to _tWinMain for CE OS.
So, we have to specify our entry point.


Reference:
Source code in tchar.h
#define _tmain          wmain

#ifdef UNDER_CE
#   define _tWinMain    WinMain // On CE it's always WinMain
#else
#   define _tWinMain    wWinMain
#endif

2012年9月27日 星期四

[Platform Builder] Error: Failed reading e32 structure in module

Problem:
When I try to make image on platform builder, I got an error message as title.
Error: Failed reading e32 structure in module <module_name>

Solution:
We can't placed a file that is NOT an *.exe or a *.dll in the MODULES section of a *.bib file.
We need to move that file to the FILES section of the *.bib


Reference:


2012年9月21日 星期五

[C++] Execute system call in command line.

Example for execute system call for Win32

#include "stdafx.h"
#include "stdlib.h"

int _tmain(int argc, _TCHAR* argv[])
{
    system( "cd c:\\windows\\system32");
    system( "notepad.exe C:\\1.txt");
    return 0;
}

Example for execute system call for WinCE

#include "stdafx.h"

int _tmain(int argc, _TCHAR* argv[])
{
    SHELLEXECUTEINFO ExecuteInfo;
    memset(&ExecuteInfo, 0, sizeof(ExecuteInfo));
 
    ExecuteInfo.cbSize       = sizeof(ExecuteInfo);
    ExecuteInfo.fMask        = 0;              
    ExecuteInfo.hwnd         = 0;              
    ExecuteInfo.lpVerb       = _T("open"); // Operation to perform
    ExecuteInfo.lpFile         = _T("\\storage card\\myBrowser.exe"); // Application name
    ExecuteInfo.lpParameters = _T("--shell"); // Additional parameters
    ExecuteInfo.lpDirectory  = 0; // Default directory
    ExecuteInfo.nShow        = SW_SHOW;
    ExecuteInfo.hInstApp     = 0;
 
    ShellExecuteEx(&ExecuteInfo);

    return 0;
}

Execute program in batch file

This is a simple sample of batch file to execute Notepad and open 1.txt file.


CD C:\Windows\System32
START notepad.exe C:\1.txt
EXIT


Reference:
http://blog.xuite.net/f8789/DCLoveEP/37390106

2012年9月20日 星期四

[Platform Builder] Launch AP when boot up in WinCE

I would like to launch an application when the WinCE device boot up, the AP I made is named 'test.exe'

Step 1:
Copy 'test.exe' along with its necessary dll and resource files into 'C:\WINCE700\platform\SDK_Name\FILES'
All files in the folder will be copy into the object folder (release/debug folder) after project build.


Step 2:
Modify file 'C:\WINCE700\platform\SDK_Name\FILES\platform.bib'
Add 'test.exe $(_FLATRELEASEDIR)\test.exe NK SH' in end of file, but before '; @CESYSGEN ENDIF CE_MODULES_DEVICE'

Step 2.1 (Option):
If you hope your .exe file locate at '\MyFiles\exe' folder, you should modify  'C:\WINCE700\platform\SDK_Name\FILES\platform.dat'

First, add folder into root, add script
root:-Directory("MyFiles")
then, add folder into MyFiles, add script 
Directory("\MyFiles"):-Directory("exe")
Final, add file into \MyFiles\exe, add script
Directory("\MyFiles\exe"):-File("test.exe", "\Windows\test.exe")

Step 3:
Modify file 'C:\WINCE700\platform\SDK_Name\FILES\platform.reg'
Add following statement in end of file, but before '; @CESYSGEN ENDIF CE_MODULES_DEVICE'
[HKEY_LOCAL_MACHINE\init]
"Launch300"="bsqBrowser.exe --shell"

If there is already exist [HKEY_LOCAL_MACHINE\init] , you can just append "Launch300"="bsqBrowser.exe --shell" after exist statement.
The number 300 is the order of initialization, you should give a number beyond exist statement. Avoid using the number smaller than 100 to prevent conflict to system program.

Step 4:
Build, make image and attach device.


Reference:
http://www.360doc.com/content/11/0308/23/4672432_99399478.shtml
http://www.wretch.cc/blog/awaysu/22149164
http://huenlil.pixnet.net/blog/post/23373616-%5B%E8%BD%89%5Dap-launch-flow-in-wince
http://msdn.microsoft.com/en-us/library/aa448442.aspx




2012年9月19日 星期三

Saturated Arithmetic

In general binary operation that 11111111(255)+00000001(1)=100000000(256)

The operation result will be 0 for 8 bit Adder, because the processor is 8 bits only.

If a processor support saturated arithmetic, 255+1 would be 255 (stop at max or min value), and it would not overflow or underflow.


Reference: 
http://www.techbang.com/posts/10678-fully-understand-arm-processors-cisc-and-risc-are-what-history-structure-a-see-through-the-computer-96-issues-cover-story-the-king?page=2

2012年9月13日 星期四

[Platform Builder] A script required for this install to complete could not be run.

Problem:
When I install the QFE 2011_Rollup for CE6.0 Platform Builder, I got an error message below.
There is a problem with this Windows Installer package. A script required for this install to complete could not be run. Contact your support personnel or package vendor.















Solve:
Right click on the msi, select the Compatibility tab, and check the box that says "Run this program in compatibility mode for". Leave the rest as is, and it should install after that. You may also need to do the same thing for some of the other QFE's.



























Reference:
http://bsquare.custhelp.com/app/answers/detail/a_id/733/~/installing-ce-6.0-product-update-rolllups-on-windows-7-and-vista


2012年9月4日 星期二

Python GTK+ 3 Tutorial

Just log the tutorial link.

http://python-gtk-3-tutorial.readthedocs.org/en/latest/index.html

Necessitas Project

Necessitas is a KDE community project aimed to provide an easy way to develop Qt apps on Android platform.

Please see below link for detail.

http://necessitas.kde.org/
http://www.youtube.com/watch?v=suPeZ7XC1xk