User Profile

Collapse

Profile Sidebar

Collapse
Hackles
Hackles
Last Activity: Apr 19 '09, 10:33 AM
Joined: Sep 16 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Hackles
    started a topic Windows Hooks
    in C

    Windows Hooks

    Hello,
    Is there a hook type that can intercept messages (such as WM_INPUT) while they're in the message queue without relying on the application?
    I have looked into the following types of hooks, but each have their own drawbacks:
    • WH_GETMESSAGE - relies on GetMessage or PeekMessage being called, which may not be feasible as I am checking for messages once per frame (so as not to compromise framerates), which is unacceptable for WM_INPUT
    ...
    See more | Go to post

  • I've got it!

    [code=cpp]
    unsigned char *test = malloc(42);
    cout << "The size allocated is " << _msize(test) << "bytes!";
    free(test);
    [/code]

    Obviously, this is Visual C++/Windows-specific, but still I felt I should tell you (source ).

    Anyway, thank you to all that contributed!

    Have fun!
    See more | Go to post

    Leave a comment:


  • Thank you smalpani for your explanation. It just seems surprising to me that the C/C++ specifications would miss such a useful function, considering the malloc/realloc specifications imply that size information would be stored. In any case, I will attempt to find a solution to my problem (I am developing for the Windows platform) and post back once successful.
    Thank you all for your help,
    Xiao
    See more | Go to post
    Last edited by Hackles; Oct 14 '07, 01:11 AM. Reason: Corrected spelling mistakes

    Leave a comment:


  • Thank you for your response Jos,
    Are there any functions defined in the standard C/C++ libraries that can be used to determine the size for either malloc or new?
    Thank you,
    Xiao...
    See more | Go to post

    Leave a comment:


  • Hackles
    started a topic Determining the size of allocated memory from a pointer
    in C

    Determining the size of allocated memory from a pointer

    Hello,
    Is it possible to retrieve the size of allocated memory from a pointer (more specifically, a pointer returned my malloc/realloc). This question may have already been asked countless times. However, please consider the following:
    1. The program's heap stores the size of an element
    2. When you use realloc to allocate more memory, a new address may sometimes be issued in order to accommodate the space demand. In these cases, the existing
    ...
    See more | Go to post

  • Hackles
    replied to Forcing the browser to download a music file
    in PHP
    Just an amendment to the last post: As far as I know of, it is impossible to set the FilesMatch rule for a specific directory (I've tried .htaccess, nesting within a Directory rule, even adding a path to the regex for the FilesMatch rule, but it doesn't seem to work). I guess that'd be a slight downside, not being able to control which directory falls under direct download control.
    An alternative (that achieves the same result) is:
    ...
    See more | Go to post

    Leave a comment:


  • Hackles
    replied to C++ Need help with array of objects
    in C
    I understand sicarie; however, for particularly long code listings, should I attach each source file individually?

    Thanks for the pointer (0xAF42389C - sorry, bad pun :P ) and have fun!...
    See more | Go to post

    Leave a comment:


  • Hackles
    replied to Forcing the browser to download a music file
    in PHP
    Hello Irfan12,
    The issue you have outlined with download resume support is highly common when using PHP to pass a file. Normally, a web server manages download resume by sending only the data requested through HTTP headers by the browser. While it is still possible to implement a virtual download resume support with PHP, in this instance it is far easier to use configure your web server to send a force download header for every mp3 file. This...
    See more | Go to post
    Last edited by Hackles; Sep 17 '07, 08:31 AM. Reason: Minor adjustments

    Leave a comment:


  • Hackles
    replied to C++ Need help with array of objects
    in C
    ilikepython, that's what I did :P (refer to attachment on post #6).
    Have fun!...
    See more | Go to post

    Leave a comment:


  • Hackles
    replied to Forcing the browser to download a music file
    in PHP
    Mmm... good point ajaxrand. As you can probably tell by my post count, I am relatively new to these forums and it'll take a while for me to learn how to respond well to individual cases. Thanks for the tip :)
    Have fun!...
    See more | Go to post

    Leave a comment:


  • Hackles
    replied to C++ Need help with array of objects
    in C
    I'm sorry, but I think you may have rationalized your classes incorrectly. Judging by your program, you have a class that stores plant data but you have put functions to manage a nursery withing the same class - this can be accommodated for with static members or by passing the array through to the function, but that is highly inefficient. I've tried to rationalize it in a better way, by separating plants and nurseries - hope this helps.
    Have...
    See more | Go to post

    Leave a comment:


  • Hackles
    replied to Forcing the browser to download a music file
    in PHP
    ajaxrand, I think Irfan12 wanted a dynamic and reusable script that can handle more than one music file - I only assume this as Irfan12 implies the functionality for multiple files:


    If so, then I think the code outlined in post #4 is best suited to Irfan12's needs ;).
    Have fun!...
    See more | Go to post

    Leave a comment:


  • Hackles
    replied to C++ Need help with array of objects
    in C
    First of all, please use the code tags when posting source code by using by using the CODE tags to enclose source code.
    Now, there are some obvious errors in your source code:
    [CODE=CPP]
    #include <iostream>
    #include <string>
    #include "nursery.h"

    using namespace std;

    int main()
    {
    int selection = 0;
    int i = 0;

    Nursery...
    See more | Go to post
    Last edited by Hackles; Sep 16 '07, 06:40 AM. Reason: Minor adjustments

    Leave a comment:


  • Hackles
    replied to Forcing the browser to download a music file
    in PHP
    Hmmm... it seems like in your code you have set $filename to a constant value of "path/to/file/filname.ext". Try changing your code to the following - it's better:
    [code=php]
    <?php

    if((array_key_e xists('file', $_GET)) && ($fp = @fopen($_GET['file'], 'rb')) && (pathinfo($_GET['file'], PATHINFO_EXTENS ION) != 'php'))
    {
    header('Content-Disposition: attachment; filename="'...
    See more | Go to post
    Last edited by Hackles; Sep 16 '07, 05:29 AM. Reason: Added further information

    Leave a comment:

No activity results to display
Show More
Working...