16
I'm a bit over my head here and would like some advice on how to go about.
Basicly what I want to do is to be able to render and control silverlight inside my C++ application. I would like something as:
class silverlight_host
{
public:
// Prio 1
silverlight_host(const std::string& filename); // Load a xap file
void draw(void* dest); // Draw with alpha to dest
std::pair<size_t, size_t> get_size(); // Need to know required size of dest
// Prio 2
bool is_dirty() const; // Check for dirty rect since last call to draw
void send_param(const std::string& param); // Send data to silverlight control or call functions. Alternative name maybe, call_function
void set_size(size_t width, size_t height); // Set the size of drawing.
// Prio 3
// Some more nice to have functions, although not as important as those above
double get_desired_frame_rate(); // The desired frame rate which is specified in xap
std::pair<size_t, size_t> get_desired_size(); // The desired size which is specified in xap
void tick(); // Tick a synchronous timeline, disable internal asynchronous timer
void set_param_callback(const std::function<void(const std::string&)>& callback); // Let the xap file call the application
};
Easier said than done. I have found the following articles Host Silverlight Contorl in C++ and Communication between C++ Silverlight Host and Silverlight Application. My problem with these are that the provided code doesn't seem to work when compiled in VS2010 and they create an actual window instead of a windowless control. Also what happens is not very well explained and I am somewhat lacking in COM and ATL knowledge.