isEnetOnline
During some testing of the event notifcation interface on a PocketPC device, I found that some essential events are declared but will never be fired. Two of these unsupported events are: NOTIFICATIONEVENTNETCONNECT and NOTIFICATIONEVENTNETDISCONNECT. So I started a small eVC4 workspace for ITC Pocket PC with Windows Mobile 2003 with one simple test application to play with the mibInterface.dwOperStatus. Then I got an app, that will start another process (given by the command line). This tool is now called iRunOnNet.exe and will launch an exe (ie call “iRunOnNet.exe \windows\calc.exe” to have the caculator come up on ethernet connect), if an ethernet connection (the ITC device designed for has a dock ethernet connector) comes up. You can stop the hidden tool by launching it again with the argument -stop.
As a second goal, I would like to get a simple DLL that will export the status of an ethernet connection. Additionally I made a tool (isOnlineDLLtest.exe) that is used to test the functionallity of the DLL. The DLL only exports one function fnIsEnetOnline(). This will give a 0, if ethernet is offline and 1, if ethernet is online. A second export is the variable nIsEnetOnline which will hold the last status. The isOnlineDllTest uses the function fnIsEnetOnline() in a timer and simply shows a text with the last result of this call.
iRunOnNet is a stand-alone app and does not need isEnetOnline.dll. You can either directly use iRunOnNet to have an application launch on a ethernet network connection or you have your own apllication use isEnetOnline.dll in a timer to check for an ethernet connect. The sources for all this is attached.
More »
This tool will start an application given by the command line at a specified event. On every call, the tool will write a log (iRunAtEvent.log.txt) to the root dir. The arguments supported are:
set appname eventtype -sets the event eventtype to launch appname
reset appname -resets ALL events for appname
list -list all known registered events and the applications to launch
More »
The great site geonames.org offers some webservices. One of these is called timezone and will give you the timezone information for a given geographic Latitude and Longitude. With a GPS enabled Windows Mobile device you can so query the webservice and get timezone informations for the current location.
Unfortunately the webservice does not offer WSDL and so you have to write your own wrapper class. I wrote a small class that does the HttpWebRequest and decodes the xml reponse for easy use in your application.
More »
If you want to lockdown a user of a Windows Mobile device to not send/receive SMS messages or eMails, you can use a blacklist. First enable Disallow policy on the device and then list all apps you dont like the user to run.
REGEDIT4
;Enable blacklist of applications that should not run
[HKEY_LOCAL_MACHINE\Security\Policies\Shell]
"DisallowRun"=dword:1
;Add entries to blacklist of applications that should not run
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun]
"1"="tmail.exe"
"2"="sms.dll"
"3"="poutlook.exe"
;add more here as "3", "4", "5", etc.
tmail.exe, sms.dll and poutlook.exe are responsible for message handling on the device. If you disallow them, the user cannot start them anymore.
Category:
CodeProject,
HTML,
Programming,
Tips,
Tools,
Utilities,
WordPress |
Tags:
CodeProject,
CodeProject Technical Blogs,
codeprojectfeeder,
HTML,
php,
WordPress | 44 views |
No Comments
CodeProjectFeeder
In the beginning, everything was done manually.
After the third time I had to edit feed-rss2.php of wordpress to fulfill CodeProjects Technical Blogs requirements I now wrote my first (and last?) wordpress plugin.
As you may know, CodeProject allows you to publish articles through your current blog. See here for the FAQ.
As I am using wordpress, I started some time ago to submit blog entries into CodeProject. I had to find out myself, where to change which file.
Limit published articles
To limit the range of blog entries that are published at CodeProject Technical Blogs I use a ‘hidden’ feature and created a category named ‘CodeProject’ in my WordPress blog. On my Technical Blogs site in CodeProject I then used http://www.hjgode.de/wp/category/codeproject/feed/ for the feed input. Now only the articles marked with WordPress category ‘codepoject’ are feed to CodeProject.
Manually changes required in WordPress for CodeProject Technical Blogs
In feed-rss2.php I always had to add a <category>CodeProject</category> line below <channel>. Further I had to change the footer.php of the wordpress theme Win7blog that I use. There I added a rel=”tag” line as recommended by CodeProject.
The pain of doing it again and again
Now, the first manual change has to be done everytime you update your wordpress release. I had to to this at least three times before I start now with a plugin to I avoid changing the file again manually.
The idea of a WordPress plugin
I never wrote a WordPress plugin before, but I did some html, php and mysql coding before (ie the calendar on www.fewo-britta.de or the static pages at www.derbiedermann.de, which are generated from a db). But the learning curve was hard and it took me several hours to get the plugin working. I started with the plugin described at DevLounge in there “How to write a WordPress plugin” series. The article was the only one I could find that describes wordpress plugin development from scratch with a working example.
As I had problems adopting the code to my needs, especially the AdminPage, I had to rewrite the code a little bit.
More »
Unfortunately, there is no in depth information about the Pocket or Mobile Internet Explorer (PIE) comaptibility. So I can only give some suggestions. But I hope this informations will help you getting started and don’t run into trouble.First, although M$ states, that PIE is compatible to Internet Explorer 4.1, 5.0, 5.5 or 6.0, depending on the OS level you run on a windows ce based device, this is only a general statement:
Pocket Internet Explorer has been updated to support the following:
HTML 4.01
Extensible HTML (XHTML)
Cascading style sheets
Microsoft Jscript® version 5.5
Enhanced scripting and Document Object Model support
Wireless Markup Language (WML) 2.0 (XHTML + WML 1.x)
Internet Protocol version 6 (IPv6) in IPv4/IPv6 mixed-mode environments
New extensible imaging library
From TechEd powerpoint
HTML 3.2 Compliant
JavaScript 1.1 compliant
XML Object Model
SSL
Active X support (no download!)
=============================
HTML 3.2-based object model
Not the IE4 OM
Core script support:
Scripting against FORM elements
Scripting against the XML OM<
Not supported:
Dynamic frameset creation
Dynamic script generation
Window.open
If you try some more special functions of the desktop IE versions, you will find the limits very fast. In example, the OnKey() event is not supported in any of the actual CE OS versions (<=6). XML Dataislands support is very limitted.
More »
Here is a list a some usefull tools for mobile development
More »
The following is a nice? sample for an automation task. This batch will be executed every time a device connects to your PC via ActiveSync. You will need the itsutils.
As you can read, the batch (script) first tries to check, if it has already been run on the device. This is done by looking for a file called “\OnConnect.done”. In real, the batch deletes a local file (line 13) “OnConnect.done” and then simply copies the file from the device (line16). If the file is found, this device has been already processed (line 17) and the batch gos on with line 66.
If the file is not found, the batch continues with setting the registry changes. It uses saved REG files and the nice tool pregutl to do it remotely (line 22 to 24). After doing the changes, the device will be queried for different registry keys which will be saved to database.txt for later use. The registry keys platform (line 29) and version (line 30) are available on all devices, but OSBuildInfo (line 59) and system (line 48) are only available on CK3x or 7xx.
So in line 33, we try to find the model string for CK3x devices and in line 39 for CN2 devices. In line 43 and 44 we will use the saved model names to jump over the part, that is only valid for PPC (7xx): dump psminfo.txt into database.txt. The OSBuildInfo registry is only been executed for CK3x models.
Finally we put a OnConnect.done onto the device, so we later know, that it was handled. At the very end, we sync the time of the device with the PC.
More »
You can have several apps started every time a device connects via ActiveSync on your PC. To enable this, you have to enter the application(s) to start in your PC Windows registry:
REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services\AutoStartOnConnect]
"OnConnect"="\"c:\\windows\\system32\\cmd.exe\" /c d:\\OnConnect\\install.bat"
In this example, the batch file d:\OnConnect\install.bat will be launched every time a device connects via ActiveSync. If you use the itsutils, you can specify a list of commands executed against the connected device. In example, you can use the following install.bat (assuming that all tools and files are in d:\OnConnect) ot alwayss install certain files onto the device.
@echo on
pause
d:
cd d:\OnConnect
pput -f -v _0000_comp_itcivacn2.cab "\DiskOnChip\Persistent Copy\CabFiles\_0000_comp_itcivacn2.cab"
pput -f -v userApp_WCE4.ARMV4.cab "\DiskOnChip\Persistent Copy\CabFiles\IuserApp_WCE4.ARMV4.cab"
pput -f -v sqlce.wce4.armv4.cab "\DiskOnChip\Persistent Copy\CabFiles\sqlce.wce4.armv4.cab"
pput -f -v System_SR_enu.cab "\DiskOnChip\Persistent Copy\CabFiles\System_SR_enu.cab"
pregutl @region.reg
pause "ReBoot ?"
preboot
pause "*************** Finished **************************"
exit
These line copy some files to the device, change the registry with a regedit4 conform file (download sample), sync the time of the device to yours PC time and then perform a warmboot. Using the XDA tools (itsutils) there are many more possibilities. Especially usefull, as PocketPC devices do not support batch files on the device.
If you are developing for windows mobile devices and got several devices, you may not want to be asked to setup a “New Partnership” on a new connected device.
To avoid partnering, you use a registry key and you will no more be asked to setup a partnership with your PocketPC or Windows CE device.
REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services]
“GuestOnly”=dword:00000001
To switch back to accepting partnerships, use this
REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services]
“GuestOnly”=dword:00000000