need some coding help...if possible?! - Windows Mobile Development and Hacking General

hi all !
I have a little problem..first i am not a very good coder..and second I have a feature that i would like to solve...
from a winmob 5.0 smartphone or pocketpc I would like to set a couple of registry settings.
But I cant figure out how to do it...
What I need is to set a device name in a spcific place in the registry...from the device itself,some kind of gui..the guipart and the rest of the app I have but its the regentry thing that I cant figure out...
first I thought that I could take an xml file and run it frm the program but then I thougnt about a little and what I need is a regentry instead...
I am running the latest .net visual studio 2005
anyone have any tips for me??

Writing to the registry is not that hard, it is done like this in C
HKEY hKey;
DWORD RegKeyDisp, RegKeyType, RegKeySize, dwTemp;
USHORT RegRead;
//Create the registry Key if it don't exist
if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
TEXT("Software\\Sample\\Test1\\Test2"),
0, NULL, 0,0, NULL, &hKey, &RegKeyDisp) == ERROR_SUCCESS)
{
RegCloseKey(hKey);
}
//Read (Query) the value from the registry
if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
TEXT("Software\\Sample\\Test1\\Settings"),
0, NULL, 0,0, NULL, &hKey, &RegKeyDisp) == ERROR_SUCCESS)
{
//Get the Value in 'Read This Key'
RegKeyType = REG_DWORD;
RegKeySize = sizeof(DWORD);
RegQueryValueEx(hKey, TEXT("Read This Key"), NULL, &RegKeyType,
(PBYTE)&RegRead, &RegKeySize);
RegCloseKey(hKey);
}
//Write a value to the registry
dwTemp = 42; //Value to be stored in the registry
RegKeyType = REG_DWORD;
RegKeySize = sizeof(DWORD);
if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
TEXT("Software\\Sample\\Test1\\Test2"),
0, NULL, 0,0, NULL, &hKey, &RegKeyDisp) == ERROR_SUCCESS)
{
RegSetValueEx(hKey, TEXT("WriteKey"),
0, RegKeyType,
(PBYTE)&dwTemp,
RegKeySize);
RegCloseKey(hKey);
}
This has all been cut and chopped out of a working program I have written - I can not guarantee I have made a mistake in choping out irrelevent information - but I hope it makes sense.
If you are not writing in C then I am sure you could declare them or wrap them up with P/Invoke.

nice !
thx alot for a very fast answer!
I will give it a go as soon I get home!!

ok that looked ok...but it turned out that I need to put something in the registry via XML afterall...
is there a way todo that??
take a value(in this case a userid/password) and put it in cm_vpnentries ??
Reading the sdk it want to do it through rapi or cpf file only...

Related

how to do a TAPI call

