» Archive for the 'tutorial' Category

How to get IHTMLDocument2 from a HWND

Friday, March 14th, 2008 by rubypdf

Maybe I need it someday, so leave a message here.

SUMMARY
This article shows how to get the IHTMLDocument2 interface from a HWND. If Microsoft Active Accessibility (MSAA) is installed, you can send the WM_HTML_GETOBJECT message to the document’s window (with the window class “Internet Explorer_Server”) and then pass the result from SendMessage to an MSAA function, ObjectFromLresult, to get a fully marshaled IHTMLDocument2 pointer.

Here is VB version
Here is C version

Implement Yahoo DomainKeys on MS Exchange 2003

Thursday, March 13th, 2008 by rubypdf

Today I found some one ask how to implement Yahoo DomainKeys on MS Exchange 2003, and I told him to find answer from her
https://mmmservices.web.cern.ch/mmmservices/Antispam/DomainKeysLibrary.aspx

CERN DomainKeys Library is written in C#, for a Windows usage.
Common task is to integrate this library into Protocol Event Sinks, implementing ISmtpInCommandSink interface, for incoming traffic verification and outgoing traffic signing.
An ISmtpServerResponseSink Sink might also be used for signing outgoing traffic.
It uses a certificate generated by OpenSSL, and imported in LocalMachine certificate store. The public key is extracted using OpenSSL for DNS field.

if you want solution for other smtp server, please follow this link,
http://domainkeys.sourceforge.net/

P.S.
a little knowledge about Yahoo DomainKeys

Introduced by Yahoo! Inc., the idea is to sign and verify mails at gateway level, using a public key found in DNS for verification.
The idea is to verify that the mail really comes from the official server handling this email address, to be sure it is not a forged email.

See http://antispam.yahoo.com/domainkeys for details and specification.

PdftoTiff-Free windows software to convert PDF to Tiff

Thursday, February 14th, 2008 by rubypdf

This is just a example that show how to convert all pages of a given pdf to single page tiffs(to a given folder).
it uses pdftoppm(part of xpdf) and pnmtotiff(part of netpbm).
If you do not want download xpdf and netpbm but want to have a test, please download it here(pdftotiff0.1, 730K), it only includes pdftoppm.exe, pnmtotiff.exe, libnetpbm10.dll, jpeg62.dll, libtiff3.dll, zlib1.dll and a batch file.
btw, base on this example, you can easily implement pdftojpeg, pdftopng, pdftojbig, pdftotiffcmyk and so on.

rem create folder
md %2
rem convert pdf page to ppm
pdftoppm -r 100 %1 %2\1
rem convert ppm to tiff
for %%i in (%2\*.ppm) do echo pnmtotiff -color %%i>%2\%%~ni.tif
rem delete ppm
del /q %2\*.ppm

reference,
xpdf
NetPbm for Windows