Friday, February 29, 2008

Utilize your Pharos 140 GPS

If you like to have this launcher running on your Pharos 140 GPS :


Just simply download this aloha.exe to your Pharos 140 device, copy it to \MyFlashDisk\mplayer\ directory, rename the original mplayer.exe file to mplayer1.exe, and rename aloha.exe to mplayer.exe, so this new launcher program will appear each time you press the hard button Video Player on the left side of device (VideoPlayer Button is on the middle)

and If you like to goes further by editing the source and compiling it self by your own eVC program, here is the source :







// aloha.cpp : Quick and dirty program for Application Launcher..
//

#include "stdafx.h"
#include "aloha.h"
#include "commctrl.h"

#define MAX_LOADSTRING 100
#define WM_USER_MESSAGE WM_USER + 1

// Global Variables:
HINSTANCE hInst; // The current instance
HWND hwndCB; // The command bar handle


// Forward declarations of functions included in this code module:
ATOM MyRegisterClass (HINSTANCE, LPTSTR);
BOOL InitInstance (HINSTANCE, int);
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK About (HWND, UINT, WPARAM, LPARAM);

int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
MSG msg;
HACCEL hAccelTable;

// Perform application initialization:
if (!InitInstance (hInstance, nCmdShow))
{
return FALSE;
}




hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_HELLO);

// Main message loop:
while (GetMessage(&msg, NULL, 0, 0))
{
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}

return msg.wParam;
}

//
// FUNCTION: MyRegisterClass()
//
// PURPOSE: Registers the window class.
//
// COMMENTS:
//
// It is important to call this function so that the application
// will get 'well formed' small icons associated with it.
//
ATOM MyRegisterClass(HINSTANCE hInstance, LPTSTR szWindowClass)
{
WNDCLASS wc;

wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC) WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_HELLO));
wc.hCursor = 0;
wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = 0;
wc.lpszClassName = szWindowClass;

return RegisterClass(&wc);
}

//
// FUNCTION: InitInstance(HANDLE, int)
//
// PURPOSE: Saves instance handle and creates main window
//
// COMMENTS:
//
// In this function, we save the instance handle in a global variable and
// create and display the main program window.
//


BOOL IsAppRunning()
{
HANDLE hMutex = NULL;

hMutex = CreateMutex ( NULL, TRUE, _T("AlohaProgramMutex") );
if ( GetLastError() == ERROR_ALREADY_EXISTS )
{
CloseHandle ( hMutex );
return TRUE;
}
return FALSE;
}

BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hWnd;
TCHAR szTitle[MAX_LOADSTRING]; // The title bar text
TCHAR szWindowClass[MAX_LOADSTRING]; // The window class name


hInst = hInstance; // Store instance handle in our global variable
// Initialize global strings
LoadString(hInstance, IDC_HELLO, szWindowClass, MAX_LOADSTRING);
MyRegisterClass(hInstance, szWindowClass);

HWND hPrevWnd = FindWindow(szWindowClass,NULL);

if(hPrevWnd)
{
// BringWindowToTop(hPrevWnd);
SetForegroundWindow(hPrevWnd);
return FALSE;
}


// if (IsAppRunning()) return FALSE;


LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
hWnd = CreateWindow(szWindowClass, szTitle, WS_VISIBLE,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);


DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);

if (!hWnd)
{
return FALSE;
}

ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
if (hwndCB)
CommandBar_Show(hwndCB, TRUE);

return TRUE;
}

//
// FUNCTION: WndProc(HWND, unsigned, WORD, LONG)
//
// PURPOSE: Processes messages for the main window.
//
// WM_COMMAND - process the application menu
// WM_PAINT - Paint the main window
// WM_DESTROY - post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
int wmId, wmEvent;
PAINTSTRUCT ps;
TCHAR szHello[MAX_LOADSTRING];


switch (message)
{

case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDM_HELP_ABOUT:
DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
break;
case IDM_FILE_EXIT:
DestroyWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
case WM_CREATE:
hwndCB = CommandBar_Create(hInst, hWnd, 1);
CommandBar_InsertMenubar(hwndCB, hInst, IDM_MENU, 0);
CommandBar_AddAdornments(hwndCB, 0, 0);
break;
case WM_PAINT:
RECT rt;
hdc = BeginPaint(hWnd, &ps);
GetClientRect(hWnd, &rt);
LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING);
DrawText(hdc, szHello, _tcslen(szHello), &rt,
DT_SINGLELINE | DT_VCENTER | DT_CENTER);
EndPaint(hWnd, &ps);
break;
case WM_DESTROY:
CommandBar_Destroy(hwndCB);
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}

