o Mike's PocketPC corner 

updated: March 23, 2009

o Strip_eVB
o IPaq_info.dll FREE!
o evbSearch/Replace
o Richink control
o GetWordDocument1 text
o GetWordDocument2 text

o Using zlibce compression library in eVB
o How to? BSTR and pocketPC dll in eVB

ocsoon using PocketFrog to create a splash screen for eVB



How to? BSTR and pocketPC dll in eVB

long PASCAL YourFunctionName(BSTR * paramX)
//if you return some value from function if not put void instead
{
HRESULT hr;
TCHAR tmpString[50];// whatever you do with the tmpString
hr = SysReAllocString(paramX, tmpString);

if(FAILED(hr))
    return -1;
else
   return 0;
}
in eVB: bas module
Declare Function YourFunctionName Lib "DLLname" (st As String) < no ByVal :-)
in eVC: Project->Settings->Link->object/library modules make sure you have oleout32.lib otherwise linking will "produce" an error

How to use ZlibCE compression/decompression library in the eVB?

zlibExample on how to use ZlibCE.dll compression library in the eVB.

Get zlib version
Public Declare Function
zlibVersion Lib "zlibce.dll" () As String
Dim
st As Variant
st = zlibVersion()
MsgBox (
Format_to_UNICODE(st))


The dll has been written with ANSI string "in the mind" so we'll need well known UNICODE to ANSI and ANSI to UNICODE functions
to convert our strings from to UNICODE<->ANSI $#%# :-)

Public Declare Function
compress Lib "zlibce.dll" (ByVal dest As String, destLen As Long, ByVal source As String, ByVal sourceLen As Long) As Long

Public Declare Function uncompress Lib "zlibce.dll" (ByVal dest As String, destLen As Long, ByVal source As String, ByVal sourceLen As Long) As Long

'COMPRESS

Dim
ret, Dim tst_st As String, Dim tst_len As Long, Dim dest_len As Long

tst_st = Format_to_ANSI (mytext.Text)
dest_st = Space(Len(tst_st))
dest_len = Len(dest_st)

ret = compress(dest_st, dest_len, tst_st, Len(tst_st))
or to control speed and compression ratio use
ret = compress2(dest_st, dest_len, tst_st, Len(tst_st), level)

The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
1 gives best speed, 9
gives best compression, 0 gives no compression at all (the input data is simply copied a block at a time).
Z_DEFAULT_COMPRESSION requests a default compromise between speed and compression (currently equivalent to level 6).

'/* compression levels */
Const  Z_NO_COMPRESSION = 0
Const  Z_BEST_SPEED = 1
Const  Z_BEST_COMPRESSION = 9
Const  Z_DEFAULT_COMPRESSION = (-1)


Text1.Text = CStr(ret) 'error code
Text2.Text = Trim(dest_st) ' display compressed string
Text3.Text = "deslen = " + CStr(dest_len) 'compressed length

'UNCOMPRESS

Dim
ret, Dim st, Dim dest_st2 As String , Dim tst_st As StringDim tst_len As Long , Dim dest_len As Long

dest_st2 = Space(450)
dest_len = Len(dest_st2)
tst_st = dest_st ' FROM COMPRESS function - global var
tst_len = Len(tst_st)
ret = uncompress(dest_st2, dest_len, tst_st, tst_len)

Text1.Text = CStr(ret) 'error codes
st = Format_to_UNICODE (dest_st2)
Text2.Text = Trim(st) ' uncompressed string
Text3.Text = "deslen = " + CStr(dest_len) ' uncompressed length



  Download the project files FREE  |    Download the ZlibCE.dll FREE
There are "tons" of the (exported) functions available in ZlibCE.dll, Take a closer look in the zlib.h for all of them, the above may be enough for the start :)

Stripe/Remove the spaces and the comments from eVB's .ebf and .bas files

Make ebf and bas files smaller before the Make ("compile") command  in the eVB. A .vb file should be smaller too.

  Download executable - FREE
  Download project files-  FREE VB6 source for strip_evb - you are free to modify, sell it, claim it or whatever


