|
Hello,
I've got the following problem. We use rapi.dll with the OpenNetCf wrapper api to transfer files to and from Windows Mobile devices. This works perfectly unless ActiveSync is actively synchronising data (e.g. Calendar information). Then the called method just hangs.
Now my question (and I haven't found a solution to this so far):
How do I detect from the desktop application if ActiveSync (or its Vista counterpart - forget that name as soon as I hear it) is currently synchronising to prevent file exchange during synchronization?
I know there's Microsoft.WindowsMobile.Status, but as far as I understand this only works from the mobile device and I need it from the desktop. At least I haven't been able to import it into my desktop solution.
We use .NET 3.5 with VB.NET but any usable solution would do.
Thanks in advance.
Marcus
|
|
|
|
|
HI all,
i m using rapi function to connect with windows based mobile first time when device is connected than i run my application than its establish connection successfully.
but in mid if i reconnect the device than after connection when i chek connection with my application than it shows this error message this is i get by CeRapiGetError "the device is not ready".
please tell me what can i do.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
If the RAPI server on the device does not correctly shut down after disconnection, you will see that error. Are you using a custom RAPI extension?
Regards,
João Paulo Figueira
DAD MVP
|
|
|
|
|
i m using RAPI api those are given in MSDN
like CeRapiUnint(),CeRapiInit()
Joao Paulo Figueira wrote: If the RAPI server on the device does not correctly shut down after disconnection
how can i correctly shut down it.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
To shut things down you must call CeRapiUninit (as you probably are), but please make sure that all device handles are closed. I usually get that when my custom RAPI extension DLLs hang for some reason and the RAPI server becomes unavailable. I never experienced this situation with straight RAPI calls.
There's also something worth investigating: the version of ActiveSync on your PC (if you use XP, that is). For Vista / 7 make sure you use WMDC 6.1.
Regards,
João Paulo Figueira
DAD MVP
|
|
|
|
|
Hi,
I'm also using RAPI Api to connect to a Windows Mobile based Device.
And I'm also facing the problem mentioned in first thread.
Is there any way to shut down the RAPI Server on the device and restart it afterwards?
My problem seems to be exactly the same like mentioned above.
When I first connect the Device I can communicate with it perfectly and everything is
working fine.
But once I reconnect the Device I get an Error that says:
hr = 0x80070015 which is "Device not ready".
Can anyone help?
Best regards.
|
|
|
|
|
If your device (or RAPI extension DLL) somehow crashed, you will get this error. From my experience, the only solution to this problem is to reset the connection (disconnect and connect the device again).
Regards,
João Paulo Figueira
DAD MVP
|
|
|
|
|
Hey,
thanks for your reply.
Joao Paulo Figueira wrote: From my experience, the only solution to this problem is to reset the connection (disconnect and connect the device again).
But that is exactly the point.
This is why the error occurs.
I just found out that once CeRapiInit() is called many Libraries are loaded.
But they will not be unloaded when CeRapiUnInit() is called.
And I think that this is the point.
There are still Handles open that will block the connection upon reconnect.
I will try to figure out how to unload those Libraries and give you feedback whether that was helpfull or not.
|
|
|
|
|
Hey guys and girls ,
I got the clue.
There are two very bad errors.
First thing is, that rapi.dll does NOT export a function called CeRapiUnInit() .
But it does export a function called CeRapiUninit() . So most of the scripts around do have a typo.
Due to this fact you won't be able to get a pointer on that function. Thats why it will never execute.
So if you change this in your scripts you will be able to call that function.
Second thing is that CeRapiUninit() does not clean up everything for you.
You have to free the handle on rapi.dll by yourself.
If you do so, you App will free that handle and won't block another connection (e.g. on reconnect).
I now can connect und reconnect my Device as often as I like and everything works fine.
Thanks for your help again.
|
|
|
|
|
Hello,
I am using VS 2005 (VB.NET) for a WinCE 5.0 device (CF).
I am trying to create a form that is unmovable (locked) and full screen (with no taskbar).
I am able to create the form locked and make the taskbar disappear, but it doesn't make it full screen (it leaves a small section below where the taskbar was before as a blank area, it which is the desktop area).
I tried changing the properties for the form to no avail.
Can anyone help me? Thanks.
|
|
|
|
|
|
Do you have a sample VB.NET code that I can test using these libraries?
Thanks.
|
|
|
|
|
Disregard my previous message, I finally found out, thanks for your help!!!
|
|
|
|
|
can u pls help me to do project on transparent cellphones?
|
|
|
|
|
Dear all
I need information about receiver of SMS in windows mobile.
Therefore, I implemented following codes.
Elvironment is VS 2005 and WM 5.0
#include "mapix.h"
#include "cemapi.h"
#include "Mapiutil.h"
#include "time.h"
#include <windows.h>
void ProcessSMS();
INT WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
ProcessSMS();
return 0;
}
void ProcessSMS()
{
bool fail = false;
HRESULT hr;
ICEMAPISession * pSession = NULL;
IMAPITable* pTable = NULL;
SRowSet * pSRowSet = NULL;
IMsgStore * pStore = NULL;
hr = MAPIInitialize(NULL);
if (hr != S_OK) {
printf("Failed to init\n");
exit(0);
}
hr = MAPILogonEx(0, NULL, NULL, 0, (LPMAPISESSION *)&pSession);
if (hr != S_OK) {
printf("Failed to Logon\n");
exit(0);
}
hr = pSession->GetMsgStoresTable(0, &pTable);
if (hr != S_OK) {
printf("Failed to get Msg StoreTable\n");
exit(0);
}
while(TRUE)
{
BOOL QRError = FALSE;
hr = pTable->QueryRows(1, 0, &pSRowSet);
if(hr != S_OK || pSRowSet->cRows != 1) { fail = true; break;}
hr = pSession->OpenMsgStore(0, pSRowSet->aRow[0].lpProps[0].Value.bin.cb, (ENTRYID *)pSRowSet->aRow[0].lpProps[0].Value.bin.lpb, NULL, 0, &pStore);
if (hr != S_OK)
{
printf("Failed to get Open MsgStore\n");
exit(0);
}
SPropTagArray props;
props.cValues = 1;
props.aulPropTag[0] = PR_DISPLAY_NAME;
ULONG cValues;
SPropValue* pProps = NULL;
hr = pStore->GetProps(&props, MAPI_UNICODE, &cValues, &pProps);
if (FAILED(hr) || cValues != 1) {fail = true; break;}
if (_tcsicmp(pProps[0].Value.lpszW, _T("SMS")) == 0)
{
fail = false;
break;
}
}
static const SizedSSortOrderSet(1, sortOrderSet) = { 1, 0, 0, { PR_MESSAGE_DELIVERY_TIME, TABLE_SORT_ASCEND } };
static const SizedSPropTagArray (4, spta) = {4,PR_EMAIL_ADDRESS, PR_SENDER_EMAIL_ADDRESS, PR_MESSAGE_DELIVERY_TIME,PR_SUBJECT};
ULONG cbEntryId = 0;
LPENTRYID pEntryId = NULL;
IMAPIFolder *pFolder = NULL;
ULONG ulObjectType = 0;
SRowSet *pRowSet = NULL;
ULONG cValues = 0;
SPropTagArray propDefaultFolder;
propDefaultFolder.cValues = 1;
hr = pStore->GetReceiveFolder(NULL, MAPI_UNICODE, &cbEntryId, &pEntryId, NULL);
if ( hr == S_OK )
{
hr = pStore->OpenEntry(cbEntryId, pEntryId, NULL, 0, &ulObjectType, (LPUNKNOWN*)&pFolder);
if ( hr == S_OK )
{
ASSERT( ulObjectType == MAPI_FOLDER );
hr = pFolder->GetContentsTable( 0, &pTable );
if ( hr == S_OK )
{
hr = pTable->SortTable( (SSortOrderSet *)&sortOrderSet, 0 );
if ( hr == S_OK )
{
hr = pTable->SetColumns( (SPropTagArray *)&spta, 0 );
if ( hr == S_OK )
{
while(TRUE)
{
FreeProws( pRowSet );
pRowSet = NULL;
hr = pTable->QueryRows(1, 0, &pRowSet);
if ((hr != S_OK) || (pRowSet == NULL) || (pRowSet->cRows == 0))
break;
SPropValue *pval = pRowSet->aRow[0].lpProps;
SYSTEMTIME sys;
FILETIME lt;
FileTimeToSystemTime(&pval[2].Value.ft, &sys);
struct tm tmp;
tmp.tm_year = (int) sys.wYear - 2000;
tmp.tm_mon = (int) sys.wMonth;
tmp.tm_wday = (int) sys.wDayOfWeek;
tmp.tm_mday = (int) sys.wDay;
tmp.tm_hour = (int) sys.wHour;
tmp.tm_min = (int) sys.wMinute;
tmp.tm_sec = (int) sys.wSecond;
LPSTR temp = pval[3].Value.lpszA;
int utf8_length;
utf8_length = WideCharToMultiByte(CP_UTF8, 0, (const wchar_t *)temp, -1, NULL, 0, NULL, NULL);
char* utf8;
utf8 = (char*)malloc(sizeof(char)*(utf8_length+1));
utf8_length = WideCharToMultiByte(CP_UTF8, 0, (const wchar_t *)temp, -1, utf8, utf8_length, NULL, NULL);
printf("%s\n", utf8);
MessageBox(NULL,(LPCWSTR)pval[0].Value.lpszA, TEXT("OK"), MB_OK);
MessageBox(NULL,(LPCWSTR)pval[1].Value.lpszA, TEXT("OK"), MB_OK);
}
}
}
}
else
{
DWORD err = GetLastError();
int i = 0;
}
}
}
pFolder->Release();
pFolder = NULL;
FreeProws (pRowSet);
pRowSet = NULL;
pTable->Release();
pTable = NULL;
}
However, PR_MAIL_ADDRESS tag was missing!
I don't know how to solve this problem.
Please help me.
Regards.
nkh37
|
|
|
|
|
Hi
I'm trying to find out a way to either colour the background of a treeview in a .net mobile application.
I would love to be able to make it transparent or just add a background image.
Have tried various concepts but none have worked successfully so far ( maybe me ).
so far have tried wndproc - but when converting the code from c# to vb - it seemed to go a bit wonky
If there are any new ideas it would be very much appreciated.
thanks
John
|
|
|
|
|
Hello,
I am developing a smart device application on windows mobile 6.0, for which I want cirtain input from user at the time of deployment.
So could anyone tell me how can I make an interactive CAB or how can I add user interface to CAB project.
Thanks in advance.
Mayur.
|
|
|
|
|
add a setup.dll to your CAB and there you can show a dialog in install_exit() or whenever you need it.
|
|
|
|
|
Hi,
sorry for cross posting - I'm a bit overworked and didn't see that there's a mobile dev forum.
I'm working on a Windows Mobile application that connects to a server on a PC.
The problem with the following lines:
CSocket as;
if(!as.Create())
MessageBox(_T("creation failed"));
if(as.Connect(_T("192.168.1.24"), 110))
MessageBox(_T("connected"));
else
MessageBox(_T("failed to connect"));
is, that Connect(...) allways returns TRUE, even if the server isn't started and even if the PC with the IP address 192.168.1.24 is switched off.
This error only occures with Windows Mobile and a WLAN connection. On Windows XP/Vista connected via WLAN/LAN or Windows Mobile connected via USB Connect(...) returns FALSE when there's no server.
Any hints?
Thanks,
Thomas
ps.: to be a bit more precise - the problematic connection is from a PDA via WLAN to a Netgear internet router and the PC is connected via LAN
|
|
|
|
|
i recently am working on the android game development !i want to achieve that the users can play the games with each other with the tcp socket or Bluetooth!
now i want to know how make the tcp connection between two emulators in different pcs successful!i can achieve it in the same pc!also i can show some code below ,i help someone can help me ?
thanks in advance!
the activity:
public class UDPConnection extends Activity { <br />
<br />
@Override <br />
public void onCreate(Bundle icicle) { <br />
super.onCreate(icicle); <br />
setContentView(R.layout.main); <br />
<br />
Thread sThread = new Thread(new Server()); <br />
Thread cThread = new Thread(new Client()); <br />
<br />
sThread.start(); <br />
try { <br />
Thread.sleep(500); <br />
} catch (InterruptedException e) { } <br />
<br />
cThread.start(); <br />
} <br />
}
the client:
public class Server implements Runnable{ <br />
public static final String SERVERIP = "127.0.0.1"; <br />
public static final int SERVERPORT = 4444; <br />
<br />
@Override <br />
public void run() { <br />
try { <br />
Log.d("UDP", "S: Connecting..."); <br />
InetAddress serverAddr = InetAddress.getByName(SERVERIP); <br />
DatagramSocket socket = new DatagramSocket(SERVERPORT,serverAddr); <br />
byte[] buf = new byte[17]; <br />
DatagramPacket packet = new DatagramPacket(buf, buf.length); <br />
Log.d("UDP", "S: Receiving..."); <br />
socket.receive(packet); <br />
Log.d("UDP", "S: Received: '" + new String(packet.getData()) + "'"); <br />
Log.d("UDP", "S: Done."); <br />
} catch (Exception e) { <br />
Log.e("UDP", "S: Error", e); <br />
} <br />
} <br />
}
the server :
public class Client implements Runnable { <br />
@Override <br />
public void run() { <br />
try { <br />
Log.d("UDP", "C: Connecting..."); <br />
DatagramSocket socket = new DatagramSocket(); <br />
byte[] buf = ("Hello from Client").getBytes(); <br />
InetAddress serverAddr = InetAddress.getByName(Server.SERVERIP); <br />
DatagramPacket packet = new DatagramPacket(buf, buf.length, serverAddr, Server.SERVERPORT); <br />
Log.d("UDP", "C: Sending: '" + new String(buf) + "'"); <br />
socket.send(packet); <br />
Log.d("UDP", "C: Sent."); <br />
Log.d("UDP", "C: Done."); <br />
} catch (Exception e) { <br />
Log.e("UDP", "C: Error", e); <br />
} <br />
} <br />
}
|
|
|
|
|
I want to make a GPRS connection from a WinCe 6.0 device over a handy. The programming language is C#. So I used PInvoke to call some API functions like ActivateDevice. Everything works fine. Just sometimes I the ActivateDevice func. returns the error 110. Especally if I call ActivateDevice/DeactivateDevice a few times. What I am doing wrong?
RegistryKey rkNewDevice = null;
RegistryKey rkPortsDevice = null;
RegistryKey rkPortsDeviceUnimodem = null;
IntPtr contextPtr = IntPtr.Zero;
string regString = string.Format("\\SOFTWARE\\Microsoft\\Bluetooth\\Device\\modem\\{0}",
Address.ToString().ToLower());
rkNewDevice = Registry.LocalMachine.CreateSubKey(regString);
if (Authenticate)
rkNewDevice.SetValue("auth", 1, RegistryValueKind.DWord);
else
rkNewDevice.SetValue("auth", 0, RegistryValueKind.DWord);
if (Encrypt)
rkNewDevice.SetValue("encrypt", 1, RegistryValueKind.DWord);
else
rkNewDevice.SetValue("encrypt", 0, RegistryValueKind.DWord);
if (rkNewDevice.GetValue("name", "").ToString() == "")
{
rkNewDevice.SetValue("name", FriendlyName);
}
regString = string.Format("\\SOFTWARE\\Microsoft\\Bluetooth\\Device\\ports\\{0}", FriendlyName);
rkPortsDevice = Registry.LocalMachine.CreateSubKey(regString);
rkPortsDevice.SetValue("dll", "btd.dll", RegistryValueKind.String);
rkPortsDevice.SetValue("prefix", "BSP", RegistryValueKind.String);
int index = FindFreePort();
rkPortsDevice.SetValue("index", index, RegistryValueKind.DWord);
PORTEMUPORTPARAMS pep = new PORTEMUPORTPARAMS();
pep.uiportflags = RFCOMM_PORT_FLAGS.REMOTE_DCB;
if (Encrypt)
pep.uiportflags |= RFCOMM_PORT_FLAGS.ENCRYPT;
if (Authenticate)
pep.uiportflags |= RFCOMM_PORT_FLAGS.AUTHENTICATE;
pep.flocal = false;
pep.device = Address.ToInt64();
pep.channel = Channel;
int size = Marshal.SizeOf(typeof(PORTEMUPORTPARAMS));
contextPtr = Marshal.AllocHGlobal(size);
Marshal.StructureToPtr(pep, contextPtr, false);
rkPortsDevice.SetValue("context", contextPtr.ToInt32(), RegistryValueKind.DWord);
if (DeviceType == DeviceTypes.MODEM ||
DeviceType == DeviceTypes.LAP ||
DeviceType == DeviceTypes.ASYNC)
{
regString = string.Format("\\SOFTWARE\\Microsoft\\Bluetooth\\Device\\ports\\{0}\\unimodem",
FriendlyName);
rkPortsDeviceUnimodem = Registry.LocalMachine.CreateSubKey(regString);
rkPortsDeviceUnimodem.SetValue("friendlyname", FriendlyName, RegistryValueKind.String);
rkPortsDeviceUnimodem.SetValue("tsp", "unimodem.dll", RegistryValueKind.String);
int devicetype = DeviceType == DeviceTypes.MODEM ? 1 : 0;
rkPortsDeviceUnimodem.SetValue("devicetype", devicetype, RegistryValueKind.DWord);
}
regString = string.Format("\\SOFTWARE\\Microsoft\\Bluetooth\\Device\\ports\\{0}", FriendlyName);
rkNewDevice.Flush();
rkPortsDevice.Flush();
rkPortsDeviceUnimodem.Flush();
IntPtr devHandle = WinNative.ActivateDevice(regString, 0);
if (devHandle != IntPtr.Zero &&
devHandle.ToInt32() != -1)
{
active = true;
Handle = devHandle.ToInt32();
rkNewDevice.SetValue("handle", Handle, RegistryValueKind.DWord);
rkNewDevice.SetValue("active", 1, RegistryValueKind.DWord);
rkNewDevice.SetValue("port_name", string.Format("BSP{0}:", index.ToString()), RegistryValueKind.String);
}
rkNewDevice.Close();
rkPortsDevice.Close();
rkPortsDeviceUnimodem.Close();
Marshal.FreeHGlobal(contextPtr);
|
|
|
|
|
Hi All,
I have a question regarding RSS...I am currently using web service to download data from server database to my mobile device(client) using web service which acts as a data access layer.Also through RSS we can download data...
1) Wat exactly is the difference between the two,Web service and RSS in terms of data fetch??
2) In what scenarios can we opt for RSS(business use case)?
Also when we create an xml doc on the server side how is it different from RSS i.e how can we say that it is an RSS feed?
Kindly provide pointers to the above mentioned querries.
Thanks in advance
|
|
|
|
|
Hi
A web service is a vague description of a remote service capable of reading requests made, most likely, over http and replying according to a predefined set of rules.
A "Service" in this case is an interface to underlying appliction/applications.
The communication scheme, syntax and process rules, is also commonly called protocol. Such protocols include XML-RPC, SOAP and REST.
RSS, Atom are examples of definitions for stuctured data such as news items etc
In a web service call, such as an XML-RPC or SOAP call, you can include content such as RSS or Atom.
A simple top down example of dependances in a web service call:
RSS (Human Readable Data)
|
V
SOAP (Method Call Defenition Protocol)
|
V
HTTP (High Level Transport Protocol)
|
V
TCP-IP (Low Level Transport Protocol)
What you are aiming at, i guess, is the manner to make calls and handle responses,
* REST (Representational State Transfer) services include most RSS and ATOM feeds. REST means that you use HTTP (GET,PUT,DELETE) as protocol for retrieving (GET), updating (PUT) and deleting (DELETE) items on the remote end. REST skips the overhead of SOAP/XML-RPC and is a very fast and light weight way of communicating with a web service.
* SOAP (Simple Object Access Protocol) is however the most supported way of sending requests and recieveing responses on the CE platform. It is actually the technology of choice for the entire .NET paradigm. Its rather bulky though...
* XML-RPC (XML Remote Procedure Call) is a very simplified protocol way of making Web Service calls. Because of its simplicity this is the choice for many developers outside the MS sphere.
Hope this helps,
Lars
modified on Tuesday, August 4, 2009 12:01 PM
|
|
|
|
|
very good and apt answer.... voted as good... im also working on an application which uses both
This code was posted by me...
|
|
|
|
|
I tried to consume a web service with smart phone application using VS 2005 i get the following errors when i try to test my project. my immediate windows shows the following:
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'System.Net.WebException' occurred in System.Web.Services.dll
while the error message i get is this:
System.Net.WebException was unhandled
Message="WebException"
I'll be glad if someone can help me with this urgently
|
|
|
|
|