Sign in to follow this  
Followers 0
Rad

FileGetSize() returning 0 in Windows Seven x64

2 posts in this topic

#1 ·  Posted (edited)

I've had this working program for quite a while now, but bought a new laptop with Windows Seven x64 (home premium). At first, the program would completely lock the system when I took screenshots with the _ScreenCapture_Capture() function (It would save the image with the bottom ~200pixels rendered, and would stop on the same pixel every time).

So I ran the source code, and that problem is gone. The program worked almost fine... But the logic to downgrade the quality of the image no longer works. I used FileGetSize() to see if the file is under a certain amount, and if not I would convert it to a PNG, then to a JPG and continually downgrade it from there. This all worked fine on XP x32, and works fine for my friend running Vista x32.

The rest of the code works as intended. The file gets uploaded, all of the windows look normal. The only thing that doesn't work is FileGetSize().

From the source code:

global $MaxFilesize = 1024*400

func save_image($f)
    $bmp = $f&".bmp"

    if Not fileexists($bmp) then
        debug("Image does not exist for conversion ["&$bmp&"]")
    Else
        if FileGetSize($f) < $MaxFileSize then
            debug("Image does not need to be converted ["&$bmp&"]")
            if FileGetSize($f) = 0 then
                debug ("ERROR: Image filesize could not be determined ["&@WORKINGDIR&"\"&$bmp&"]")
                return -1
            EndIf
            return $bmp
        EndIf
    EndIf
...

This basically says "Does the file exist? Then is it smaller than XXX? Let's make sure it's not 0!". Now you can see the debug lines, heres what gets output to my console:

Line 014 [11:30:51] Image was saved as [radshot 3testexe_2010-165-23-30-51-84.bmp]
Line 015 [11:30:51] Image exists [radshot 3testexe_2010-165-23-30-51-84.bmp]
Line 016 [11:30:51] Image does not need to be converted [radshot 3testexe_2010-165-23-30-51-84.bmp]
Line 017 [11:30:51] ERROR: Image filesize could not be determined [C:\Users\Radley's G73J\Documents\Radshot VERSION 2.0\radshot 3testexe_2010-165-23-30-51-84.bmp]

I will keep messing around with this, but is this a known issue? Is there a workaround? What should I try next?

Edited by Rad

Share this post


Link to post
Share on other sites



Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0