Read / Get Pocket Word DOC WORD-DOCUMENT trough eVB and convert it to TEXT or RTF text

It is now possible to READ / WRITE the POCKET's word files (pws,pwi) without opening them first and convert them to RTF, TEXT or PWS (PWI) file and all this inside of the eVB. ecncWordDoc.dll is a upgraded version of the ecncrichink.dll. The ecncWordDoc.dll will read/write any PWI/PWS file including the pictures + reading RTF files (depends of the flag set)

Dim y As Long
y = PWIfrom_file(inkhwnd, path, format)
y= PWI_stream_out (inkhwnd, format,string)

Available formats:

Public Const SF_TEXT = &H1
Public Const SF_RTF = &H2
Public Const
SF_UNICODE = &H10
Public Const SF_UTEXT = &H11
Public Const SF_PWI = &H10802 'use SavePWIFile !!

Public Declare Function PWIfrom_file Lib "ecncworddoc.dll" (ByVal hwnd As Long, ByVal filename As String, ByVal fmt As Long) As Long
Public Declare Function
PWI_stream_out Lib "ecncworddoc.dll" (ByVal hwnd As Long, ByVal fmt as long , st As String ) As Long
Public Declare Function
SavePWIFile Lib "ecncworddoc.dll" (ByVal hwnd As Long, ByVal path As String ) As Long

i.e.
y = PWIfrom_file(hwndInk, "Windows\Test.rtf", SF_RTF)  will load RTF file into richink window
y = PWIfrom_file(hwndInk, "Windows\Test.doc", SF_PWI)  will load PSW or PWI file into richink window
y = PWI_stream_out(hwndInk, SF_UTEXT, st)
y = SavePWIFile(hwndInk, "My documents\toexportfilename.pws") ' will return 1 on success otherwise 0


 

PocketPC
Download FREE ecncWordDoc.dll Win32 WCE ARM
Download FREE ecncWordDoc.dll Win32 WCE MIPS
Download FREE ecncWordDoc.dll Win32 WCE SH3
Download FREE ecncWordDoc.dll Win32 WCE x86EN
and copy the dll to the \windows dir on your pocket pc
Download complete ecncWordDoc project files
 
PocketPC 2002

Download FREE ecncWordDoc.dll Win32 WCE ARM
Download FREE ecncWordDoc.dll Win32 WCE x86
and copy the dll to the \windows dir on your pocket pc
Download complete ecncWordDoc project files

all toghether including evb files

ecncWordDoc  DLL has been tested on IPAQ PocketPC 3765 and works without any memory leak or problems

The ecncWordDoc.dll DLL is a shareware plug-in.
If you use  the ecncWordDoc.dll commercially please participate, in further development of the ecncWordDoc DLLs, sending $18.76 (eighteen dollars and 76 cents) to here. Sending a donation entitles you for any update or improvement that I will make for the ecncWordDoc.dll for FREE..

ecncWordDoc.dll contains all the functionality of the ecncrichink.dll

Get Text data from Pocket Word DOC (WORD-DOCUMENT must be opened in background)

Const WM_PASTE = &H302: Const EM_SETSEL = &HB1: Const WM_COPY = &H301: Const GW_CHILD = 5
Dim lret, y, lret2, lret3
'wordpocket handle
lret = FindWindow("Worker", "Pocket Word") ' first child window of the pocket word is InkX <-class name
lret2 = GetWindow(lret, GW_CHILD) 'first child window of the InkX is richink <-class name
lret3 = GetWindow(lret2, GW_CHILD)
If lret3 > 0 Then 'we got richink handle
Call SendMessage(lret3, EM_SETSEL, 0, -1)
'if the selection is not entirely contained in the first 64 KB, use the message EM_EXSETSEL=1079 'WM_USER + 55 'WM_USER=h400
Call SendMessage(lret3, WM_COPY, 0, 0)
y = SendMessageString(Text1.hwnd, WM_PASTE, 0, 0)
'why all this above? 'coz,FindWindowEx does not exisit for Pocket enviroment as of april '02
Function declaration:
Public Declare Function SendMessageString Lib "Coredll" Alias
"SendMessageW" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Public Declare Function SendMessage Lib "Coredll" Alias "SendMessageW"
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long
Declare Function
GetWindow Lib "Coredll" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Declare Function
FindWindow Lib "Coredll" Alias "FindWindowW" ( ByVal lpClassName As String, ByVal lpWindowName As String) As Long

