Modify dsoframer source code to support D7

Source: Internet
Author: User

1. Modify fdrawtext or drawtext in the ondraw function;
2. allocate memory space for one variant variable in the frunningindesignmode () Process

Variant vtusermode;
// Add the following sentence:
Memset (& vtusermode, 0, sizeof (variant ));
Recompile in VC ++ and register dsoframer. ocx.

3. Obtain the Word document data stream and its data exchange with D7 variants
Ovoption: = emptyparam;
Ovformat: = 'rich text format ';
Framercontrol1.execolecommand ($7001, ovoption, ovformat, ovwbinary );
// Olecmdid_getdataformat = $7001; execute the OLE command to obtain the data stream
If vartype (ovwbinary) <> varempty then begin
Pbuf: = vararraylock (ovwbinary );
Stream. Size: = vararrayhighbound (ovwbinary, 1)-vararraylowboundovwbinary, 1) + 1;
Stream. Position: = 0;
Stream. Write (pbuf ^, FS. size );
Vararrayunlock (ovwbinary );
Writewordbinarytodatabase (Stream); // Save the stream data to the database

Key code for writing stream data to Word documents:
Getwordbinaryfromdatabase (Stream); // read the question data stream from the database
Ovwbinary: = vararraycreate ([0, msstream. Size-1], varbyte );
Pbuf: = vararraylock (ovwbinary );
Stream. Position: = 0;
Stream. Read (pbuf ^, stream. size );
Vararrayunlock (ovwbinary );
Framercontrol1.execolecommand ($7002, ovoption, ovformat, ovwordbinary );
// Olecmdid_setdataformat = $7002; execute the OLE command to write the question data stream to the Word document and submit the question content
Writing data streams to Windows clipboard
VaR
Pbuf, bufptr: pointer; hbuf: thandle; nrfetc, nsize: integer;
Begin
Nrfetc: = registerclipboardformat ('rich text format ');
Getwordbinaryfromdatabase (Stream); // read the question data stream from the database
Hbuf: = globalalloc (gmem_moveable, stream. size );
If hbuf = 0 then begin outofmemoryerror; exit; end;
Bufptr: = globallock (hbuf );
Try
Stream. Read (bufptr ^, stream. size); // write the question stream to the global memory
Clipboard. setashandle (nrfetc, hbuf); // place the global memory stream to the Windows clipboard
Pastecontentonwordpaper; // paste the exam data from the clipboard to the word exam
Finally
Globalunlock (hbuf );
End;
Globalfree (hbuf); stream. Free;
End;

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.