// Mesage handler for the About box.
LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
RECT rt, rt1;
int DlgWidth, DlgHeight; // dialog width and height in pixel units
int NewPosX, NewPosY;
int wmId, wmEvent;

SHELLEXECUTEINFO info;
info.cbSize = sizeof(info);
info.fMask = SEE_MASK_FLAG_NO_UI;
info.hwnd = NULL;
info.lpVerb =_T("open");
info.lpFile =_T("\\windows\\explorer.exe");
info.lpParameters =_T("");
info.lpDirectory =_T("");
info.nShow = SW_SHOW;

switch (message)
{
switch (message)
{
switch (message)
{
case WM_INITDIALOG:
// trying to center the About dialog
if (GetWindowRect(hDlg, &rt1)) {
GetClientRect(GetParent(hDlg), &rt);
DlgWidth = rt1.right - rt1.left;
DlgHeight = rt1.bottom - rt1.top ;
NewPosX = (rt.right - rt.left - DlgWidth)/2;
NewPosY = (rt.bottom - rt.top - DlgHeight)/2;

// if the About box is larger than the physical screen
if (NewPosX < 0) NewPosX = 0;
if (NewPosY < 0) NewPosY = 0;
SetWindowPos(hDlg, 0, NewPosX, NewPosY,
0, 0, SWP_NOZORDER | SWP_NOSIZE);
}
return TRUE;

case WM_COMMAND:
if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL))
{
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDC_EXPLORER:
info.lpFile =_T("\\windows\\explorer.exe");
ShellExecuteEx(&info);
break;
case IDC_OZI:
info.lpFile =_T("\\myflashdisk\\oziexplorer\\oziexplorerce.exe");
ShellExecuteEx(&info);
break;
case IDC_VIDEO:
info.lpFile =_T("\\myflashdisk\\mplayer\\mplayer1.exe");
ShellExecuteEx(&info);
break;
case IDC_ACROBAT:
info.lpFile =_T("\\myflashdisk\\gpsapp\\adobe 2.0\\acrobat 2.0\\reader\\acrord32.exe");
ShellExecuteEx(&info);
break;
case IDC_RESCO:
info.lpFile =_T("\\myflashdisk\\mplayer\\resco.exe");
ShellExecuteEx(&info);
break;
case IDC_EXIT:
CommandBar_Destroy(hwndCB);
PostQuitMessage(0);
break;
}
break;
}
return FALSE;
}



or if you indeed too lazy to type that, here is the complete project :-) .. download it from www.infoanda.com and look this site for other explanation.

11 comments:

Anonymous said...

Looks like my 140 does not have the MPlayer directory, nor can I find the application anywhere via an Active Sync search. Any Ideas?

Thanks,

Denis

Anonymous said...

Neat. Thanks.
any ideas around how to install tomtom 7 with maps 7.x or upgrading WinCE to 6+

Anonymous said...

I want to run Memory map from your launcher, the web site is www.memory-map.com, can you help me?

arpol said...

to Anonymous,

I can try to recompile again and make the button configurable, so you can change which application you wish to launch using this launcher, give me a week.

Anonymous said...

Did you re-compile to allow Memory Map to launch?

Anonymous said...

What program did you used to compile the source codes?

Anonymous said...

That source code can be compiled using Microsoft embeded Visual C, eVC 4.0.
Its very straight forward, download that source code in zip files, extract it to project directory, and compiled it.

Anonymous said...

Utems,
I do not have the knowledge to write or compile programs for CE, but you said "I can try to recompile again and make the button configurable, so you can change which application you wish to launch using this launcher, give me a week." Did you do that yet?

arpol said...

I am sorry, too much thing at work right now, I am not even touch my personal laptop for last 1.5 months, anyway for interim solution before I get a chance to compile it again, as it says on the source code, once of the launcher has its .exe file under this directory : "\\myflashdisk\\oziexplorer\\oziexplorerce.exe"
can you just rename your "memory map" to have that name under that directory ?,
if you can't just inform me what is your complete path to execute that application ? I will recompile it for you.

Anonymous said...

Utems,
thank you for your response. I have tried that but the message "Oziexplorer or one of its components is missing" appears.

Anonymous said...

about that "component is missing" error, make sure you copy the related .dll files as well in the same direcory, I use this launcher to make my GPS run zip extractor from resco, it wasnt run until I put the additional dll file that come with that zip extractor to the same directory. Hope this trick will work for you.

current

last archive