IPaq_info.dll FREE! get info from Ipaq PocketPc Language,Manufacturer ...Serial Number...

GetIpaq info

o Get Language = 1 o Get Manufacturer = 2 o Get Model Identification = 3 o Get ROM Revision = 4 o Get Serial Number = 5
i.e. to get serial number  use  y = GetIpaqInfo(st, 5)

Take a look at next eVB example:
Public Declare Function GetIpaqInfo Lib "ipaq_info.dll" (stpo As String, ByVal op As Long) As Long
 
Dim st As Variant
Dim loc_st, y,i
loc_st = "": st = "test"
For i = 1 To 5
    y = GetIpaqInfo(st, i)
' return 0 if all is ok -1 otherwise
loc_st = loc_st + st + vbCrLf
Next
MsgBox loc_st
    

ecncShell starts/execute another application

I was playing with the CreateProcess API and it worked but it was a big chunk of the code for eVB so I decided to make it smaller
If we use CreateProcess and not release/close its handle after creating, eVB will crash (on exiting in my case). To find that handle required this


Public Declare Function
ecncShell Lib "ipaq_info.dll" (app As String, destdir As String) As Long
ret = ecncShell("\My Documents\mike\dic.vb","") 'start eVB program
ret = ecncShell("file://\My Documents\mike\test.htm","") ' start IExplorer with page
ret = ecncShell("\windows\fexplore.exe","")    'start fexplore in the current dir
ret = ecncShell("\windows\fexplore.exe", "\My Documents\mike\db\") 'start fexplore in specified directory
i.e. let start email application with few parameters:
ret = ecncShell("\windows\tmail.exe", "mailto:e-cnc@e-cnc.com?subject=Test from my eVB app&body=Attached file")
ecncShell will return 1 = success

ecncGetScrollRange to get scroll info for supplied window handle

Public Declare Function
ecncGetScrollRange Lib "ipaq_info.dll" ( ByVal hwnd as long, minpos as long, maxpos as long, pos as long, currentpos as long, pgsize as long  ) As Long
Dim
minpos, maxpos, pos, currentpos, pgsize, ret
ret = ecncGetScrollRange(hwndInk, minpos, maxpos, pos,currentpos,pgsize)
Text1.Text = CStr(minpos) + "<>" + CStr(maxpos) + "pos=" + CStr(pos) + CStr(currentpos) + CStr(pgsize)
ecncGetScrollRange will return 0 = success

ecncSetCompletion Function enable or disable automatic word completion

Public Declare Function ecncSetCompletion Lib "ipaq_info.dll" (ByVal hwnd As Long, ByVal yesno As Long, ByVal sipflag As Long) As Long
sipflag = ecncSetCompletion(Form1.hwnd, 1, 0) '2nd param 1=yes HIDE the Word completion
the Function will return old SIPflags so we can set it back to previous state
Call ecncSetCompletion(Form1.hwnd, 0, sipflag) '0=back/no
so sipflag should be set as a global variable

ecncSetLedStatus Function for handling IPAQ's LED(s)

Functions for handling LEDs
Public Declare Function ecncSetLedStatus Lib "ipaq_info.dll" (ByVal noleds As Long, ByVal status As Long) As Long
Call ecncSetLedStatus(0, 1) ' light up
Call ecncSetLedStatus(0, 2) ' green blink
Call ecncSetLedStatus(0, 0) ' off, to previous state before 0,1

ecncSReset Function to reset or turn off  IPAQ device

Public Declare Function ecncSReset Lib "ipaq_info.dll" (ByVal offyn as long) As Long
Call ecncSReset(0) ' soft reset
Call ecncSReset(1) ' device OFF

ecncRegHKeys sets wide HotKeys for the hardware buttons

Public Declare Function ecncRegHKeys Lib "ipaq_info.dll" (ByVal hwnd As Long, ByVal unreg As Long) As Long
- we have to Set the KeyPreview to TRUE on our main form and to register wide hotkey for the hardware buttons do next
Dim y:  y = ecncRegHKeys(Me.hwnd, 1) ' or yourformname.hwnd   return values: non zero success & zero=failure
- in Form Keyup event
MsgBox
" in keyup=" + CStr(KeyCode)
- or if we want to catch the cursor events (up, down, left, right) we have the same as the above in the Form_KeyDown event
MsgBox "in keydown=" + CStr(KeyCode)

- After we are done with an application, in the unload event of our main form we need to put next:
Dim y:  y= ecncRegHKeys(Me.hwnd, 0) ' to unregister hardware hotkeys   return value: -1 = success

csoon ecncBinaryCompress/Decompress

DOWNLOAD
Download ipaq_info.dll (7kb) FREE !
copy the dll to the \windows dir on your PocketPC
Download ipaq_info.dll (7kb) FREE !
copy the dll to the \windows dir on your PocketPC 2002

The above dll has been tested on IPAQ 36xx. ipaq_info does not work in the emulator mode 

have phun !

 SEARCH and SEARCH & REPLACE for CE = Mike's algorithm , blazing speed ... :) :) try it ! :)

  source for open file 1 and open file 2
 
Download FREE evbsearch.dll Win32 WCE ARM
Download FREE evbsearch.dll Win32 WCE MIPS
Download FREE evbsearch.dll Win32 WCE SH3
Download FREE evbsearch.dll Win32 WCE x86EN
and copy the dll to the \windows dir on your pocket pc
Download complete evbsearch project files

all toghether including evb files

evbsearch  DLL has been tested on IPAQ PocketPC 3765 and works without any memory leak or problems

Search trough the RTF text is coming soon (at least I am working on it)

The evbsearch.dll DLL is a shareware plug-in.
If you use  the evbsearch.dll commercially please participate, in further development of the evbSearch DLLs, sending $9.27 (nine dollars and 27 cents) to here.  Sending a donation entitles you for any update or improvement that I will make for the evbSearch.dll for FREE..

Insert a RTF file into the Richink control with eVB

RichInk, RTF, eVB, eVC RichText answers for CE environment

Many people asked the same question all over the WEB: Is it possible to do RICH text editing inside a Pocket PC as it is done in the desktop environment? Well, since I couldn't find any solution that was similar to the RichEdit, I decided to write my link to the existing CE ink capabilities, so below is my solution. Have phun :)
o
Create a Richink control in the eVB

Dim y As LongDim hwndInk as Long
y = LoadLibrary("\windows\richink.dll")
hwndInk = CreateWindowEx(WS_EX_TOPMOST Or 1, "richink", "my_richink", ES_MULTILINE Or WS_HSCROLL Or WS_VSCROLL Or WS_VISIBLE,
14, 25, 100, 100, 0, 0, 0, 0)
'|----------------| size of the richink window
Call
ShowWindow(hwndInk, 10)
Call UpdateWindow(hwndInk)

o Load RTF file with the ecncrichink.dll

Dim y As Long
y = RTFfrom_file(hwndInk, "Windows\Test.rtf")

 
 
Insert a RTF STRING into the Richink control with eVB

 Dim y As Long,  Dim LLength As Long ,  Dim rtf_demo_string As String
 rtf_demo_string = "{\rtf1\deftab720{\fonttbl{\f2\fswiss Tahoma;}}{\colortbl\red0\green0\blue0;  \red255\green0\blue0;\red0\green255\blue0;\red0\green0\blue255;\red0\green255\blue255;\red255\green255\blue0;}\deflang1033\plain\f2\fs17\cf1\b This \plain\f2\fs17\cf2 is \plain\f2\fs17\cf3 a \plain\f2\fs17\cf4\b test! \plain\f2\fs17\cf5\b\ul underline \plain\f2\fs17 \par }" rtf_demo_string2 = "{\rtf1\ansi \deff0{\fonttbl{\f0\fnil\fcharset0\fprq0 Tahoma;}{\f1\froman\fcharset2\fprq2 Bookdings;}{\f2\froman\fcharset2\fprq2 Symbol;}{\f3\fswiss\fcharset204\fprq2;}}{\colortbl;\red0\green0\blue0;\red128\green128\blue128;\red192\green192\blue192;
\red255\green255\blue255;\red255\green0\blue0;\red0\green255\blue0;\red0\green0\blue255;\red0\green255\blue255;\red255\green0\blue255;
\red255\green255\blue0;\red128\green0\blue0;\red0\green128\blue0;\red0\green0\blue128;\red0\green128\blue128;\red128\green0\blue128;\red128\green128\blue0;}\f0  \fs20 \f0 \cf6 \'54\'65\'73\'74\par \cf1 \cf5 \'4d\'69\'6a\'6f\par \cf1 \cf7 \'44\'65\'6c\'65\'74\par \cf1 \cf6 \'54\'65\'73\'74\par \cf1 \cf5 \'4d\'69\'6a\'6f\par \cf1 \cf7  \'44\'65\'6c\'65\'74\par \cf1 \par }”è$"

 LLength = CLng(LenB(rtf_demo_string) + 1)
 y = RTFfrom_string(hwndInk, rtf_demo_string, LLength)
 

