Sign in to follow this  
my530

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

Recommended Posts

my530    0

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

MoDaCo is part of the MoDaCo.network, © Paul O'Brien 2002-2016. MoDaCo uses IntelliTxt technology.