2) Select
the "New.." command
from "File" menu
(as it is shown below) to run :
3) New
Project Wizard dialog
will appear on the screen. Select "Win32
Console Application" project
type and enter "HelloWorld" as the Project name as shown on the screenshot
below:
4)
The wizard will ask what kind of Console Application you want
to create. Select A
"Hello, World!" application and
click Finish:
VC++ will
show summary information for the new project. Click OK:
Visual C++
will generate application code for a simple console application
The source code editor
window will appear. To edit main() function just open the
class tree on the left and double click on "H elloWorld Classes"
| "Globals" | "main (int argc, char* argv[1])":
VC++ will open main() function:
5) To
use RSS2HTML Scout ActiveX in VC++
application you have to tell the compiler to import type library information
into the project.
To import type library just add #import compiler
directive after #include directive:
#import "RSS2HTMLScout.tlb"
using namespace RSS2HTMLScoutLib;
6) The
code snippet below will convert RSS to HTML using RSS2HTML Scout ActiveX
library
#include "stdafx.h"
#import "RSS2HTMLScout.tlb"
using namespace RSS2HTMLScoutLib;
int main(int argc, char* argv[])
{
// initialize OLE
HRESULT hr = CoInitialize(NULL);
// check for errors
if (FAILED(hr)) {
MessageBox(0,"OLE initialization errp","error",MB_OK);
return -1;
}
// declare SWFScout object
IRSS2HTMLScout* RSS2HTML = NULL;
CLSID clsid;
// get inuque ID for IFlashMovie interface
hr = CLSIDFromProgID(OLESTR("RSS2HTMLScoutLib.RSS2HTMLScout"), &clsid);
// check for errors
if (FAILED(hr)) {
MessageBox(0,"Can't get CLSID for interface","error",MB_OK);
goto Uninit;
};
// create FlashMovie object
hr = CoCreateInstance(clsid, NULL, CLSCTX_ALL,__uuidof(IRSS2HTMLScout), (LPVOID*)&RSS2HTML);
// check for errors
if (FAILED(hr)) {
MessageBox(0,"Can't create RSS2HTMLScout object","error",MB_OK);
goto Uninit;
}
RSS2HTML->ItemsPerFeed = 5; // display only 5 latest items
// ##### we can add more than one RSS feed #########
RSS2HTML->AddFeed("http://bytescout.com/news.xml", 180); // update every 180 minutes (3 hours)
RSS2HTML->Execute();
RSS2HTML->SaveOutputToFile ("RSS2HTMLOutput.html");// save output to HTML file
// disconnect from library
RSS2HTML->Release();
// uninitialize OLE libraries
Uninit:
CoUninitialize();
return 0;
}
Hint:
you can simply copy and paste the code
from the sample above into VC++ code editor window.
7) Run
the application by pressing F5 (or
use "Build" | "Debug" | "Go")
VC++ will compile and run "Hello,
World!" application. It will generate HTML code and then will save it into RSS2HTMLOutput.html file.