Few people asked me how to do that rtf coloring and formatting so here is a bit better example:

rtf_prefix = "{\rtf1\deftab720{\fonttbl{\f2\fswiss Tahoma;}}{\colortbl\red0\green0\blue0; \red255\green0\blue0;\red0\green255\blue0;\red0\green0\blue255;\red0\green255\blue255;\red255\green255\blue0;}\deflang1033"
rtf_text_blue = "\plain\f2\fs24\cf3\b " ' bold blue
rtf_text_red = "\plain\f2\fs24\cf1 "
rtf_text_black = "\plain\f2\fs24\cf0 "
rtf_sufix = "\par }"
ST = ST + rtf_text_blue + myword_will_be_blue + rtf_text_red + myword_will_be_red   ...and so on..

rtf_string = rtf_prefix + ST + rtf_sufix
LLength = CLng(LenB(rtf_string) + 1)
y = RTFfrom_string(hwndInk, rtf_string, LLength)

few more things:
o create the richink window as WS_CHILD of Text1.hwnd so we won't have a problem with the ZOrder and so on...
hwndInk = CreateWindowEx(WS_EX_TOPMOST Or 1, "richink", "my_richink", WS_CHILD Or ES_MULTILINE Or WS_HSCROLL Or WS_VSCROLL Or WS_VISIBLE,14, 25, Text1.Width, Text1.Height, Text1.hwnd, 0, 0, 0)
o VBCrLf = chr(13)+chr(10) = "\par"
o any special character like "}" should be sent to the ecncrichink.dll as "\}" it is up to rtf specifications
 


module.bas
Download FREE ecncrichink.dll Win32 WCE ARM
Download FREE ecncrichink.dll Win32 WCE MIPS
   Download FREE ecncrichink.dll Win32 WCE SH3
Download FREE ecncrichink.dll Win32 WCE x86en
and copy the dll to the \windows dir on your pocket pc
Download complete evb project files

all toghether including evb files

ecncrichink  DLL has been tested on IPAQ PocketPC 3765 and works without any memory leak or problems
ecncrichink does not work in the emulator mode

The ecncrichink.dll RichInk DLL is a shareware plug-in.
If you use  the ecncrichink.dll commercially please participate, in further development of the RichInk DLLs, sending $7.83 (seven dollars and 83 cents) to here. Sending a donation entitles you for any update or improvement that I will make for the ecncrichink.dll for FREE..
 


RichText(RTF) specifications can be found at:
http://msdn.microsoft.com/library/specs/rtfspec.htm
http://www.dubois.ws/software/RTF/


 
CAD/CAM/C++/VB/FOXPRO programming & 3D Solid Design - no shapes make us wonder 

 If you'd like to contact me, I am available through my e-mail address. Therefore, if you are interested in anything above, just drop me an email for a job you need to be done: 
e-mail:



myspace analytics