Click here to Skip to main content
15,909,242 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Retrieve Width and Height of a .PNG file Pin
Mark Salsbery27-Dec-07 8:28
Mark Salsbery27-Dec-07 8:28 
GeneralThanks Pin
Hanan88829-Dec-07 23:17
Hanan88829-Dec-07 23:17 
GeneralRe: Thanks Pin
Mark Salsbery30-Dec-07 10:39
Mark Salsbery30-Dec-07 10:39 
GeneralRe: Thanks Pin
Hanan88830-Dec-07 22:43
Hanan88830-Dec-07 22:43 
GeneralLinker troubles Pin
Dee Olutayo27-Dec-07 7:00
Dee Olutayo27-Dec-07 7:00 
GeneralRe: Linker troubles Pin
CPallini27-Dec-07 7:36
mveCPallini27-Dec-07 7:36 
GeneralRe: Linker troubles Pin
Dee Olutayo27-Dec-07 12:42
Dee Olutayo27-Dec-07 12:42 
GeneralRetrive JavaScript data from C++ Pin
theallmightycpd27-Dec-07 5:26
theallmightycpd27-Dec-07 5:26 
Good day,

I'm having a little trouble and I'm not even sure if this can be done.

I am writing a program that calls an HTTP address in order to generate a javascript object that then needs to be read. The Web address generates a file that looks like this:

obj = new Object();
obj.var1='abc';
obj.var2='def';
obj.var3='geh';
obj.var4='ijk';

Currently, I am just calling that page and reading it in as a text stream. Doing it this way, I'm going to have to parse through the string and separate all the values manually.

Code is as follows:

static const char s_szAgent[] = "";

CString str;
CString strURL = "http://mysite.com/js.go?var=test";

try
{
CInternetSession objSession(s_szAgent);
CHttpFile* pFile = (CHttpFile*)objSession.OpenURL(strURL, 1,INTERNET_FLAG_TRANSFER_ASCII | INTERNET_FLAG_RELOAD | INTERNET_FLAG_DONT_CACHE);

// If open succeeded, read the file.
if (pFile)
{
CString strLine;
while (pFile->ReadString(strLine))
{
str+=strLine.Trim();
str+="\n";
}
pFile->Close();
delete pFile;
}
}
catch (CInternetException* pEx)
{
pEx->ReportError();
pEx->Delete();
}

Now my question is:
Is there a simpler way of doing this? Is there a way to just access that javascript object as a whole rather than just reading in a file string by string?
GeneralRe: Retrive JavaScript data from C++ Pin
Hakan Bulut28-Dec-07 7:25
Hakan Bulut28-Dec-07 7:25 
Generalput try...catch... in a loop Pin
followait27-Dec-07 4:03
followait27-Dec-07 4:03 
GeneralRe: put try...catch... in a loop Pin
CPallini27-Dec-07 4:19
mveCPallini27-Dec-07 4:19 
QuestionRe: put try...catch... in a loop Pin
David Crow27-Dec-07 4:21
David Crow27-Dec-07 4:21 
GeneralRe: put try...catch... in a loop Pin
followait27-Dec-07 4:30
followait27-Dec-07 4:30 
GeneralRe: put try...catch... in a loop Pin
Maxwell Chen27-Dec-07 4:28
Maxwell Chen27-Dec-07 4:28 
Generalwhy visual studio does not optimize constructor in this case Pin
George_George27-Dec-07 2:24
George_George27-Dec-07 2:24 
GeneralRe: why visual studio does not optimize constructor in this case Pin
Maximilien27-Dec-07 4:03
Maximilien27-Dec-07 4:03 
GeneralRe: why visual studio does not optimize constructor in this case Pin
George_George27-Dec-07 4:10
George_George27-Dec-07 4:10 
GeneralRe: why visual studio does not optimize constructor in this case Pin
Maxwell Chen27-Dec-07 4:20
Maxwell Chen27-Dec-07 4:20 
GeneralRe: why visual studio does not optimize constructor in this case Pin
George_George27-Dec-07 16:49
George_George27-Dec-07 16:49 
GeneralRe: why visual studio does not optimize constructor in this case Pin
Maxwell Chen27-Dec-07 4:11
Maxwell Chen27-Dec-07 4:11 
GeneralRe: why visual studio does not optimize constructor in this case Pin
George_George27-Dec-07 16:36
George_George27-Dec-07 16:36 
GeneralRe: why visual studio does not optimize constructor in this case Pin
Maxwell Chen27-Dec-07 17:56
Maxwell Chen27-Dec-07 17:56 
GeneralRe: why visual studio does not optimize constructor in this case Pin
George_George27-Dec-07 18:15
George_George27-Dec-07 18:15 
GeneralRe: why visual studio does not optimize constructor in this case Pin
Sarath C27-Dec-07 4:55
Sarath C27-Dec-07 4:55 
GeneralRe: why visual studio does not optimize constructor in this case Pin
George_George27-Dec-07 16:42
George_George27-Dec-07 16:42 

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.