Hi
I want to make a call with my mda without using the RAS dialer. Direct access to the COM-ports does not work, as described in the document "Serial Communications". But that documents mentions that TAPI calls are possible with an xda.
It says:
"If you´ve establised a call, TAPI returns a handle for further data-i/o..."
Is there an example how to make a call using TAPI especially how to get that data-handle. And furthermore can I use that handle with WriteFile / ReadFile as I would use a handle to a COM-Port?
I did this for a terminal emulator I wrote. I pass a string to these functions which is COM1: for serial, TAPI for modem or RAS for TCPIP RAS.
I have simply copied some of my code here, work through it as if lpszPortName = "TAPI" and you should make sense of it. Once you have the port handle hPort which is returned by the Connected response of the TAPI call back function, then you can read and write as if that were a serial/file handle.
Cheers
Paul
#include <windows.h>
#include <string.h>
#include <tapi.h>
#include "toolbox.h"
//Initilise the port either the TAPI or COMM port as requested by lpszPortName
BOOL PortInitialize (LPTSTR lpszPortName)
{
DWORD dwError;
BOOL RetValue;
HKEY hKey;
DWORD RegKeyDisp, RegKeyType, RegKeySize;
DWORD dwTapiNumDevs;
LONG lTapiReturn;
char PrintString[80];
TCHAR TempString[20];
char CharString[20];
LINEDEVCAPS TapiLineDevCaps;
static DWORD dwLocalAPIVersion;
LINEEXTENSIONID LineExtensionID;
LINECALLPARAMS LineCallParams;
static DWORD ChoosenDevice;
TCHAR DialNumber[30];
#ifdef _WIN32_WCE_EMULATION
if (wcscmp(lpszPortName, TEXT("TAPI")) != 0)
return TRUE; //If running under emulator then unable to emulate
#endif //the serial port, so in this 'test' mode just echo.
if (COMMPORTSHUT == TRUE) //If this is True then we are shutting down the program
return TRUE; //So don't try to re-open port as it gets stuck in an infinate loop
if (wcscmp(lpszPortName, TEXT("TAPI")) == 0)
{
#ifdef DEBUGVERSION
VTPrint("Entering (TAPI)PortInitilize\r\n" , 0);
#endif
//Retrive the telephone number from the registry
// Fill in the Modem Telephone number
wcscpy(DialNumber, TEXT("T"));
if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
TEXT("Software\\PVG\\Terminal\\Settings"),
0, NULL, 0,0, NULL, &hKey, &RegKeyDisp) == ERROR_SUCCESS)
{
//Retrive the telephone number
RegKeyType = REG_SZ;
RegKeySize = sizeof(DialNumber);
RegQueryValueEx(hKey, TEXT("Telephone"),
NULL, &RegKeyType,
(PBYTE)DialNumber + sizeof(TCHAR),
&RegKeySize);
RegCloseKey(hKey);
}
//Confirm there is a telephone number
if (*(DialNumber + 1) == 0)
{
VTPrint("No Telephone Number\r\n", 0);
return FALSE;
}
// Use TAPI to open a DATAMODEM communication channel
if (ghLineApp == NULL)
{
#ifdef DEBUGVERSION
VTPrint("Tapi - LineInitialise\r\n",0);
#endif
memset(&TapiLineDevCaps, 0, sizeof(TapiLineDevCaps));
lTapiReturn = lineInitialize(&ghLineApp, hInst, TapiCallBackFunction, NULL, &dwTapiNumDevs);
if (lTapiReturn)
{
wsprintf (TempString,TEXT("%d"), lTapiReturn);
WideCharToMultiByte(CP_ACP, 0, TempString, -1, CharString, 20, NULL, NULL);
VTPrint("TAPI failed to initialise\n\rError Code = ",0);
VTPrint(CharString, 0);
VTPrint("\n\r",0);
TAPIShutdown();
return FALSE;
}
//Loop through devices to find one that can do data at 9600 baud (GSM)
for (ChoosenDevice=0 ; ChoosenDevice < dwTapiNumDevs ; ChoosenDevice++)
{
TapiLineDevCaps.dwTotalSize = sizeof(TapiLineDevCaps);
//Ask for at least TAPI Version 1.4
lTapiReturn = lineNegotiateAPIVersion(ghLineApp, ChoosenDevice, 0x00010004,
0x00010004, &dwLocalAPIVersion, &LineExtensionID);
#ifdef DEBUGVERSION
if (lTapiReturn)
{
wsprintf (TempString,TEXT("%d"), lTapiReturn);
WideCharToMultiByte(CP_ACP, 0, TempString, -1, CharString, 20, NULL, NULL);
VTPrint("TAPI failed to negotiate API Version\n\rError Code = ",0);
VTPrint(CharString, 0);
VTPrint("\n\r",0);
}
#endif
if (!(lTapiReturn))
{
lTapiReturn=lineGetDevCaps(ghLineApp, ChoosenDevice, dwLocalAPIVersion, 0, &TapiLineDevCaps);
#ifdef DEBUGVERSION
if (lTapiReturn)
{
wsprintf (TempString,TEXT("%d"), lTapiReturn);
WideCharToMultiByte(CP_ACP, 0, TempString, -1, CharString, 20, NULL, NULL);
VTPrint("TAPI failed to get device capibility\n\rError Code = ",0);
VTPrint(CharString, 0);
VTPrint("\n\r",0);
}
else
#endif
#ifndef DEBUGVERSION
if (!(lTapiReturn))
#endif
{
if ((TapiLineDevCaps.dwBearerModes & LINEBEARERMODE_VOICE) &&
(TapiLineDevCaps.dwMaxRate >= 9600) &&
(TapiLineDevCaps.dwMediaModes & LINEMEDIAMODE_DATAMODEM))
break;
}
}
}
if (!((TapiLineDevCaps.dwBearerModes & LINEBEARERMODE_VOICE) ||
(TapiLineDevCaps.dwMaxRate >= 9600) ||
(TapiLineDevCaps.dwMediaModes & LINEMEDIAMODE_DATAMODEM)))
{
VTPrint("Unable to find a modem device\r\n", 0);
TAPIShutdown();
lineShutdown(ghLineApp);
ghLineApp = NULL;
return FALSE;
}
//Now we have found a device capable of a dial up modem
strcpy(PrintString, "TAPI Initilised (");
wsprintf (TempString,TEXT("%d"), ChoosenDevice);
WideCharToMultiByte(CP_ACP, 0, TempString, -1, CharString, 20, NULL, NULL);
strcat(PrintString, CharString);
strcat(PrintString, "/");
wsprintf (TempString,TEXT("%d"), dwTapiNumDevs);
WideCharToMultiByte(CP_ACP, 0, TempString, -1, CharString, 3, NULL, NULL);
strcat(PrintString, CharString);
strcat(PrintString, ")\n\r");
VTPrint(PrintString, 0);
}
//Open the TAPI line device
if (ghLine == NULL)
{
#ifdef DEBUGVERSION
VTPrint("TAPI - Obtaining line handle\r\n", 0);
#endif
lTapiReturn = lineOpen(ghLineApp, ChoosenDevice, &ghLine, dwLocalAPIVersion, 0 , 0,
LINECALLPRIVILEGE_NONE, LINEMEDIAMODE_DATAMODEM, 0);
if (lTapiReturn)
{
wsprintf (TempString,TEXT("%d"), lTapiReturn);
WideCharToMultiByte(CP_ACP, 0, TempString, -1, CharString, 20, NULL, NULL);
VTPrint("TAPI failed to Open Line\n\rError Code = ",0);
VTPrint(CharString, 0);
VTPrint("\n\r",0);
TAPIShutdown();
return FALSE;
}
//Request specific notification messages
lTapiReturn = lineSetStatusMessages(ghLine, LINEDEVSTATE_RINGING | LINEDEVSTATE_CONNECTED |
LINEDEVSTATE_DISCONNECTED | LINEDEVSTATE_OUTOFSERVICE |
LINEDEVSTATE_MAINTENANCE | LINEDEVSTATE_CLOSE |
LINEDEVSTATE_REINIT, LINEADDRESSSTATE_OTHER);
if (lTapiReturn)
{
wsprintf (TempString,TEXT("%d"), lTapiReturn);
WideCharToMultiByte(CP_ACP, 0, TempString, -1, CharString, 20, NULL, NULL);
VTPrint("TAPI failed to Set Status Messages\n\rError Code = ",0);
VTPrint(CharString, 0);
VTPrint("\n\r",0);
TAPIShutdown();
return FALSE;
}
//Configure line device for a data modem
memset(&LineCallParams, 0, sizeof(LineCallParams));
LineCallParams.dwTotalSize = sizeof(LineCallParams);
LineCallParams.dwBearerMode = LINEBEARERMODE_VOICE;
LineCallParams.dwMediaMode = LINEMEDIAMODE_DATAMODEM;
//Expect the line to start out idle (we don't want to break into a current call)
LineCallParams.dwCallParamFlags = LINECALLPARAMFLAGS_IDLE;
//If multiple addresses on the line, use the first address
LineCallParams.dwAddressMode = LINEADDRESSMODE_ADDRESSID;
LineCallParams.dwAddressID = 0;
}
//Make the call
if (ghCall == NULL)
{
#ifdef DEBUGVERSION
VTPrint("TAPI Making the call\r\n", 0);
#endif
lTapiReturn = lineMakeCall(ghLine, &ghCall, DialNumber, 0, &LineCallParams);
if (lTapiReturn < 0)
{
wsprintf (TempString,TEXT("%d"), lTapiReturn);
WideCharToMultiByte(CP_ACP, 0, TempString, -1, CharString, 20, NULL, NULL);
VTPrint("TAPI failed to Make the Call\n\rError Code = ",0);
VTPrint(CharString, 0);
VTPrint("\n\r",0);
TAPIShutdown();
ghCall = NULL;
return FALSE;
}
}
VTPrint("Call Initiated\r\n",0);
return TRUE;
}
if (wcscmp(lpszPortName, TEXT("RAS")) != 0)
{
{
// Open the serial port.
hPort = CreateFile (lpszPortName, // Pointer to the name of the port
GENERIC_READ | GENERIC_WRITE,
// Access (read-write) mode
0, // Share mode
NULL, // Pointer to the security attribute
OPEN_EXISTING,// How to open the serial port
0, // Port attributes
NULL); // Handle to port with attribute
// to copy
// If it fails to open the port, return FALSE.
if ( hPort == INVALID_HANDLE_VALUE )
{
// Could not open the port.
COMMPORTSHUT=TRUE;
MessageBox (hMainWnd, TEXT("Unable to open the port"),
TEXT("Error"), MB_OK);
dwError = GetLastError ();
return FALSE;
}
}
RetValue=InitiliseCommHandle();
return RetValue;
}
return TRUE;
}
//Initilise the communication handle, this occurs once a communication channel has been
//opened, either direct to a serial port or via TAPI
BOOL InitiliseCommHandle(void)
{
DWORD dwError,
dwThreadID;
DCB PortDCB;
COMMTIMEOUTS CommTimeouts;
#ifdef DEBUGVERSION
char SendString[40];
sprintf(SendString, "Handle = %d\r\n", hPort);
VTPrint(SendString,0);
#endif
// Get the default port setting information.
PortDCB.DCBlength = sizeof (DCB);
GetCommState (hPort, &PortDCB);
// Change the DCB structure settings.
if (wcscmp(COMMPORTNAME, TEXT("TAPI")) == 0)
{
//TAPI (modem) Settings
PortDCB.BaudRate = 19200; // Current baud
PortDCB.ByteSize = 8; // Number of bits/byte, 4-8
PortDCB.Parity = NOPARITY; // Parity odd,even,mark,space
}
else
{
//Standard Serial Port Settings
PortDCB.BaudRate = 1200; // Current baud
PortDCB.ByteSize = 7; // Number of bits/byte, 4-8
PortDCB.Parity = EVENPARITY; // Parity odd,even,mark,space
}
PortDCB.fBinary = TRUE; // Binary mode; no EOF check
PortDCB.fParity = TRUE; // Enable parity checking
PortDCB.fOutxCtsFlow = FALSE; // CTS output flow control
PortDCB.fRtsControl = RTS_CONTROL_HANDSHAKE;
PortDCB.fOutxDsrFlow = FALSE; // No DSR output flow control
PortDCB.fDtrControl = DTR_CONTROL_ENABLE; //DTR output ON
PortDCB.fDsrSensitivity = FALSE; // DSR sensitivity
PortDCB.fTXContinueOnXoff = TRUE; // XOFF continues Tx
PortDCB.fOutX = FALSE; // No XON/XOFF out flow control
PortDCB.fInX = FALSE; // No XON/XOFF in flow control
PortDCB.fErrorChar = FALSE; // Disable error replacement
PortDCB.fNull = FALSE; // Disable null stripping
PortDCB.fAbortOnError = FALSE; // Do not abort reads/writes on
// error
PortDCB.StopBits = ONESTOPBIT; // 0,1,2 = 1, 1.5, 2
// Configure the port according to the specifications of the DCB
// structure.
if (!SetCommState (hPort, &PortDCB))
{
MessageBox (hMainWnd, TEXT("Unable to configure the port"),
TEXT("Error"), MB_OK);
dwError = GetLastError ();
return FALSE;
}
// Retrieve the time-out parameters for all read and write operations
// on the port.
GetCommTimeouts (hPort, &CommTimeouts);
// Change the COMMTIMEOUTS structure settings.
CommTimeouts.ReadIntervalTimeout = MAXDWORD;
CommTimeouts.ReadTotalTimeoutMultiplier = 0;
CommTimeouts.ReadTotalTimeoutConstant = 0;
CommTimeouts.WriteTotalTimeoutMultiplier = 20;
CommTimeouts.WriteTotalTimeoutConstant = 1000;
// Set the time-out parameters for all read and write operations
// on the port.
if (!SetCommTimeouts (hPort, &CommTimeouts))
{
// Could set the timeouts.
MessageBox (hMainWnd, TEXT("Unable to set the port time-out parameters"),
TEXT("Error"), MB_OK);
dwError = GetLastError ();
return FALSE;
}
if (wcscmp(COMMPORTNAME, TEXT("TAPI")) != 0)
{
// Direct the port to perform extended functions SETDTR and SETRTS
// SETDTR: Sends the DTR (data-terminal-ready) signal.
// SETRTS: Sends the RTS (request-to-send) signal.
// EscapeCommFunction (hPort, SETDTR);
// EscapeCommFunction (hPort, SETRTS);
//Use the Swap Comms routine to set the serial port to the last open state
//This is a little messy to set the port first of all and then change some
//of the settings here
SwapComms(CurrentController);
}
// Create a read thread for reading data from the communication port.
if (hReadThread = CreateThread (NULL, 0, PortReadThread, 0, 0,
&dwThreadID))
{
CloseHandle (hReadThread);
}
else
{
// Could not create the read thread.
MessageBox (hMainWnd, TEXT("Unable to create the read thread"),
TEXT("Error"), MB_OK);
dwError = GetLastError ();
return FALSE;
}
return TRUE;
}
//TAPI sends status messages to this function.
void CALLBACK TapiCallBackFunction(DWORD dwdevice, DWORD dwMsg, DWORD dwCallbackInstance,
DWORD dwParam1, DWORD dwParam2, DWORD dwParam3)
{
DWORD lTapiReturn, dwStructSize;
VARSTRING *pvs, *pvsOld;
#ifdef DEBUGVERSION
char SendString[40];
#endif
pvs = NULL;
dwStructSize = sizeof (VARSTRING);
switch(dwMsg)
{
case LINE_CALLSTATE:
switch(dwParam1)
{
case LINECALLSTATE_IDLE:
if (hPort != INVALID_HANDLE_VALUE)
{
VTPrint("Line Idle\n\r",0);
//Change MENU back to COMM mode
ControllerMenu(TRUE);
//Shutdown TAPI
hPort = INVALID_HANDLE_VALUE;
lineDeallocateCall(ghCall);
ghCall = NULL;
ghLine = NULL;
}
break;
case LINECALLSTATE_CONNECTED:
//If a handle is already present then don't re-open
//This needs doing as multiple connected events can occur on connection
if (hPort != INVALID_HANDLE_VALUE)
break;
//Spin round loop till the structure is big enough
do
{ pvsOld = pvs;
if (NULL == (pvs = realloc (pvs, dwStructSize)))
break;
pvs->dwTotalSize = dwStructSize;
if (lTapiReturn = lineGetID (NULL, 0, ghCall, LINECALLSELECT_CALL,
pvs, TEXT("comm/datamodem")))
break;
}
while ((dwStructSize = pvs->dwNeededSize) > pvs->dwTotalSize) ;
if (pvs == NULL)
{
if (pvsOld)
free (pvsOld);
VTPrint("Failed to allocate port handle memory\n\r", 0);
TAPIShutdown();
break;
}
if (lTapiReturn)
{
free(pvs);
VTPrint("Failed to obtain port handle\n\r", 0);
TAPIShutdown();
break;
}
hPort = * (HANDLE*) ((char*) pvs + pvs->dwStringOffset);
free(pvs);
//Change Menu to Modem Mode
ControllerMenu(FALSE);
VTPrint("Connected\n\r", 0);
InitiliseCommHandle();
break;
case LINECALLSTATE_DIALING:
//VTPrint("Dialling\n\r", 0);
break;
case LINECALLSTATE_PROCEEDING:
//VTPrint("Waiting for an answer\n\r", 0);
break;
case LINECALLSTATE_DISCONNECTED:
ControllerMenu(TRUE);
//Change Menu to COMM mode
switch (dwParam2)
{
case LINEDISCONNECTMODE_UNREACHABLE:
VTPrint("Unreachable\r\n",0);
hPort = INVALID_HANDLE_VALUE;
break;
case LINEDISCONNECTMODE_BUSY:
VTPrint("Line Busy\n\r", 0);
break;
}
TAPIShutdown();
}
break;
default:
break;
}
}
[/code]
BOOL TAPIShutdown()
//Do the TAPI Shutdown Process
{
static bShuttingDown = FALSE;
//If we are not initilised then Shutdown unnecessary
if (ghLineApp == NULL)
return TRUE;
//Prevent Shutdown re-entrancy problems
if (bShuttingDown)
return TRUE;
bShuttingDown=TRUE;
if (ghCall != NULL)
lineDrop(ghCall, NULL, 0);
bShuttingDown = FALSE;
return TRUE;
}
Thanks for code posted. It is very helpful.
But I don't quite understand the logic how the "hPort" is created when receiveing a "CONNECTED" message callback.
Can you explain a little bit more?
- David
The handle to the port (hPort) is contained at the end of a variable length string (VARSTRING) that is returned from the call to LineGetID.
The fiddly thing about it is you give LineGetID a pointer to a VARSTRING called pvs and you have to fill in one of the member variables of pvs with the size allocated ( pvs->dwTotalSize ) to the variable length string.
Since I don't know how much to allocate to the VARSTRING, initially I just allocate enough memory from a sizeof(VARSTRING) result. Maybe you could just allocate a set size and not bother with the looping back, I think it is better to ask the system how much memory it wants as LineGetID may need more memory in later versions of the operating system.
Then you pass the VARSTRING with it's size stored in dwTotalSize to the function LineGetID.
The LineGetID function then fills in dwNeededSize with the size of the VARSTRING it needed to complete. That is why I loop back and re-allocate the VARSTRING to a new (bigger) size if NeededSize is greater than TotalSize.
Once the LineGetID function succeeds with a big enough VARSTRING then the Port Handle is at the end of the VARSTRING, as it is a variable length string you have to do maths to say the Port Handle is at the Address of the string PLUS the offset to the actural data wanted i.e. pvs + pvs->dwStringOffset The maths must be done with char* byte sizes and the final result is a handle, hence the casting HANDLE* on the final result.
Once the Port Handle is stored in hPort, the memory allocated to pvs is freed.
One other thing I noticed is that you can get multiple CONNECTED events, that is why I just exit the CONNECTED event if there is already a valid handle
I hope that makes sense.
Cheers
Paul
Do you have sample for the answering part?
thanks,
- David
No, sorry I have only ever written programs to dial out.
Hi,
I tried the sample code posted in this thread. It works only if I used
LineCallParams.dwBearerMode = LINEBEARERMODE_VOICE;
LineCallParams.dwMediaMode = LINEMEDIAMODE_INTERACTIVEVOICE;
combination. I got the RING message. However, the original:
LineCallParams.dwBearerMode = LINEBEARERMODE_VOICE;
LineCallParams.dwMediaMode = LINEMEDIAMODE_DATAMODEM;
didn't seem to work.
Do I miss something? (I think I have successfully killed the cprog.exe already)
Thanks,
- David
That means you are making a voice call.
So is the problem that you can not make a data(modem) type call ?
Check that you have data enabled on your SIM and also that under Settings -> Connections -> CSD Line Type it is set correctly. In the UK it is 9600 bps(v.32) and Non-tranparent, but I was told it is v110 is the states.
Let me know how you get on.
Is there any chance that somebody could compile this TAPI code as an object I could consume in C#? I have tried, but I am not even able to compile the example in C++... it's just not my world!
I would be eternally gratefull - and I bet a whole bunch of other guys who just want to quickly establish a data connection over GSM from C# (or VB?) would be also! It should have been in the phone.dll if you ask me!
compiled sample
Hey could somebody compile the tapi code for me in eVc++ or MFC ?? because i am really struggling. Plus what is toolbox.h i dont seem to have it ?? can somebody please help ??
thanks guys
This is an old post of mine, don't worry about Toolbox.h that was for the program I was writing and it has nothing to do with Tapi.
This sample code was not meant to compile, after you you won't have function VTPrint but I hope you can guess that just shows text. It was just posted to demonstate the order of functions needed to get a modem connection.
I built all this Tapi code into a DLL and I have it all presented with the eVC 3.0 build files in this post, this code will compile as presented and is just a zip of all the project files of a single sample application.
http://forum.xda-developers.com/viewtopic.php?t=18978
Have a look there.
Cheers
Paul
during a data call when using TAPI can u make some kind of AT command request ??? and retrieve the data from that answer ??? And do i need some TAPI app on the remote unit to send the data back ?
i am trying to access a remote unit ( GPS RX and GSM TX )
I don't really understand your question that well.
But AT commands have nothing to do with TAPI, so any question saying can TAPI send an AT command for etc -- The answer must be no.
All TAPI does is gives a Handle that can be used with ReadFile and WriteFile for receiving and sending data over the modem.
So TAPI will dial a number and establish a DataModem connection, then on Connect it can provide the handle for you to direct read/write requests to. Once the link is established you just treat the handle as if it was a file handle returned from a CreateFile command.
As said earlier all this has nothing to do with AT commands.
During a data call should ic onnect via COM 1 or COM 9 if i'm using TAPI ?? Would you have any sample code i could have a look at ? I'm a bit lost at the moment .... with LineGetID too ...
you can't use COM2 or COM9 via TAPI cause COM2 and COM9 masked by RIL
about lineGetID look http://forum.xda-developers.com/viewtopic.php?t=9761
ok thanks - so if i cant use COM1 or COM9 in this case then i'm guessing that i shall pass a string (lpszPortName) just like the example on this post.
Code:
// Open the serial port.
hPort = CreateFile (lpszPortName, // Pointer to the name of the port
GENERIC_READ | GENERIC_WRITE,
// Access (read-write) mode
0, // Share mode
NULL, // Pointer to the security attribute
OPEN_EXISTING,// How to open the serial port
0, // Port attributes
NULL); // Handle to port with attribute
// to copy
But what should the string lpszPortName be initialized to ? Or am i totally wrong ?[/quote]
L"COM9:" for COM9
but not with TAPI
with TAPI you have not open any COM-ports
you must use lineGetID
Code:
//PART 7 - TIMEOUT AND DCB SETTINGS
PortDCB.BaudRate = 115200;
PortDCB.fBinary = TRUE;
PortDCB.fParity = FALSE;
PortDCB.fOutxCtsFlow = FALSE;
PortDCB.fOutxDsrFlow = FALSE;
PortDCB.fDtrControl = DTR_CONTROL_ENABLE;
PortDCB.fDsrSensitivity = FALSE;
PortDCB.fTXContinueOnXoff = FALSE;
PortDCB.fOutX = FALSE;
PortDCB.fInX = FALSE;
PortDCB.fErrorChar = FALSE;
PortDCB.fNull = FALSE;
PortDCB.fRtsControl = RTS_CONTROL_DISABLE;
PortDCB.fAbortOnError = FALSE;
PortDCB.ByteSize = 8;
PortDCB.Parity = NOPARITY;
PortDCB.StopBits = ONESTOPBIT;
if (!SetCommState (hPort, &PortDCB))
{
MessageBox (_T("unable to configure com port "));
return FALSE;
}
GetCommTimeouts (hPort, &CommTimeouts);
CommTimeouts.ReadIntervalTimeout = MAXDWORD;
CommTimeouts.ReadTotalTimeoutMultiplier = 0;
CommTimeouts.ReadTotalTimeoutConstant = 0;
CommTimeouts.WriteTotalTimeoutMultiplier = 20;
CommTimeouts.WriteTotalTimeoutConstant = 1000;
if (!SetCommTimeouts (hPort, &CommTimeouts))
{
MessageBox (_T("unable to set comport parameters"));
return FALSE;
}
Are the COM and Timeout settings necessary when using TAPI ? because i am getting an error message at the !setCommState function.
I use lineGetID to retrieve the Handle to the Comm then i try to use readFile but the operation is unsuccesful.
Anyhelp from out there ? thanks.
Are you sure that you call lineGetID only after connection?
Maybe you are right. I just do lineMakeCall then do lineGetId without waiting for a LINECALLSTATE_CONNECTED message.
I think its because i have troubles implementing the lineCallBackFunc() i dont understand the parameters that need to be passed to it.
Code:
void CALLBACK lineCallbackFunc(
DWORD dwDevice, DWORD dwMsg, DWORD dwCallbackInstance,
DWORD dwParam1, DWORD dwParam2, DWORD dwParam3)
{
Anyhelp for this ?? Cheers.

RasEnumConnection don't work...

Hi!
I've create an application that detect Gprs Connection and check how much traffic is genereted on a Smartphone WM2003 and WM5.
On WM2003 it's all right, but in WM5 the RasEnumConnections() function always return 0 with 0 connection active...
The code for detect Connection is:
DWORD isConnection = false;
RASCONN rgrc[4];
DWORD dwSize = sizeof(rgrc);
DWORD dwConn = 0;
DWORD dwREC;
dwREC = RasEnumConnections(rgrc, &dwSize, &dwConn);
if (dwREC == ERROR_SUCCESS)
{
DWORD i;
RASENTRY rasEntry;
rasEntry.dwSize = sizeof(RASENTRY);
for (i = 0; i < dwConn; i++)
{
if(!RasGetEntryProperties(NULL,
rgrcIdea.szEntryName,
&rasEntry,
&rasEntry.dwSize,
NULL,
NULL))
{
if(wcsstr(rasEntry.szLocalPhoneNumber, L"~GPRS!") != NULL)
{
isConnected = true;
break;
}
}
else{
Debug(TEXT("Error RasGetEntryProperties"));
}
}
}
else {
Debug(TEXT("Error RasEnumConnections [%d]", dwREC));
}
return isConnected;
How can I detect the Gprs Connection in native code for this goal in WM5?
Can anyone help me?
Thanks!!!
I experience the same problem on the P3300, but on the P3600, there is an application in the windows folder named datadisconnect.exe .. And i looked into it with a dissasembler... And it uses RasEnumConnections and RasHangup to disconnect.. So my question to you is... What device are you using? This might be bug of some sort.. I also see that there is a difference between the datadisconnect.exe on the p3300 and on the p3600.. so i'll look into them and see if i can find anything there...
SaSHje
Follow up
Hi .. i've looked into what the P3300 does.. and it seems like RAS isn't used at all.. When you are connected with i.e. GPRS, the connection adapter and connection name is stored in the registry under HKLM\System\State\Connection\Cellular.. The datadisconnect.exe on this device use these and the GetAdaptersInfo function from Iphlpapi.h. Based on the information from both... They call IpReleaseAddress from Iphlpapi.h .. So .. I'm gonna try to make my own datadisconnect where i do not use the info in the registry, but instead use GetInterfaceInfo from Iphlpapi.h, where i'll fill a PIP_INTERFACE_INFO structure, and based on the adapterindexmap in this structure, release the IP adress assigned to the adapter.
Hope this helps you a bit.. But .. strangely.. on the P3600, the RasHangup works.. I know we are trying to do different things here.. but the problems a similar... Ras doesn't function well ..
Hi!
Sorry to interupt this tread, but this may explane why the standard Spb GPRS Monitor does not work on the P3300. On the CD shipped with the device there is a spesial version of Spb GPRS monitor that works.
Regards
PK
No problem PK.. Thanks for letting me know.. i'll take a look at it when i have time.. FYI, using the GetInterfaceInfo and IpReleaseAddress works like a charm..
azatoth: I do not know how we can use the Iphlp API to find statistics regarding traffic etc... If you manage to solve this, please let me know.. I will do the same if i stumble over something which could resolve this issue..
Hello,
I have the same problem and try to disconnect an active GPRS connection
with IpReleaseAddress(). I have found the adapter with GetInterfaceInfo()
but IpReleaseAddress() always fails with an unknown error code.
Can you give me an example how you got this working?
Thanks.
Houser
This worked for me..
I used this link http://msdn2.microsoft.com/en-us/library/aa366056.aspx .. and f.ex this worked:
PIP_INTERFACE_INFO pInfo;
pInfo = (IP_INTERFACE_INFO *) malloc( sizeof(IP_INTERFACE_INFO) );
ULONG ulOutBufLen = sizeof(IP_INTERFACE_INFO);
DWORD dwRetVal = 0;
// Make an initial call to GetInterfaceInfo to get
// the necessary size in the ulOutBufLen variable
if ( GetInterfaceInfo(pInfo, &ulOutBufLen) == ERROR_INSUFFICIENT_BUFFER)
{
free(pInfo);
pInfo = (IP_INTERFACE_INFO *) malloc (ulOutBufLen);
}
// Make a second call to GetInterfaceInfo to get
// the actual data we need
if ((dwRetVal = GetInterfaceInfo(pInfo, &ulOutBufLen)) == NO_ERROR )
{
for (int i=0; i<pInfo->NumAdapters; i++)
{
IpReleaseAddress(&pInfo->Adapter);
}
}
free(pInfo);
Thanks. Now it works. My mistake was that I call IpReleaseAddress()
for PPP connection. For ethernet connections it works well.
Houser

How to select programatically a today theme.

Hi. I am trying to select programatically a today theme. I ve found different examples and I am using this function:
Code:
BOOL LoadTheme(LPCTSTR pszThemeFile)
{
HKEY hKey;
LONG lRet;
TCHAR szCmdLine[MAX_PATH];
PROCESS_INFORMATION pi;
lRet = RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Today"), 0,
0, &hKey);
if(ERROR_SUCCESS == lRet) {
RegDeleteValue(hKey, _T("UseStartImage"));
_stprintf(szCmdLine,_T("/safe /noui /nouninstall /delete 0 \"%s\""),
pszThemeFile);
if(CreateProcess(_T("\\Windows\\wceload.exe"), szCmdLine, NULL, NULL,
FALSE, 0, NULL, NULL, NULL, &pi)) {
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
RegSetValueEx(hKey, _T("Skin"), 0, REG_SZ, (BYTE*)pszThemeFile,
sizeof(TCHAR) * (_tcsclen(pszThemeFile) + 1));
RegFlushKey(hKey);
}
RegCloseKey(hKey);
::SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0xF2, 0);
::SendMessage(HWND_BROADCAST, WM_SYSCOLORCHANGE, 0, 0);
}
return (ERROR_SUCCESS == lRet);
}
Then I see how the background image changes, as color fonts but upper and lower bars, and scrooll bars doesnt change. Any idea? Thanks
Dani
Hi.
If a reset then It works. It seems the last postmessage dont do their job correctly. Any idea?
Ive noticed this just manually changing the theme, the keyboard icon background changes as expected, but the top and bottom bar do not, change it again and it works, although now im on a theme i dont want, so have to change again

