|
Error!!!
Error 1 error C3861: 'getche': identifier not found e:\visual programming\practices\test\test\test.cpp 13 test<br />
Mohsin Ali
|
|
|
|
|
to use getche() you will have to use #include <conio.h>
by the way you should choose second option.
|
|
|
|
|
Thx its done.............
Bingoo!
Mohsin Ali
modified on Tuesday, June 3, 2008 9:10 AM
|
|
|
|
|
|
Hi all,
I want to find the working mode of the Visual Studio 2003 at run time. I mean on a debug mode I want to use some commands on the console. But they are not allowed to use in release mode.
How can I do it.
Hope it's clear to you.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
CodingLover wrote: I mean on a debug mode I want to use some commands on the console. But they are not allowed to use in release mode.
#define DEBUG
. . .
#ifdef DEBUG
. . .
#endif
Now the code that you don't want to execute in the release mode goes in the above section.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
|
Thanks for all replays.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
I have one question here.
I've call a function with a command in the console. Say by test
I want to add some parameters too, something like this.
test one two
What is the easiest way to get those values.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
CodingLover wrote: What is the easiest way to get those values.
Are you asking about command line parameters? If so use GetCommandLine function.
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Yes, I've explain it in wrong way. I'll say it in this way.
Say my command parameter is text 0xAF 150
I want to get each of them as it is, mean a string, a DWORD and a int. Then pass each as command line parameters. What I'm looking is how to separate those values in standard C++
I appreciate your help all the time...
CodingLover
|
|
|
|
|
int main(int argc, char *argv[])
{
for (int i = 1; i < argc; i++) {
cout << argv[i] << " "; //argv[i] has separated command line params
}
cout << endl;
}
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
But how it's separated. According to my command, how can I separate them.
At the time just forget the command line concept. Because I do all those things in different classes and in different stages.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Your question still makes no sense.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Ok sir, just forget about command line parameters and stuff.
I have a string text 0xAF 150
I want to separate them as a string, as a DWORD and as an int value respectively. How can I do it.
Hope it's clear now
I appreciate your help all the time...
CodingLover
|
|
|
|
|
If you are using MFC, check out AfxExtractSubString() . Otherwise, strtok() is an option.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi All,
How can I create a process with system level privilege?
Best Regards,
AJ
|
|
|
|
|
Hope this will work.
Call CreateProcess with fdwCreate flag as DEBUG_PROCESS.
akt
|
|
|
|
|
Does CreateProcessAsUser helpful?
|
|
|
|
|
I'm trying to post data from c++ code to my webservice, all works fine untill i throw in a slow network and dial-up connection. I then get a "The operation timed out" error, it always happens at exactly 30seconds, the fault is not at the webservive, his 5minute timeout is working. If someone could please just take a quick look at the code and tell me where i might have missed something.
This is my attempt to disable the timer, the value i put in appear to have no effect:
CInternetSession mySession(NULL, 1, PRE_CONFIG_INTERNET_ACCESS, NULL,
NULL, 0);
CHttpConnection *pHttpConnection;
CHttpFile *pHttpFile;
CString szServerUrl, szObject;
CString strHeaders = _T("Content-Type: application/x-www-form-urlencoded");
mySession.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT,0xFFFFFFFF,0);
Here is the complete code for anyone who might be interrested, it's taken from another project here on CodeProject, but I can't seem to locate it again:
DWORD Post(CString url, CString szFormData, CString & resultString)
{
CInternetSession mySession(NULL, 1, PRE_CONFIG_INTERNET_ACCESS, NULL,
NULL, 0);
CHttpConnection *pHttpConnection;
CHttpFile *pHttpFile;
CString szServerUrl, szObject;
CString strHeaders = _T("Content-Type: application/x-www-form-urlencoded");
mySession.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT,0xFFFFFFFF,0);
szServerUrl = url;
ExtractObject(szServerUrl,szObject);
try
{
pHttpConnection = mySession.GetHttpConnection(szServerUrl);
if( NULL == pHttpConnection)
{
return WEB_ACCESS_UNEXPECTED_ERROR;
}
}
catch (CInternetException *pException)
{
char buffer[1023];
pException->GetErrorMessage(buffer, 1023);
resultString = buffer;
return pException->m_dwError;
}
try {
pHttpFile = pHttpConnection->OpenRequest(CHttpConnection::HTTP_VERB_POST, szObject);
if(NULL == pHttpFile)
{
return WEB_ACCESS_UNEXPECTED_ERROR;
}
}
catch(CInternetException *pException)
{
char buffer[1023];
pException->GetErrorMessage(buffer, 1023);
resultString = buffer;
return pException->m_dwError;
}
try {
BOOL ret = pHttpFile->SendRequest(strHeaders, (LPVOID)(LPCSTR)szFormData, szFormData.GetLength());
if( FALSE == ret )
{
return WEB_ACCESS_UNEXPECTED_ERROR;
}
}
catch(CInternetException *pException)
{
char buffer[1023];
pException->GetErrorMessage(buffer, 1023);
resultString = buffer;
return pException->m_dwError;
}
DWORD retCode;
BOOL ret = pHttpFile->QueryInfoStatusCode(retCode);
if( FALSE == ret )
{
return WEB_ACCESS_QUERY_INFO_ERROR;
}
else if( HTTP_STATUS_OK != retCode )
{
return retCode;
}
char buf[2];
int bytesRead;
resultString = "";
while( (bytesRead = pHttpFile->Read(buf, 1)) > 0 )
{
resultString += buf[0];
}
return WEB_ACCESS_DONE;
}
|
|
|
|
|
I've been struggling with this for days and as soon as i post i found a solution.
In any case, it seems i've been setting the wrong timer, this fixed the problem:
mySession.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT,50000);
mySession.SetOption(INTERNET_OPTION_CONNECT_RETRIES, 3);
mySession.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 50000);
mySession.SetOption(INTERNET_OPTION_DATA_RECEIVE_TIMEOUT,50000);
mySession.SetOption(INTERNET_OPTION_RECEIVE_TIMEOUT,50000);
mySession.SetOption(INTERNET_OPTION_DATA_SEND_TIMEOUT, 50000);
mySession.SetOption(INTERNET_OPTION_SEND_TIMEOUT, 50000);
|
|
|
|
|
I Want to convert char array into LPCTSTR ,std::string to LPCTSTR and DWORD to LPCTSTR
can any body help me to solve this.
|
|
|
|
|
Try the search box above with "string conversion". This is a task of learning to read code and documentation.
Greetings from Germany
|
|
|
|
|
Member 4620216 wrote: convert char array into LPCTSTR
If its UNICODE is defined, the LPCTSTR will expand as const wchar_t*. So you've to convert the char* to wchar_t* by using A2W macro. If its not UNICODE, then LPCTSTR is const char* and you can directly assign it. See the code block.
#ifdef UNICODE
#else
#endif
Member 4620216 wrote: std::string to LPCTSTR
call string.c_str() function.
Member 4620216 wrote: DWORD to LPCTSTR
Since DWORD is unsigned long , _ultot() can be used.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Hello all,
I am facing a critical issue. I have my executable at server side which user downloads. User is able to download. Now i want that application to execute itself rather than forcing user to go to downloaded location and execute it. So how would i accomplish this? Is there any way on server side that run downloaded executable on client machine.?? I mean script or something??
Please help me out. Any help would be greatly appreciated.
Thanks & Regards,
Hemang
|
|
|
|