Char URL [1000] = "http: // 192.168.131.129: 8080 /? Action = snapshot ";
// Cout <"target Address URL:" <URL <Endl;
Unsigned char * buffer = new byte [100000];
DWORD bytes_read;
Hinternet Internet = internetopen ("HTTP downloader", internet_open_type_preconfig,
Null, null, null );
If (! Internet)
Return;
Hinternet file_handle = internetopenurl (Internet, URL, null, 0, internet_flag_reload, 0 );
If (! File_handle)
Return;
Void * pimagememory = globallock (buffer );
Bool B = internetreadfile (file_handle, pimagememory, 100000, & bytes_read );
Globalunlock (pimagememory); // unlock memory
If (! B)
Return;
CDC * PDC = getdlgitem (idc_showimg)-> getdc ();
HDC = PDC-> getsafehdc ();
Crect rect;
Getdlgitem (idc_showimg)-> getclientrect (& rect );
Istream * pistream; // create an istream interface pointer to save the image stream.
Ipicture * pipicture; // create an ipicture interface pointer to indicate the image object.
Createstreamonhglobal (pimagememory, false, & pistream); // use the istream interface pointer in the global memory.
Oleloadpicture (pistream, 0, false, iid_ipicture, (lpvoid *) & (pipicture); // obtain ipicture with oleloadpicture
Long hmwidth;
Long hmheight;
Pipicture-> get_width (& hmwidth); // obtain the image width and height using the interface
Pipicture-> get_height (& hmheight );
Pipicture-> render (HDC, 0,0, 640,480, 0, hmheight, hmwidth,-hmheight, null );
// Handle hfile = createfile (_ T (file_handle), generic_read, 0, null, open_existing, 0, null );
// Buffer [bytes_read] = 0;
// Delete [] buffer;
Globalfree (pimagememory); // release global memory
Pistream-> release (); // release pistream
Pipicture-> release (); // release pipicture
Internetclosehandle (Internet );