[REF/DEV] KaiserGL SDK (for Imageon on Qualcomm 72xx devices)

All REMOVED by user request.
How-to
catch going to suspend: http://forum.xda-developers.com/showthread.php?p=2776841#post2776841
* more reserved *
Following up from post getting OT in thread:
ycavan said:
My opengl es init function is called after UpdateWindow(), so I'm still stumped as to why the surface still cannot be created... here's my winmain:
Click to expand...
Click to collapse
You might be missing some of the modern WM6 calls. Here's the relevant code from the working ported version of Graphics for the Masses.
I started with working code from the AppWizard. tabs/spaces is pushing the formatting everywhere:
Code:
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
MSG msg;
HACCEL hAccelTable;
int retval;
// Perform application initialization:
if (!InitInstance(hInstance, nCmdShow))
{
return FALSE;
}
hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_APPSTUFF));
// Main message loop:
for(;;)
{
switch(gMinimized_mode)
{
case 0:
game_loop:
while (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) == TRUE)
{
if (GetMessage(&msg, NULL, 0, 0) )
{
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessageW(&msg);
}
}
else
{
retval = (int) msg.wParam;
goto out;
}
}
if (!gMinimized_mode)
{
/* app code */
eglSwapBuffers (eglDisplay, eglWindowSurface);
if(retval == 0)
{
/* app exit code */
goto out;
}
}
break;
default:
while (GetMessage(&msg, NULL, 0, 0) )
{
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessageW(&msg);
}
if (msg.message == WM_PAINT)
{
gMinimized_mode = 0;
goto game_loop;
}
}
retval = (int) msg.wParam;
goto out;
}
}
out:
return retval;
}
ATOM MyRegisterClass(HINSTANCE hInstance, LPTSTR szWindowClass)
{
WNDCLASS wc;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APPSTUFF));
wc.hCursor = 0;
wc.hbrBackground = NULL;//(HBRUSH) GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = 0;
wc.lpszClassName = szWindowClass;
return RegisterClass(&wc);
}
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hWnd;
TCHAR szTitle[MAX_LOADSTRING]; // title bar text
TCHAR szWindowClass[MAX_LOADSTRING]; // main window class name
g_hInst = hInstance; // Store instance handle in our global variable
// SHInitExtraControls should be called once during your application's initialization to initialize any
// of the device specific controls such as CAPEDIT and SIPPREF.
SHInitExtraControls();
//LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
wcscpy(szTitle, appName);
LoadString(hInstance, IDC_OGLESEXFW, szWindowClass, MAX_LOADSTRING);
//If it is already running, then focus on the window, and exit
hWnd = FindWindow(szWindowClass, szTitle);
if (hWnd)
{
// set focus to foremost child window
// The "| 0x00000001" is used to bring any owned windows to the foreground and
// activate them.
SetForegroundWindow((HWND)((ULONG) hWnd | 0x00000001));
return 0;
}
if (!MyRegisterClass(hInstance, szWindowClass))
{
return FALSE;
}
hWnd = CreateWindow(szWindowClass, szTitle, WS_VISIBLE,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
if (!hWnd)
{
return FALSE;
}
// When the main window is created using CW_USEDEFAULT the height of the menubar (if one
// is created is not taken into account). So we resize the window after creating it
// if a menubar is present
if (g_hWndMenuBar)
{
RECT rc;
RECT rcMenuBar;
GetWindowRect(hWnd, &rc);
GetWindowRect(g_hWndMenuBar, &rcMenuBar);
rc.bottom -= (rcMenuBar.bottom - rcMenuBar.top);
MoveWindow(hWnd, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, FALSE);
}
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
{
/* EGL Setup */
EGLContext ctx;
EGLint majorVersion;
EGLint minorVersion;
//eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglDisplay = eglGetDisplay(GetDC(hWnd));
eglInitialize(eglDisplay, &majorVersion, &minorVersion);
eglConfig = select_config(eglDisplay, EGL_WINDOW_BIT, 16, 16, 4);
ctx = eglCreateContext(eglDisplay, eglConfig, NULL, NULL);
eglWindowSurface = eglCreateWindowSurface(eglDisplay, eglConfig, hWnd, NULL);
eglMakeCurrent(eglDisplay, eglWindowSurface, eglWindowSurface, ctx);
/* rest of app init */
}
return TRUE;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
static SHACTIVATEINFO s_sai;
switch (message)
{
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDM_HELP_ABOUT:
DialogBox(g_hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, About);
break;
case IDM_OK:
SendMessage (hWnd, WM_CLOSE, 0, 0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
case WM_CREATE:
{
SHMENUBARINFO mbi;
memset(&mbi, 0, sizeof(SHMENUBARINFO));
mbi.cbSize = sizeof(SHMENUBARINFO);
mbi.hwndParent = hWnd;
mbi.nToolBarId = IDR_MENU;
mbi.hInstRes = g_hInst;
if (!SHCreateMenuBar(&mbi))
{
g_hWndMenuBar = NULL;
}
else
{
g_hWndMenuBar = mbi.hwndMB;
}
// Initialize the shell activate info structure
memset(&s_sai, 0, sizeof (s_sai));
s_sai.cbSize = sizeof (s_sai);
}
break;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
// TODO: Add any drawing code here...
EndPaint(hWnd, &ps);
if (!gMinimized_mode) eglSwapBuffer();
break;
case WM_DESTROY:
eglMakeCurrent(NULL, NULL, NULL, NULL);
eglDestroyContext(eglDisplay, eglContext);
eglDestroySurface(eglDisplay, eglWindowSurface);
eglTerminate(eglDisplay);
CommandBar_Destroy(g_hWndMenuBar);
PostQuitMessage(0);
break;
case WM_SIZE:
switch(wParam)
{
case SIZE_MINIMIZED:
gMinimized_mode = 1;
break;
case SIZE_MAXIMIZED: case SIZE_RESTORED: case SIZE_MAXSHOW:
gMinimized_mode = 0;
default:
{
RECT wrect;
GetClientRect(hwnd, &wrect);
/* app resize code */
break;
}
}
break;
case WM_ACTIVATE:
// Notify shell of our activate message
SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE);
break;
case WM_SETTINGCHANGE:
SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai);
break;
case WM_KEYDOWN:
{
switch(wParam)
{
case(VK_UP):
break;
case(VK_DOWN):
break;
case(VK_LEFT):
break;
case(VK_RIGHT):
break;
case(VK_RETURN):
break;
}
if (wParam == VK_ESCAPE)
SendMessage(hwnd, WM_CLOSE, 0, 0);
break;
}
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
I'm using evc4, so I can't build for a THUMB ( wince 5.0 ) device... any way you can recompile the lib for ARMv4?
Otherwise, I'm still linking w/ the Vincent lib.
Anyway, I started a whole new app ( appwizard hello template ) instead of writing the winmain from scratch and I still cannot generate a surface when I have anything but EGL_NONE in the config requests.
One thing I note is that fps is about 47-48, but once again, the texture is not mapped onto the object. If I put it in my folder w/ the Vincent dll, the texture is mapped and the fps is about 11-12.
I'm not quite familiar w/ EGL, but... does anyone know the EGLConfig structure? I tried searching for it to see what the requested width/height per config was so I can debug why the surface just doesn't get created.
anyway, here's my code:
View attachment TestApp2.zip
ycavan said:
I'm using evc4, so I can't build for a THUMB ( wince 5.0 ) device... any way you can recompile the lib for ARMv4?
Click to expand...
Click to collapse
That's ARMv4 or ARMv4i? I'm going to assume latter because that's what most of the dlls seem to be targeting. I'll put this up soon.
Meantime, GetClientRect() on your hwnd and make sure the rect is sane before you pass it on to eglCreateWindowSurface().
Also, Imageon may work better with GLfloat values although it probably kills Vincent (with software emulation on the ARM without native FP support in armv6 by the compiler) with anything but GLfixed. Try some benchmarking to see which works out better.
100000xtimes thanks!
can you make a sourceforce project??
NuShrike said:
That's ARMv4 or ARMv4i? I'm going to assume latter because that's what most of the dlls seem to be targeting. I'll put this up soon.
Meantime, GetClientRect() on your hwnd and make sure the rect is sane before you pass it on to eglCreateWindowSurface().
.
Click to expand...
Click to collapse
ARMv4 is what evc4 targets...
GetClientRect() is giving me very sane values, 268x240... 268 due to the bars up top & below.
I guess I'm just confused as to why Vincent is able to properly create the proper surface while our drivers cannot...
Edit:
//eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglDisplay = eglGetDisplay(GetDC(hWnd));
eglInitialize(eglDisplay, &majorVersion, &minorVersion);
eglConfig = select_config(eglDisplay, EGL_WINDOW_BIT, 16, 16, 4);
ctx = eglCreateContext(eglDisplay, eglConfig, NULL, NULL);
eglWindowSurface = eglCreateWindowSurface(eglDisplay, eglConfig, hWnd, NULL);
eglMakeCurrent(eglDisplay, eglWindowSurface, eglWindowSurface, ctx);
/* rest of app init */
Click to expand...
Click to collapse
I just realized that you don't provide egl config attribs for for eglCreateWindowSurface or for eglCreateContext... huh. Doing that, the surface and context are created ok, but the texture still isn't loaded... mebbe a problem w/ texture loading.
NuShrike said:
That's ARMv4 or ARMv4i? I'm going to assume latter because that's what most of the dlls seem to be targeting. I'll put this up soon.
Meantime, GetClientRect() on your hwnd and make sure the rect is sane before you pass it on to eglCreateWindowSurface().
Also, Imageon may with better with GLfloat values although it probably kills Vincent (with software emulation on the ARM without native FP support in armv6 by the compiler) with anything but GLfixed. Try some benchmarking to see which works out better.
Click to expand...
Click to collapse
In the words of the great Sammy L.
ENGLISH MOTHAF*CKA DO YOU SPEAK IT!?!
Click to expand...
Click to collapse
cp_kirkley said:
In the words of the great Sammy L.
Click to expand...
Click to collapse
That's just rude, dood... lol
Anywho, it looks like the problem w/ texturing is that our drivers do not seem to support mipmap. By commenting out the linear mipmap flag when loading the texture, we get a fully working opengl es test app. I get about 44 fps.
See for yourselves.
View attachment testapp2.zip
@nushrike, both of your libgles_cm.lib's are designed for the 'THUMB' device. It's ok. I'll just keep on linking to the vincent lib.
Just remember that our driver does not support mipmap.
I think it's eVC is too old then. It's been thumb since WinCE5. Most all the system libs I have to link to insiste on Thumb -- if I set it to ARM, it refuses to link. Hey, that's an idea.. I'll try ARM to see if it generates any .lib.
For hardware, or supported mipmapping (software or not), look up glGenerateMipmapOES(GL_TEXTURE_2D). The tech demo I posted earlier demonstrates this. It's that blurry looking rotating texture behind the checker-board and various other textures.
edit: nope, can't create a dummy .lib by trying to link ARM.
Instead, you can modify Vincent to fake-support the extended functions as you need them and as they exist in the HWA .dll exports list. Here's an example:
Code:
#ifdef __GL_EXPORTS
# define GL_API __declspec(dllexport)
#else
# define GL_API
#endif
#define GL_APICALL GL_API
#define GL_APIENTRY
#ifdef __cplusplus
extern "C" {
#endif
{
GL_APICALL void GL_APIENTRY glGenerateMipmapOES (GLenum target)
{ return; }
#ifdef __cplusplus
}
#endif
NetrunnerAT said:
can you make a sourceforce project??
Click to expand...
Click to collapse
No code to make it a SourceForge project. Now, if it was code to make the drivers, that would be worthy.
ycavan: figured out your bug. You have to pass NULL for configAttrib (the last parameter) for eglCreateContext, and eglCreateWindowSurface. Also, using glGenerateMipmapOES(GL_TEXTURE_2D) with your source, texture works fine now. Same FPS. I'm seeing if converting to GLfloat will speed it up.
edit: float is no speed increase so far, but no decrease either.
ycavan said:
105171
Click to expand...
Click to collapse
How do you get this to run? I've already asked you in PM that WinCE doesn't support the concept of "current working directory" and you use in your code.
I'm sorry about not responding to the pm's... lol, I just didn't see them.
Anyway, just unzip the file on your pc and copy the exe and resources folder to your device and run the exe. Just make sure to keep the exe and resources folder together.
ycavan said:
Anyway, just unzip the file on your pc and copy the exe and resources folder to your device and run the exe. Just make sure to keep the exe and resources folder together.
Click to expand...
Click to collapse
It doesn't work for me after I drop it into the "Program Files" folder because this code is hard-coded for root directory then.
really odd... i ran the program in its own directory w/o a problem... i'm @ work, so i'll check it out when i get home.
it looks like the "resources" directory must be on the root of the device...
I'm working on finding the cwd, but loading resources fails even though it's the correct wd...
You guys can try and see if this works...
Code:
TCHAR tPath[255];
char sPath[255];
// get full path to this executable
GetModuleFileName(NULL,tPath,255);
// find the last '\'
TCHAR* pos = wcsrchr(tPath,'\\');
// end the string after the last '\'
*(pos+1) = '\0';
// copy wide char array to multi-byte string
wcstombs(sPath,tPath,255);
sPath should contain the working directory... but my app is failing the resource loads even though this is the same full path as before...
this can be very intresting for xda flame with goforce? can you build the libs because there is no SDK avialeble, the test app doesn't work message:
OpenGL ES init error:
eglInitialize
jaikben22 said:
this can be very intresting for xda flame with goforce? can you build the libs because there is no SDK avialeble, the test app doesn't work message:
OpenGL ES init error:
eglInitialize
Click to expand...
Click to collapse
EDIT:
Just realized that you're talking about another phone w/ the goforce... lol
You will need to prolly google "goforce opengl es sdk" There should be quite a few out there.
On another note... I figured out the problem with working directory resource loading.
I prefer to make a call once when it's something configuration-related... like storing my current working directory... it seems that evc4 doesn't like it when I do that so I had to update mesh.cpp and texture.cpp to perform the GetModuleFileName calls in each load function.
Here's an updated TestApp2. You just need to keep testapp2.exe and the resources directory together.
View attachment testapp2.zip
Updates include:
+ fullscreen now
+ up/down rotation
+ left/right acceleration -100 to 100
+ spouting of particles
Have fun guys.
The resources directory contains these files that you can change if you want to try different things.
spot.raw - the particle system's balls texture
font.raw - the font texture
knot.gsd - the main object mesh
fire128.tga - the mesh object's texture
lol for goforce there are none zero nada

Call Log coding problem (C++)

hi everybody,
i've got a strange problem using the edb functions in windbase_edb.h. i create a new c++ smartdevice project in vs2008, targeting Windows Mobile 6.1 Pro.
although CeMountDBVolEx returns true [ie successfully mounted], GetError() shows that some ERROR_INVALID_PARAMETER happened inside.
then, CeOpenDatabaseInSession returns an INVALID_HANDLE_VALUE handle, ie the call log didn't open, and GetError() shows that some ERROR_INVALID_PARAMETER happened inside again.
please help, what am i doing wrong?
thank you very much.
code as follows:
Code:
HWND hWnd;
CEGUID guidVol;
bool isVolMounted;
HANDLE aDbHandlers[EDB_MAX];
DWORD aDbUsers[EDB_MAX];
CENOTIFYREQUEST aNotifyReqs[EDB_MAX];
CEGUID m_ceguidInitDB;
CEOID oidDB=0;
HANDLE m_hDBCLog = INVALID_HANDLE_VALUE;
CEVOLUMEOPTIONS moPim = { 0 };
DWORD err= 0;
//CREATE_INVALIDEDBGUID(&m_ceguidInitDB);
moPim.wVersion = CEVOLUMEOPTIONS_VERSION;
moPim.dwFlags = CEDB_BUFFERPOOL;
moPim.cbBufferPool = EDBDATA_PIM_VOL_BUFFER;
err = GetLastError(); // if we see an error already... @#[email protected]#[email protected]# !!!
err=0; // clear the error variable so we can see it flip
BOOL MountResult = CeMountDBVolEx(&guidVol, L"\\pim.vol", &moPim, OPEN_EXISTING | EDB_MOUNT_FLAG);
err=GetLastError(); // even though MountResult returns true, err sees 87, ERROR_INVALID_PARAMETER
if(MountResult != TRUE)
{
return;
}
err=0; // clear the error variable so we can see it flip
m_hDBCLog =CeOpenDatabaseInSession( NULL,&m_ceguidInitDB, &oidDB, L"clog.db", 0, CEDB_AUTOINCREMENT, NULL);
err=GetLastError(); // err sees 87, ERROR_INVALID_PARAMETER
if (m_hDBCLog != INVALID_HANDLE_VALUE)
{
// todo: read the log entries, do some stuff, etc
// for some reason, m_hDBCLog does have an INVALID_HANDLE_VALUE... why?
err = 0;
}
CeUnmountDBVol(&m_ceguidInitDB);
Problem
Hi...
Have you seen the FileDB sample on whe Windows Mobile 6 SDK? I created my software using that example and it works fine.
RonaldoR9 said:
hi everybody,
i've got a strange problem using the edb functions in windbase_edb.h. i create a new c++ smartdevice project in vs2008, targeting Windows Mobile 6.1 Pro.
although CeMountDBVolEx returns true [ie successfully mounted], GetError() shows that some ERROR_INVALID_PARAMETER happened inside.
then, CeOpenDatabaseInSession returns an INVALID_HANDLE_VALUE handle, ie the call log didn't open, and GetError() shows that some ERROR_INVALID_PARAMETER happened inside again.
please help, what am i doing wrong?
thank you very much.
code as follows:
Code:
HWND hWnd;
CEGUID guidVol;
bool isVolMounted;
HANDLE aDbHandlers[EDB_MAX];
DWORD aDbUsers[EDB_MAX];
CENOTIFYREQUEST aNotifyReqs[EDB_MAX];
CEGUID m_ceguidInitDB;
CEOID oidDB=0;
HANDLE m_hDBCLog = INVALID_HANDLE_VALUE;
CEVOLUMEOPTIONS moPim = { 0 };
DWORD err= 0;
//CREATE_INVALIDEDBGUID(&m_ceguidInitDB);
moPim.wVersion = CEVOLUMEOPTIONS_VERSION;
moPim.dwFlags = CEDB_BUFFERPOOL;
moPim.cbBufferPool = EDBDATA_PIM_VOL_BUFFER;
err = GetLastError(); // if we see an error already... @#[email protected]#[email protected]# !!!
err=0; // clear the error variable so we can see it flip
BOOL MountResult = CeMountDBVolEx(&guidVol, L"\\pim.vol", &moPim, OPEN_EXISTING | EDB_MOUNT_FLAG);
err=GetLastError(); // even though MountResult returns true, err sees 87, ERROR_INVALID_PARAMETER
if(MountResult != TRUE)
{
return;
}
err=0; // clear the error variable so we can see it flip
m_hDBCLog =CeOpenDatabaseInSession( NULL,&m_ceguidInitDB, &oidDB, L"clog.db", 0, CEDB_AUTOINCREMENT, NULL);
err=GetLastError(); // err sees 87, ERROR_INVALID_PARAMETER
if (m_hDBCLog != INVALID_HANDLE_VALUE)
{
// todo: read the log entries, do some stuff, etc
// for some reason, m_hDBCLog does have an INVALID_HANDLE_VALUE... why?
err = 0;
}
CeUnmountDBVol(&m_ceguidInitDB);
Click to expand...
Click to collapse
rogeriodeluca said:
Hi...
Have you seen the FileDB sample on whe Windows Mobile 6 SDK? I created my software using that example and it works fine.
Click to expand...
Click to collapse
hi rogeriodeluca,
first of all, thank you for your suggestion. next, sorry it's taken so long for me to get back to you [life... don't talk to me about life!]
the filedb example you suggested creates a new database for the program to play with, and when run as is, works fine. unfortunately, when i fiddle the filedb code to try to open the pim.vol's contact database, i get exactly the same errors. running on the emulator, it returns the error code mentioned in my original post. running on the phone itself, it just craps out and goes back to the today screen.
i'm at my wit's end... anything else i can try?
RonaldoR9 said:
hi rogeriodeluca,
first of all, thank you for your suggestion. next, sorry it's taken so long for me to get back to you [life... don't talk to me about life!]
the filedb example you suggested creates a new database for the program to play with, and when run as is, works fine. unfortunately, when i fiddle the filedb code to try to open the pim.vol's contact database, i get exactly the same errors. running on the emulator, it returns the error code mentioned in my original post. running on the phone itself, it just craps out and goes back to the today screen.
i'm at my wit's end... anything else i can try?
Click to expand...
Click to collapse
Take a look at this link:
http://social.msdn.microsoft.com/Forums/en-US/vssmartdevicesnative/thread/d0caf390-cce6-4bef-ad0e-e9c05e63f050/
sorry, i forgot to return and say thank you!
thank you, your help was invaluable in figuring out this goofy problem!

Categories

Resources