|
I have a question.
This is the way I connect to the file through http
CHttpFile *pHttpFile = (CHttpFile *)InternetSession.OpenURL(LPTHD->from,INTERNET_FLAG_TRANSFER_BINARY | INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_RELOAD);
Everything works fine, but in case the url does not exist I obtain the pointer to the html error page. How to check that the url hasn't been reached?
Please help
|
|
|
|
|
Check HTTP response code, must be 200 (200 OK) or 2xx I think
rrrado
|
|
|
|
|
I know that but i don't know hot to get this error code
|
|
|
|
|
Check this function, this will do that :
CHttpFile::QueryInfoStatusCode
rrrado
|
|
|
|
|
Hi all!
Help me please. I need to show preview info in the left of explorer (like we can see preview of bmp, jpg, html etc.). How can I do this? May be someone can send me expample? I`ll be appreciate for any help.
With best regards,
Yura.
|
|
|
|
|
I have noticed while trying to compile the MySQL++ library and from the errors returned that:
the reverse_iterator class has changed. According to the Microsoft documentation there has been a change in the STL library.
I was wondering if this change is limited to the Microsoft version of the STL or is it a change in the ANSI C++ STL?
|
|
|
|
|
FranzKlein wrote:
I was wondering if this change is limited to the Microsoft version of the STL or is it a change in the ANSI C++ STL?
I doubt there has been a change in ANSI C++ STL. Microsoft STL that ships with VC 7.0 is more compliant with the standard.
Best regards,
Alexandru Savescu
P.S. Interested in art? Visit this!
|
|
|
|
|
FranzKlein wrote:
the reverse_iterator class has changed
Yes, this one has hit me too some times ago. Microsoft made the change to make it ANSI compliant.
|
|
|
|
|
Hi all,
I'm still working on my switch statement program (from previous post)thanks to Joaquin my loop is working but for some reason my switch statements are not being activiated.
I've included a portion of my code, the switch statements continue for each letter a state begins with (d,f,g,h,i,k,etc)
Thanks,
Aaron
<br />
<br />
#include <iostream><br />
#include <fstream><br />
<br />
using namespace std;<br />
<br />
int main()<br />
{<br />
ifstream inAbrev("state abs.txt");
ofstream outState("states with abvs.txt");
char firstLetter,<br />
secondLetter;<br />
<br />
inAbrev >> firstLetter >> secondLetter;<br />
cout << firstLetter << secondLetter << endl;
<br />
while(inAbrev)
{<br />
inAbrev >> firstLetter >> secondLetter;<br />
cout << firstLetter << secondLetter << endl;<br />
<br />
switch (firstLetter)<br />
{<br />
case 'A' : switch (secondLetter)<br />
{<br />
case 'L' : outState << inAbrev << " is " << "Alabama" << endl;<br />
cout << inAbrev << " is " << "Alabama" << endl;<br />
break;<br />
case 'K' : outState << inAbrev << " is " << "Alaska" << endl;<br />
break;<br />
case 'Z' : outState << inAbrev << " is " << "Arizona" << endl;<br />
break;<br />
case 'R' : outState << inAbrev << " is " << "Arkansas" << endl;<br />
break;<br />
}<br />
case 'C' : switch (secondLetter)<br />
{<br />
case 'A' : outState << inAbrev << " is " << "California" << endl;<br />
break;<br />
case 'O' : outState << inAbrev << " is " << "Colorado" << endl;<br />
break;<br />
case 'T' : outState << inAbrev << " is " << "Connecticut" << endl;<br />
break;<br />
}<br />
arrrgh
|
|
|
|
|
set the breakpoint on "switch (firstLetter)" line and check the value of firstLetter and secondLetter variables to see what values exactly are in them.
|
|
|
|
|
It appears as if nothing is happening because all of your output statements (cout and outState) in your switch statement are wrong.
Your doing this:
outState << inAbrev << " is " << "California" << endl;<br />
cout << inAbrev << " is " << "Alabama" << endl;
What this is doing is trying to output the input filestream which, of course, will output nothing.
If I read your homework right, you should be doing something like this:
outState << firstLetter << secondLetter << " is Alabama" << endl;
RageInTheMachine9532
|
|
|
|
|
Yep RageInTheMachine is right.
none
|
|
|
|
|
I have recently written a Service that parses a large XML file using MSXML, breaks the xml down in to fragments, and then calls a SQL Server stored procedure to process the xml fragment. As each call to the stored procedure is made memory is leaked. I have not been able to find any information concering this particular problem. It also appears that the MSXML objects are also leaking memory. The code fragment that follows is where the leak occurs. All pointer are SmartPointers and no dynamic allocation occurs in my code. Anybody have any ideas?
IXMLDOMNodeListPtr LogEntries = pXMLDocRoot->childNodes;
IXMLDOMElementPtr LogEntry = NULL;
for( int i = 0; i < LogEntries->length; ++i )
{
LogEntry = LogEntries->item[i];
if(LogEntry->nodeType == NODE_ELEMENT )
{
CString nodeName = (TCHAR*) LogEntry->nodeName;
CString spName;
spName.Format(_T("sp_%s"),nodeName);
CString xml = (TCHAR*)LogEntry->xml;
// execute this data
if (S_OK != m_AdoCmd.Execute_StoredProc(spName, xml))
{
CString errorMsg;
errorMsg.Format("Failed to execute stored procedure %s: error: %s", spName, m_AdoCmd.m_errorStr);
LogErrorMsg("ProcessXML: " + errorMsg);
return false;
}
}
LogEntry.Release();
}
LogEntries->reset();
Butch
|
|
|
|
|
I have to do this for Windows 95/98/Me/200/NT/XP:
I have the ID of a process(obtained with Process32First/Next) and I want to get the full path of the executable hwo started that process. In PROCESSENTRY32 the member szExeFile gives me only the name of the file but not the full path...
Thank you!
Best regards,
radu.
|
|
|
|
|
One solution is EnumProcessModules().
OpenProcess()
EnumProcessModules()
GetModuleFileNameEx()
Kuphryn
|
|
|
|
|
That's what MSDN says:
Windows NT/2000/XP: Included in Windows NT 4.0 and later.
Windows 95/98/Me: Unsupported.
So it's not a solution for 95/98/Me...
|
|
|
|
|
I'm working on a project which will need to read/write xls files(Microsoft Excel documents), hmm... I don't have any idea how xls files are serialized, is there any library for doing this? Oh is there any articles/documentation about this topic? Thanks a lot.
|
|
|
|
|
|
|
Ok im trying to count the characters that i have loaded into a buffer i have set up the following function
void countchars(char *buffer, int *count)
/*Counts the number of characters in the text file */
{
int i,counter;
char cdata;
count['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'];
do
{
{ for(cdata='A';cdata<='Z';cdata++)
if(buffer[i]==counter[count])
{
count++;
}
i++;
}
}while(buffer[i]!=EOF);
}
I am calling this function using the following code:
countchars(buffer,cdata);
printf("\nDistribution of letters in %s is:",fname);
for (c='A';c<='Z';c++)
{
N=cdata[c]+cdata[tolower(c)];
printf("\n'%c' %4d: ",c,N);
for (i=0;i
|
|
|
|
|
|
Do your own homework, Overfiend.
Member since Wednesday 9th April, 2003
8:32 10 Apr '03
Counting characters in a buffer - Overfiend
Visual C++ (Programming Forums)
6:31 10 Apr '03
Counting characters in a buffer - Overfiend
C# (Programming Forums)
10:42 9 Apr '03
Counting characters from a text file - Overfiend
Visual C++ (Programming Forums)
|
|
|
|
|
Im trying but i need some help!
because i still cant get this to work
|
|
|
|
|
My application creates modeless dialog (in separate thread). The problem is that after creating of window system activates it and will put it foreground. How to create it without setting it active ?
How to restrict this window so that could be activated only by user ?
I tried to do this :
OnActivate(UINT nState, CWnd *pWndOther, BOOL bMinimized)
{
if (nState == WA_ACTIVE)
if (pWndOther)
::SetActiveWindow(pWndOther->m_hWnd);
}
But pWndOther is always NULL.
Any ideas ?
Thank you
rrrado
|
|
|
|
|
First create the Dialog that you want with the resource editor.
BE CAREFULL YOU MUST REMOVE THE "Visible" style from ("More Styles") in the dialog properties.
OR YOU WILL GET A CRASH.!!
Then you must Create a new Class Inherited from CDialog.
Lets say
CUpdateDialog :: public CDialog
with a resource template.. (the dialog editor);
then Create a variable (Object) of the new class.
Lest say
CUpdateDlg m_UpdateDlg;
then go ....
m_UpdateDlg.Create (IDD_UPDATEDIALOG,this);
// This will actuallly do the trick!
m_UpdateDlg.ShowWindow (SW_SHOWNOACTIVATE);
|
|
|
|