Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

JamesNC's scratchpad

by JamesNC (Chaplain)
on Oct 07, 2004 at 04:58 UTC ( #397227=scratchpad: print w/ replies, xml ) Need Help??

#include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include "ppport.h" #include <windows.h> #include <stdio.h> #include <float.h> #include <stdlib.h> #include <math.h> #include <string.h> int isFileOpen(char *filename) { HFILE theFile = HFILE_ERROR; DWORD lastErr = NO_ERROR; // Attempt to open the file exclusively. theFile = _lopen(filename, OF_READ | OF_SHARE_EXCLUSIVE); if (theFile == HFILE_ERROR) // Save last error... lastErr = GetLastError(); else // If the open was successful, close the file. _lclose(theFile); // Return TRUE if there is a sharing-violation. if ((theFile == HFILE_ERROR) && (lastErr == ERROR_SHARING_VIOLATION)) return 1; } int GetClipboardSize() { char *htext, *stext; if( OpenClipboard(NULL) ) htext=GetClipboardData(CF_UNICODETEXT); stext = (LPTSTR) GlobalLock((HGLOBAL) htext); GlobalUnlock((HGLOBAL) htext); return GlobalSize(htext); } void SaveClipboardToFile( char* filename ) { char *h; int i, size; FILE *f; if ( OpenClipboard(NULL) ){ h = GetClipboardData(CF_UNICODETEXT); size = GlobalSize(h); if( size > 0 ){ f = fopen(filename,"wb"); for( i = 0; i < size; i++){ fprintf( f, "%c", *(h+i) ); } fclose(f); } } } void Empty (void ) { if( OpenClipboard(NULL) ){ EmptyClipboard(); } } MODULE = Win32::Clipboard::File PACKAGE = Win32::Clipboard::Fil +e int GetClipboardSize() void SaveClipboardToFile( filename ) char *filename void Empty() int isFileOpen( filename ) char *filename
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2016-05-06 14:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?