Click here to Skip to main content
15,905,229 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How do I count CPU cores? Pin
Mike O'Neill19-Jul-06 15:48
Mike O'Neill19-Jul-06 15:48 
GeneralRe: How do I count CPU cores? [modified] Pin
khb19-Jul-06 22:47
khb19-Jul-06 22:47 
QuestionCatching events from a dynamically loaded html in CHtmlView [modified] Pin
georgekjolly16-Jul-06 21:25
georgekjolly16-Jul-06 21:25 
AnswerRe: Catching events from a dynamically loaded html in CHtmlView Pin
Abhi Lahare16-Jul-06 22:50
Abhi Lahare16-Jul-06 22:50 
QuestionGUIDGen.exe utility Pin
Anu_Bala16-Jul-06 21:06
Anu_Bala16-Jul-06 21:06 
AnswerRe: GUIDGen.exe utility Pin
Sarath C16-Jul-06 21:41
Sarath C16-Jul-06 21:41 
AnswerRe: GUIDGen.exe utility Pin
Parthi_Appu16-Jul-06 21:44
Parthi_Appu16-Jul-06 21:44 
QuestionSCardTransmit problem Pin
black falcon16-Jul-06 21:01
black falcon16-Jul-06 21:01 
I'm trying to write a little test app to communicate with a smart card (using a GempPC Twin reader). program runs successfully until SCardTransmit function (SCardEstablishContext, SCardListReaders and SCardConnect functions return SCARD_S_SUCCESS and my card handle is 0xEA010000). this function returns 14 and does not execute.
this value is not in the "Smart Card Return Values" list in the msdn and therefor i do not have any idea for solve this problem. plealse helpe me.
my source code:
CString strReaderName ;
DWORD dwResult ;
DWORD dwReaderNameLen ;
DWORD dwProtocol;
LPSTR szListReaders = NULL;
LPTSTR szSCReader = NULL;
BYTE ATR[30] ;
DWORD ATRLen,dwState ;
byte command[] = { 0x80, 0xA4, 0x00, 0x00, 0x02, 0xFF, 0x02 };
BYTE pbRecvBuffer[500] ;
DWORD pcbRecvLength ;

dwResult=SCardEstablishContext(SCARD_SCOPE_SYSTEM,NULL,NULL,&m_hContext) ;
if(dwResult!=SCARD_S_SUCCESS)
{
AnalizeResult(dwResult);// selects a value from "Smart Card Return Values"
return ;
}
dwResult=SCardListReaders(m_hContext,NULL,NULL,&dwReaderNameLen);
if(dwResult != SCARD_S_SUCCESS)
{
AnalizeResult(dwResult);// selects a value from "Smart Card Return Values"
return;
}
szListReaders = (char*) malloc(dwReaderNameLen);
dwResult = SCardListReaders(m_hContext,NULL,(LPTSTR)szListReaders,&dwReaderNameLen);
if (dwResult != SCARD_S_SUCCESS)
{
AnalizeResult(dwResult);// selects a value from "Smart Card Return Values"
return;
}
szSCReader = (LPTSTR) szListReaders;
if(!szSCReader || *(szSCReader) =='\0')
{
if(szListReaders) free(szListReaders);
dwResult = SCardReleaseContext(m_hContext);
MessageBox("No readers present!");
return;
}
dwResult=SCardConnect(m_hContext,szSCReader,SCARD_SHARE_SHARED,SCARD_PROTOCOL_T0,&m_hCard,&dwProtocol) ;
if(dwResult!=SCARD_S_SUCCESS)
{
AnalizeResult(dwResult); // selects a value from "Smart Card Return Values"
return ;
}
dwResult=SCardStatus(m_hCard,(LPTSTR)szListReaders,&dwReaderNameLen,&dwState,&dwProtocol,ATR,&ATRLen) ;
if(dwResult!=SCARD_S_SUCCESS)
{
AnalizeResult(dwResult); // selects a value from "Smart Card Return Values"
return ;
}
MessageBox(szSCReader) ;
switch ( dwState )
{
case SCARD_ABSENT:
MessageBox("Card absent.");
break;
case SCARD_PRESENT:
MessageBox("Card present.");
break;
case SCARD_SWALLOWED:
MessageBox("Card swallowed.");
break;
case SCARD_POWERED:
MessageBox("Card has power.");
break;
case SCARD_NEGOTIABLE:
MessageBox("Card reset and waiting PTS negotiation.");
break;
case SCARD_SPECIFIC:
MessageBox("Card has specific communication protocols set.");
break;
default:
MessageBox("Unknown or unexpected card state.");
break;
}
dwResult=SCardTransmit(m_hCard,SCARD_PCI_T0,command,7,&pioRecvPci,pbRecvBuffer,&pcbRecvLength) ;
if(dwResult!=SCARD_S_SUCCESS)
{
AnalizeResult(dwResult); // selects a value from "Smart Card Return Values"
return ;
}

AnswerRe: SCardTransmit problem Pin
Maxwell Chen16-Jul-06 23:27
Maxwell Chen16-Jul-06 23:27 
QuestionERROR??? Pin
mimimimilaw16-Jul-06 20:15
mimimimilaw16-Jul-06 20:15 
AnswerRe: ERROR??? Pin
Naveen16-Jul-06 20:24
Naveen16-Jul-06 20:24 
AnswerRe: ERROR??? Pin
Parthi_Appu16-Jul-06 20:27
Parthi_Appu16-Jul-06 20:27 
AnswerRe: ERROR??? Pin
Hamid_RT16-Jul-06 20:37
Hamid_RT16-Jul-06 20:37 
Questionm_tooltip.Create(this) Pin
ashish dogra16-Jul-06 20:13
ashish dogra16-Jul-06 20:13 
AnswerRe: m_tooltip.Create(this) Pin
Hamid_RT16-Jul-06 20:31
Hamid_RT16-Jul-06 20:31 
AnswerRe: m_tooltip.Create(this) Pin
ashish dogra16-Jul-06 21:12
ashish dogra16-Jul-06 21:12 
GeneralRe: m_tooltip.Create(this) Pin
Hamid_RT16-Jul-06 21:27
Hamid_RT16-Jul-06 21:27 
GeneralRe: m_tooltip.Create(this) Pin
ashish dogra16-Jul-06 22:40
ashish dogra16-Jul-06 22:40 
GeneralRe: m_tooltip.Create(this) Pin
Hamid_RT17-Jul-06 0:58
Hamid_RT17-Jul-06 0:58 
QuestionAny icons for window app ? Pin
Kim061816-Jul-06 19:40
Kim061816-Jul-06 19:40 
AnswerRe: Any icons for window app ? Pin
<color>Aljechin 16-Jul-06 19:46
<color>Aljechin 16-Jul-06 19:46 
AnswerRe: Any icons for window app ? Pin
David Crow17-Jul-06 3:13
David Crow17-Jul-06 3:13 
Questiontooltipcontrol Pin
ashish dogra16-Jul-06 19:08
ashish dogra16-Jul-06 19:08 
AnswerRe: tooltipcontrol Pin
Naveen16-Jul-06 19:14
Naveen16-Jul-06 19:14 
GeneralRe: tooltipcontrol [modified] Pin
ashish dogra16-Jul-06 19:28
ashish dogra16-Jul-06 19:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.