Re: Urgent: Storage Card Mount and UnMount Event WM 5.0

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



On Apr 19, 5:49 pm, "<ctacke/>" <ctacke[@]opennetcf[dot]com> wrote:
First, don't say things are urgent. Everyone who posts to the group thinks
their question is important, and yours is no more important than anyone
elses.

For the answer see the RequestDeviceNotifications API.

--
Chris Tacke - Embedded MVP
OpenNETCF Consulting
Managed Code in the Embedded Worldwww.opennetcf.com
--

"Krish" <mohanakrishnan.giridha...@xxxxxxxxx> wrote in message

news:1176961288.342692.274200@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx



Hi,

My application access the database stored in aStorageCard, I
connect
to the database when application loads and disconnect it on exit.

My question here is

1. When I pull out theStorageCard, theeventWM_FILECHANGEINFO is
triggered only after a delay, after analysis I beleive the delay is
due to "pnpunloaddelay" set by OEM. But the problem is when I try to
access the database during the delay, I am getting database
exception.
Is there any othereventwhich I can handle to find thecardis
removed. Here is the code fragment which I am using

LRESULT CMainFrame::OnFileChangeInfo(WPARAM /* wParam */, LPARAM
lParam)
{
FILECHANGENOTIFY *pFCN = (FILECHANGENOTIFY *)lParam;
FILECHANGEINFO &nfo = pFCN->fci;

switch(nfo.wEventId)
{

case SHCNE_DRIVEREMOVED:
{
CString s("Storagemedia has been removed From
a drive.");
LOG_MSG(s);
break;
}

case SHCNE_DRIVEADD:
{
CString s("Storagemedia has been inserted
into a drive.");
LOG_MSG(s);
break;
}
}
return 0;

}

Will the Database connection handle will be valid even afterunmount
andmountevent?

2. When device goes to sleep mode or manual switch off, sometime the
cardis getting unmounted and mounted and sometime it is not...why is
that?

3.When device goes out of sleep mode or on switch on, I am
intercepting the wake up notification using aEventin my
application.
I have tried to access the file using FindFirstFile on a infinite
loop
to find whether the database file is available or not after receiving
the notifications. Once the file is accessible I am trying to use the
same old DB handle which got created on application Init, but
sometimes the operation fails(Not always).

Can anyone help me in resolving these issues...

Any pointers to understand thestoragecardrelated details forWM
5.0
would be a great help.

Thanks,
Krish- Hide quoted text -

- Show quoted text -

I have used the RequestDeviceNotifications, but even here the same
thing happens, the card unmount event has occured after the
pnpunloaddelay, so if I do some DB operation during the period it
fails...

Pls guide me

Thanks,
Krish

.



Relevant Pages

  • Re: Problem with VBA created subform in Access 2007
    ... machine not be seeing the delay in the DB. ... User-authorization for exclusive database access. ... default open mode set to exclusive access, ...
    (microsoft.public.access.modulesdaovba)
  • Re: Pocket PC and Microsoft Access
    ... Chris Tacke, Embedded MVP ... Your VB program will also not run on a mobile device, ... using a SQL CE backend database. ...
    (microsoft.public.pocketpc.developer)
  • Re: Prompting large number of records
    ... Where is the database? ... How are you displaying them? ... Is the delay in updating the display... ... and load in more as the user scrolls down. ...
    (microsoft.public.vb.general.discussion)
  • Re: Problem with VBA created subform in Access 2007
    ... that is showing the delay problem i turned all of the autocorrect options to ... but I still see the delay. ... made in the database stored on our server) I tried to connect two machines to ... default open mode set to exclusive access, ...
    (microsoft.public.access.modulesdaovba)
  • Re: File System
    ... When I said SQL CE I was thinking SQL Compact Edition. ... app that takes commands through a socket and sends back results. ... Chris Tacke, Embedded MVP ... database that can be utilised by both a desktop and a mobile ...
    (microsoft.public.dotnet.framework.compactframework)