|
You can look here[^], or, here[^], or, if you write me an email, I can send you a excel class, packed into demo VC6 project, which show you how to use this class ...
|
|
|
|
|
|
A csv file is nothing other than having values separated by a ,
So, in essence if you create a simple .txt file which contains values separated by a comma operator, the file should open quite happily in Excel.
Steps:
1. From your code create a file ABC.csv
2. Put values in the file as 1,2,3.... and so on
3. Save the file from your code.
4. Open excel and you should see the correct contents in the format you wished.
You talk about Being HUMAN. I have it in my name
AnsHUMAN
|
|
|
|
|
Can you help me convert the code VB6 below to VC++ 6.
'Code VB6 - Class
Private Declare Function CheckCode Lib "ArmAccess.DLL" (ByVal Name$, ByVal Code$) As Byte
'@@@@@@@@@@@@@@@@@@@@@@@@
Public Function checkRegCode(ByVal userName As String, ByVal RegistrationKey As String) As Integer
Dim rtn As Byte
rtn = CheckCode(userName, RegistrationKey)
If rtn <> 0 Then
checkRegCode = 1
Else
checkRegCode = 0
End If
End Function
|
|
|
|
|
Here's a rough draft:
#include <whatever_header_file_CheckCode_is_in>
int checkRegCode(...)
{
if (CheckCode(...) != 0)
return 1;
else
return 0;
}
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
modified 17-Feb-13 21:35pm.
|
|
|
|
|
I do apologise if this question is in the wrong place, I was split between html and c++, but since the code I'm referring to is c I chose here.
I downloaded a wrapper of winhttp from the site here at codeproject.
A Simple Windows HTTP Wrapper Using C++[^]
It works fantastically on the likes of google, or microsoft webpages but not on my own.
My page is simple
<html>
<body>
some text
</body>
</html>
but the code I linked just hangs in the console window.
Is there some sort of addition I need to add to the code or my page to have it respond correctly?
Appreciate any input.
(edit) sorry, all the code does is download the content of the page (source) so all I would be expecting to see in console window is "some text"
|
|
|
|
|
If the problem is specific to some code in an article, then you should try posting in the forum at the end of the article, so the author can help you.
|
|
|
|
|
|
I am not looking for “cool “ ready to run UI , but like to get some ideas from someone who done something similar to this.
I have a standard MFC document / view application using static Csplitter ( 6 views for now ) “embeded “ in standard CtabCtrl.
Like to be able to use the tabs to switch between splitter panes. So the UI would start in splitter mode first and then the user should be able to get full view of selected pane using tabs. I got as far as getting the correct pane / view but not sure how to get that info to “translate” to splitter pane column / row.
Any suggestions would be greatly appreciated.
Thanks for your time.
Cheers
Vaclav
|
|
|
|
|
// My first calculator//Abhi's calculator//
#include <iostream>
using namespace std;
float division (float a, float b)
{
float a1;
a1=a/b;
return (a1);
}
float multiplication (float c, float d)
{
int a2;
a2=c*d;
return (a2);
}
float addition(float e, float f)
{
int a3;
a3=e+f;
return(a3);
}
float subtraction(float g, float h)
{
int a4;
a4=g-h;
return(a4);
}
int main()
{
char user;
float ab;
float da;
float ans;
cout<<endl<<"welcome to="" abhi's="" calculator!"<<endl<<endl;
="" cout<<"(d)="Division(%)"<<endl;
" cout<<"(m)="Multiplication(*)"<<endl;
" cout<<"(a)="Addition(+)"<<endl;
" cout<<"(s)="Subtraction(-)"<<endl<<endl;
" cout<<"if="" you="" want="" division="" then="" press="" d="" or="" -="">"<<endl;
cout<<"if="" you="" want="" multiplication="" then="" press="" m="" or="" -="">"<<endl;
cout<<"if="" you="" want="" additionthen="" then="" press="" a="" or="" -="">"<<endl;
cout<<"if="" you="" want="" subtration="" then="" press="" s="" or="" -="">"<<endl<<endl;
cout<<"choose="" any="" one="" -="">"<<endl<<endl;
cin="">>user;
if (user == 'D' || user == 'd')
{
cout<<endl<<endl<<"what two="" numbers="" would="" you="" like="" to="" divide="" -="">"<<endl<<endl;
cout<<"enter="" 1st="" number="" -="">"<<endl;
cin="">>ab;
cout<<"Enter 2nd number ->"<<endl;
cin="">>da;
ans = division (ab,da);
cout<<"Answer is -> "<<ans;
}
="" if="" (user="=" 'm'="" ||="" user="=" 'm')
="" {
="" cout<<endl<<endl<<"what="" two="" numbers="" would="" you="" like="" to="" multiply="" -="">"<<endl<<endl;
cout<<"enter="" 1st="" number="" -="">"<<endl;
cin="">>ab;
cout<<"Enter 2nd number ->"<<endl;
cin="">>da;
ans = multiplication (ab,da);
cout<<"Answer is -> "<<ans;
}
="" if="" (user="=" 'a'="" ||="" user="=" 'a')
="" {
="" cout<<endl<<endl<<"what="" two="" numbers="" would="" you="" like="" to="" add="" -="">"<<endl<<endl;
cout<<"enter="" 1st="" number="" -="">"<<endl;
cin="">>ab;
cout<<"Enter 2nd number ->"<<endl;
cin="">>da;
ans = addition (ab,da);
cout<<"Answer is -> "<<ans;
}
="" if(user="=" 's'="" ||="" user="=" 's')
="" {
="" cout<<endl<<endl<<"what="" two="" numbers="" would="" you="" like="" to="" subtract="" -="">"<<endl<<endl;
cout<<"enter="" 1st="" number="" -="">"<<endl;
cin="">>ab;
cout<<"Enter 2nd number ->"<<endl;
cin="">>da;
ans = subtraction (ab,da);
cout<<"Answer is -> "<<ans;
}
="" cout<<endl<<"do="" you="" want="" to="" continue"<<endl<<endl;
="" {
="" char="" a;
="" cout<<"yes="" !="" -=""> press Y or y for yes"<<endl<<endl;
cout<<"no="" !="" -=""> press N or n for no"<<endl<<endl;
cin="">>a;
if(a=='y' || a=='Y')
{
main();
}
else if(a=='N' || a=='n')
{
cout<
|
|
|
|
|
what is this? why you post this code here?
|
|
|
|
|
What's the question?
If you want to share this calculator, then write a tip or an article:
Code Project Article FAQ[^]
In some cases, my signature will be longer than my message...
<em style="color:red"> <b>ProgramFOX</b></em> ProgramFOX
|
|
|
|
|
what's your question ?
warning ?
|
|
|
|
|
Hi all,
on higher resolution or large DPI the dialog box of my application is not fully visible.
i want to add the auto scroll option for higer resolution in my dialog box,so the dialog is accessible and fully visible.
pleae help me how can i do this thanks in advance.
|
|
|
|
|
Modify your dialog! You really need to provide some proper information if you expect a sensible response to this question. However, if you have a dialog that is too big for the screen you may need to rethink what you are using it for.
|
|
|
|
|
the dialog is not too big and its display normal and properly for normal screen resolution and DPI.
|
|
|
|
|
Check here, I hope to use.
modified 18-Feb-13 2:39am.
|
|
|
|
|
I need to send a client certificate with a web request (via SSL). This client cert is just a public key. I am trying to replicate the Request.ClientCertificates.Add(Cert); .NET method using C++/WinHTTP. I am loading the .cer file successfully and setting the CERT_CONTEXT via WinHttpSetOption/WINHTTP_OPTION_CLIENT_CERT_CONTEXT. This call succeeds, but when I call WinHttpSendRequest, it fails with ERROR_WINHTTP_CLIENT_CERT_NO_PRIVATE_KEY (12185).
So, the question is, how do I send a client cert public key to the server, as the ClientCertificates.Add method does in .NET? Code snippet sample below:
BOOL HTTPCallEx::SendHTTPRequest(int iVerb , LPCTSTR cpUID , LPCTSTR cpPWD )
{
WCHAR wcaVerb[16];
WCHAR wcaResource[1024];
m_dwLastError = 0;
switch (iVerb)
{
case HTTPCALL_POST:
lstrcpyW(wcaVerb,L"POST");
break;
case HTTPCALL_HEAD:
lstrcpyW(wcaVerb,L"HEAD");
break;
case HTTPCALL_PUT:
lstrcpyW(wcaVerb,L"PUT");
break;
case HTTPCALL_DELETE:
lstrcpyW(wcaVerb,L"DELETE");
break;
case HTTPCALL_OPTIONS:
lstrcpyW(wcaVerb,L"OPTIONS");
break;
case HTTPCALL_TRACE:
lstrcpyW(wcaVerb,L"TRACE");
break;
case HTTPCALL_CONNECT:
lstrcpyW(wcaVerb,L"CONNECT");
break;
case HTTPCALL_GET:
default:
lstrcpyW(wcaVerb,L"GET");
break;
}
#ifdef UNICODE
_tcscpy(wcaResource,m_caResource);
#else
MultiByteToWideChar(CP_UTF8,0,m_caResource,-1,wcaResource,1024);
#endif
m_hRequest = WinHttpOpenRequest(m_hConnect,wcaVerb,wcaResource,NULL,WINHTTP_NO_REFERER,WINHTTP_DEFAULT_ACCEPT_TYPES,(m_bSSL ? WINHTTP_FLAG_SECURE : 0));
if (!m_hRequest)
{
m_dwLastError = ::GetLastError();
return FALSE;
}
if (cpUID && *cpUID)
{
WCHAR wcaUID[512];
WCHAR wcaPWD[512];
#ifdef UNICODE
_tcscpy(wcaUID,cpUID);
#else
MultiByteToWideChar(CP_UTF8,0,cpUID,-1,wcaUID,512);
#endif
if (cpPWD && *cpPWD)
#ifdef UNICODE
_tcscpy(wcaPWD,cpPWD);
#else
MultiByteToWideChar(CP_UTF8,0,cpPWD,-1,wcaPWD,512);
#endif
else
wcaPWD[0] = 0;
if (!WinHttpSetCredentials(m_hRequest,
WINHTTP_AUTH_TARGET_SERVER,
WINHTTP_AUTH_SCHEME_BASIC,
wcaUID,
wcaPWD,
NULL))
{
m_dwLastError = ::GetLastError();
return FALSE;
}
}
if (m_dwRequestTimeout)
{
if (!WinHttpSetOption(m_hRequest,WINHTTP_OPTION_RECEIVE_TIMEOUT,&m_dwRequestTimeout,sizeof(m_dwRequestTimeout)))
{
m_dwLastError = ::GetLastError();
return FALSE;
}
}
if (m_pCertCtxt)
{
DWORD dwFlags = SECURITY_FLAG_IGNORE_CERT_CN_INVALID |
SECURITY_FLAG_IGNORE_CERT_DATE_INVALID |
SECURITY_FLAG_IGNORE_UNKNOWN_CA |
SECURITY_FLAG_IGNORE_CERT_WRONG_USAGE;
WinHttpSetOption(m_hRequest,WINHTTP_OPTION_SECURITY_FLAGS,&dwFlags,sizeof(dwFlags));
if (!WinHttpSetOption(m_hRequest,WINHTTP_OPTION_CLIENT_CERT_CONTEXT,(void *)m_pCertCtxt,sizeof(CERT_CONTEXT)))
{
if (m_pCertCtxt)
m_dwLastError = ::GetLastError();
else
m_dwLastError = 50000;
return FALSE;
}
}
if (m_oCustomHeaders.GetSize() > 0)
{
CString cHeader;
WCHAR wcaHeaderBuf[2048];
for (int iLup = 0; iLup < m_oCustomHeaders.GetSize(); iLup++)
{
cHeader = m_oCustomHeaders.GetAt(iLup);
#ifdef UNICODE
_tcscpy(wcaHeaderBuf,(LPCTSTR)cHeader);
#else
MultiByteToWideChar(CP_UTF8,0,(LPCSTR)cHeader,-1,wcaHeaderBuf,2048);
#endif
WinHttpAddRequestHeaders(m_hRequest,wcaHeaderBuf,lstrlenW(wcaHeaderBuf),WINHTTP_ADDREQ_FLAG_ADD);
}
}
DWORD dwContentLength = 0;
if ((iVerb == HTTPCALL_POST || iVerb == HTTPCALL_PUT) && m_cpPostData)
{
if (m_iPostDataLen < 0)
dwContentLength = (DWORD)strlen(m_cpPostData);
else
dwContentLength = (DWORD)m_iPostDataLen;
}
if (!WinHttpSendRequest(m_hRequest,WINHTTP_NO_ADDITIONAL_HEADERS,NULL,(LPVOID)(m_cpPostData ? m_cpPostData : ""),dwContentLength,dwContentLength,0))
{
>>>>> THIS FAILS HERE WITH ERROR_WINHTTP_CLIENT_CERT_NO_PRIVATE_KEY (12185)
m_dwLastError = ::GetLastError();
return FALSE;
}
if (!WinHttpReceiveResponse(m_hRequest,NULL))
{
m_dwLastError = ::GetLastError();
return FALSE;
}
TCHAR caBuf[81];
caBuf[0] = 0;
int iBufSize = sizeof(caBuf)/sizeof(TCHAR);
if (!GetStandardHeader(WINHTTP_QUERY_STATUS_CODE,caBuf,&iBufSize))
{
m_dwLastError = ::GetLastError();
return FALSE;
}
m_dwHTTPStatus = _ttol(caBuf);
caBuf[0] = 0;
iBufSize = sizeof(caBuf)/sizeof(TCHAR);
if (!GetStandardHeader(WINHTTP_QUERY_CONTENT_LENGTH,caBuf,&iBufSize)) m_dwContentLength = 0;
else
m_dwContentLength = _ttol(caBuf);
return TRUE;
}
As usual, this is on a deadline, so any help is greatly appreciated! Certificate loading is shown below:
BOOL LoadCertificate(ApplicationInstance *pAppInst)
{
BOOL bRetval = FALSE;
int iThreadCount = (int)pAppInst->m_pLightningServer->m_wNumWorkerThreads;
TCHAR caCertFilePath[256];
caCertFilePath[0] = 0;
if (!pAppInst->GetUserTagValue(_T("CertFilePath"),caCertFilePath,sizeof(caCertFilePath)/sizeof(TCHAR)))
_tcscpy(caCertFilePath,_T("c:\\webapps\\test.cer"));
theApp.m_hStore = CertOpenStore(CERT_STORE_PROV_FILENAME,
X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
NULL,
CERT_STORE_OPEN_EXISTING_FLAG | CERT_STORE_READONLY_FLAG,
caCertFilePath);
if (theApp.m_hStore)
{
PCCERT_CONTEXT *pCertList = new (PCCERT_CONTEXT[iThreadCount]);
if (pCertList)
{
for (int iCert = 0; iCert < iThreadCount; iCert++)
pCertList[iCert] = NULL;
pAppInst->SetUserPtr((void *)pCertList);
PCCERT_CONTEXT pCertCtxt = CertFindCertificateInStore(theApp.m_hStore,
X509_ASN_ENCODING,
0,
CERT_FIND_SUBJECT_STR,
(LPVOID)_T("test.myserver.com"), NULL );
if (pCertCtxt)
{
pCertList[0] = pCertCtxt;
for (int iLup = 1; iLup < iThreadCount; iLup++)
pCertList[iLup] = CertDuplicateCertificateContext(pCertCtxt);
bRetval = TRUE;
}
else
{
pAppInst->m_pLightningServer->WriteErrorLog(-3,_T("APPINIT: Error Getting CERT_CONTEXT From Store"),caCertFilePath,NULL,FALSE);
}
}
else
{
pAppInst->m_pLightningServer->WriteErrorLog(-2,_T("APPINIT: Error MemAlloc CERT_CONTEXT Array"),NULL,NULL,FALSE);
}
}
else
{
DWORD dwError = GetLastError();
TCHAR caErrBuf[1024];
_stprintf(caErrBuf,_T("APPINIT: Error Opening Cert Store [%d]..."),dwError);
::FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
dwError,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
caErrBuf+_tcslen(caErrBuf),
sizeof(caErrBuf)/sizeof(TCHAR)-40,
NULL);
pAppInst->m_pLightningServer->WriteErrorLog(-1,caErrBuf,caCertFilePath,NULL,FALSE);
}
return bRetval;
}
onwards and upwards...
|
|
|
|
|
) If two dice are rolled. what is the probability of getting (1, 2), or (2, 3) and so on. We can answer
these questions analytically, but you need to write a code to verify the results. You can do that
following the steps:
a. Write a function rollDices that takes two parameters as output parameters (return values through
them). The function when called should return two random integers, each one between 1 and 6,
where each one represent the value of a rolled die.
Use the following code to generate a random number between a and b. We seed the random
number generator using srand function as shown below.#include <time.h>
#include <stdlib.h>
using namespace std;
//... you other functions ...
int main () {
// seed random number generator
srand ( time(NULL) );
// your other code here
// generate a random number between 1 and 10
int randomNumber = rand() % 10 + 1;
}
b. Write another function rollProb that takes a two dimensional array 6x6 and an integer
numberOfRolls. The function should call the rollDices function numberOfRolls times, and for
each call it should increment the corresponding cell in the array.
c. Your main program should prompt the user for the numberOfRolls and calls the function rollProb
and then prints the probability of obtaining each pair of values. Try it with 4 different number of
rolls: 100, 1000, 10000, 100000. I will explain it more in class.
|
|
|
|
|
Is it urgentz?
Really though, please see here[^] especially point #11.
|
|
|
|
|
Haiathem alhmoud wrote: ) If two dice are rolled. what is the probability of getting (1, 2), or (2, 3) and so on. 1/6 * 1/6
Haiathem alhmoud wrote: I will explain it more in class. So, what happened?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
I am trying to find a list of ‘affected’ API in Windows 8.
Microsoft used to release a file called Win32Api.Csv that would summarize every function call changed in a new version of the OS.
I am looking for something similar for Windows 8.
I don't necessarily need the 'new functions' list, I have seen that already.
I am concerned we make function calls in our existing products that will be 'broken' in some manner in Windows 8. For example, we have already run into some
FindWindow failures.
Sigh.... so many Windows OS versions, so little time …
|
|
|
|
|
Maybe you should look on Microsoft's Windows 8 web pages.
|
|
|
|
|
I'm working with a code that I found online. After I resolved all the errors I tried to run the program, but it keeps giving me an unhandled exception.
1>httpsink.obj : error LNK2001: unresolved external symbol _IID_IXMLHTTPRequest
1>httpsink.obj : error LNK2001: unresolved external symbol _CLSID_XMLHTTP30
1>uafxcw.lib(appcore.obj) : error LNK2001: unresolved external symbol ___wargv
1>uafxcw.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argc
1>MSVCRT.lib(crtexew.obj) : error LNK2001: unresolved external symbol _WinMain@16
1>C:\Users\ABC\Documents\Visual Studio 2008\Projects\httpsink\Release\httpsink.exe : fatal error LNK1120: 5 unresolved externals
Any help is welcome.
|
|
|
|
|
Those are not exceptions, they are linker messages, telling you that you have some missing library references. The first two are references to the MSXML[^] library. If you do not have it installed then you need to download it using the foregoing link. The remaining three suggest that you don't have a WinMain() [^] function in your code. However, it may well be that the code is incomplete, and you should check with the person who wrote it.
|
|
|
|
|