Jump to content


Photo

Failed to call SimWriteMessage() API, return 0x80070057,Help me!

- - - - -

  • Please log in to reply
No replies to this topic

#1
my530

my530

    Newbie

  • Members
  • Pip
  • 1 posts
  • Devices:null
code:

HSIM hSim ;
SIMMESSAGE mSimMessage;
DWORD dwUsed;
DWORD dwTotal;
HRESULT result;
TCHAR buffer[255];

if ( SimInitialize(0,0,0,&hSim) != S_OK) return ;//SimInitialize error

result = SimGetSmsStorageStatus(hSim,SIM_SMSSTORAGE_SIM,&dwUsed,&dwTotal);

if (result != S_OK)
{
//wsprintf(buffer,L"GetStatus err:%0x",result);
return;
}

memset(&mSimMessage,0,sizeof(SIMMESSAGE));
mSimMessage.cbSize = sizeof(SIMMESSAGE);
mSimMessage.dwParams = 79;
mSimMessage.dwAddressType = SIM_ADDRTYPE_NATIONAL;
mSimMessage.dwNumPlan = SIM_NUMPLAN_TELEPHONE;
memcpy(&(mSimMessage.stReceiveTime),&st,sizeof(SYSTEMTIME));
wcscpy(mSimMessage.lpszAddress,L"13328788888");
wcscpy(mSimMessage.lpszMessage,L"Hello!WangYongCheng");

CCListBox *pListBoxMsg=(CCListBox *)GetDlgItem(IDC_LIST_MSG);

pListBoxMsg->ResetContent();

for(nIndex=1;nIndex<=dwTotal;nIndex++)
{
result = SimWriteMessage(hSim,SIM_SMSSTORAGE_SIM,&nIndex,&mSimMessage);

if (result != S_OK)
{
wsprintf(buffer,L"(%d)WriteMsg Err:%0x",nIndex,result);
}
else
{
wsprintf(buffer,L"(%d)WriteMsg OK",nIndex);
}
pListBoxMsg->AddString(buffer);
}
SimDeinitialize(hSim);
------
other related APIs such as SimDeleteMessage(), SimReadMessage() work very well.

Edited by my530, 28 November 2006 - 02:12 AM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users