|
this looks very basic, from this you can start knowing GUID
What is GIUD?[^]
Do your Duty and Don't expect the Result
|
|
|
|
|
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 ;
}
|
|
|
|
|
I use a SCARD_IO_REQUEST structure, this way has been working fine for many year ...
SCARD_IO_REQUEST pio;
if(enScProt_T0 == m_ActiveProtocol)
{ pio.dwProtocol = SCARD_PROTOCOL_T0; }
else if(enScProt_T1 == m_ActiveProtocol)
{ pio.dwProtocol = SCARD_PROTOCOL_T1; }
pio.cbPciLength = sizeof(SCARD_IO_REQUEST);
m_lErrCode = SCardTransmit(m_hScConnect, &pio, pBufTx, LenTx, &pio, pBufRx, &LenRx);
if(SCARD_S_SUCCESS != m_lErrCode) {
CString sT;
sT.Format("Error SCardTransmit (0x%08X). ", m_lErrCode);
m_pDlg->PutMsg(sT, true);
return false;
}
Maxwell Chen
|
|
|
|
|
LOGFONT lf;
memset(&lf, 0, sizeof(lf));
wcscpy(lf.lfFaceName, _T("Lucida Sans Unicode"));
error: cannot comvert parameter 1 from 'char32' to 'wchar_t*'
how can I solve it?
|
|
|
|
|
try this
_tcscpy(lf.lfFaceName, _T("Lucida Sans Unicode"));
nave
|
|
|
|
|
LOGFONT.lfFaceName is declared as TCHAR. TCHAR will work according to your application that is, i think you don't have _UNICODE defined in your application.
If so TCHAR will act as char, wcscpy will expecting WCHAR but you passing char. normal strcpy(..) or _tcscpy(..)
Try this... hope it'll work...
Do your Duty and Don't expect the Result
|
|
|
|
|
See strcpy(m_lf.lfFaceName, "Times New Roman"); for your answer
------------
and see maybe its some helpful to you
<br />
LOGFONT m_lf;<br />
NONCLIENTMETRICS nm;<br />
nm.cbSize = sizeof (NONCLIENTMETRICS);<br />
ZeroMemory ((PVOID) &m_lf,sizeof (LOGFONT));<br />
<br />
SystemParametersInfo(SPI_GETNONCLIENTMETRICS,nm.cbSize,&nm,0); <br />
m_lf = nm.lfMenuFont;<br />
whitesky
|
|
|
|
|
i use this code for creating tooltip what i dont get that
tell me what is the problem
m_tooltip.Create(this);//, TTS_ALWAYSTIP);
m_tooltip.Activate(TRUE);
m_tooltip.AddTool(GetDlgItem(IDC_EDIT1),("this is edit box"),NULL,0);
m_tooltip.SetToolRect(GetDlgItem(IDC_EDIT1),1,CRect(32,32,64,64));
Ashish Dogra
MCA
Noida
|
|
|
|
|
You dont need to a new thread we can see your thread and see my previous thread
whitesky
|
|
|
|
|
i read msdn but still i dont get tootip
Ashish Dogra
MCA
Noida
|
|
|
|
|
|
i do this msdn but still dont get tool tip
can u tellme
Ashish Dogra
MCA
Noida
|
|
|
|
|
See
<code>
m_Tool.Create(this);
m_Tool.AddTool(GetDlgItem(IDC_BUTTON1),"Is this a test");
m_Tool.Activate(true);
BOOL CAnswerDlg::PreTranslateMessage(MSG* pMsg)
{
if (m_Tool)
m_Tool.RelayEvent(pMsg);
return CDialog::PreTranslateMessage(pMsg);
}
</code>
whitesky
|
|
|
|
|
Hi,
I try to source for icons for programming window applications in
google, but the results are noisy and I just find one or two
icon suites. Anyone knows any good websites for software icons ?
Thanks
|
|
|
|
|
Search for iconizer. And preferably ask it such things in the lounge or even soapbox. This is the c++ programming message board.
|
|
|
|
|
www.iconbazaar.com[^]
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
hi i want to create a tooltip
so i use m_tool that is CToolTipCtrl member variable
then i use m_tool.Create(this,TTS_ALWAYSTIP);
m_tool.AddTool(pWnd,_T("this is window"),NULL,0);
but no tool tip is created on anything as i want to create it on window as well as any control
thanks
Ashish Dogra
MCA
Noida
|
|
|
|
|
overide the PreTranslateMessage() funtion in that funtion call m_tool.RelayEvent(..) function
nave
|
|
|
|
|
THANKS FOR REPLY can u tell me pMsg is pointer what i can write
WAT CAN YOU TELL ME THAT WHAT ARE PARAMETERS OF RELAY EVENT
AND AFTER THIS I NEED TO WRITE CODE IN ONINITDIALOG FUNCTION
Ashish Dogra
MCA
Noida
-- modified at 1:57 Monday 17th July, 2006
|
|
|
|
|
Hi i saw you asking code for all the questions.
And many people told you to have a look at MSDN first.
After getting the API you need, check its parameter and the way how it can be used in MSDN.
Refer here[^]
Do your Duty and Don't expect the Result
|
|
|
|
|
Do you know, Why all the people want you to search MSDN ?
Its simple, then only you can learn MFC and also other persons help won't work all the time.
If you search by yourself it won't forget and you may come across various other API and techniques. It might not be the thing u want, but it'll be helpful in the future and to know MFC.
If you depend on other persons, you can make your thing to work but u will forget it as quickly as possible and you'll not know the working technique behind it.
'www.msdn.microsoft.com' is the msdn site and use the search facility in it.
Do your Duty and Don't expect the Result
|
|
|
|
|
|
how to close all child windows in MDI?
like the VC->windows->Close All command
|
|
|
|
|
EnumChildWindows maybe helpful.
life is like a box of chocolate,you never know what you r going to get.
|
|
|
|
|
CMDIChildWnd *pMDIActive;
while( pMDIActive = MDIGetActive() )
{
pMDIActive->SendMessage(WM_CLOSE);
}
Regards,
Ram
|
|
|
|