Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Any idea on how I can get the memory pointer of the image in a form?

DjSpiritDjSpirit Posts: 371Member
[grey]I have a form, and only that, the form has a property named image. The image property points to a picture containing the autoredraw buffer of the form. I want to know where in memory this image is stored.
I have tried to use GetObjectAPI, but it returns only a null pointer. Anyone got a good idea?

DjSpirit, the romans fell due to lack of zero, they could not return success from their programs.[/grey]

Comments

  • nimnul2nimnul2 Posts: 131Member
    [b][red]This message was edited by nimnul2 at 2002-11-14 7:35:23[/red][/b][hr]
    Get its hDC. For graphics it's like a pointer.

  • DjSpiritDjSpirit Posts: 371Member
    : [b][red]This message was edited by nimnul2 at 2002-11-14 7:35:23[/red][/b][hr]
    : Get its hDC. For graphics it's like a pointer.
    :
    [grey]That's not good enough, I'm not looking to do GDI grafical functions, I'm going to modify the memory directly.

    DjSpirit, it's not because it's better, it's because I want to[/grey]

  • GenjuroGenjuro Posts: 913Member
    : : [b][red]This message was edited by nimnul2 at 2002-11-14 7:35:23[/red][/b][hr]
    : : Get its hDC. For graphics it's like a pointer.
    : :
    : [grey]That's not good enough, I'm not looking to do GDI grafical functions, I'm going to modify the memory directly.
    :
    : DjSpirit, it's not because it's better, it's because I want to[/grey]
    :
    :

    You can either use DirectX, or use the GetBitmapBits API (GDI32.Dll).
    Just to point out, a StdPicture.Handle is an HDC, so if you have an image, it will do fine.

  • DjSpiritDjSpirit Posts: 371Member
    : : : [b][red]This message was edited by nimnul2 at 2002-11-14 7:35:23[/red][/b][hr]
    : : : Get its hDC. For graphics it's like a pointer.
    : : :
    : : [grey]That's not good enough, I'm not looking to do GDI grafical functions, I'm going to modify the memory directly.
    : :
    : : DjSpirit, it's not because it's better, it's because I want to[/grey]
    : :
    : :
    :
    : You can either use DirectX, or use the GetBitmapBits API (GDI32.Dll).
    : Just to point out, a StdPicture.Handle is an HDC, so if you have an image, it will do fine.
    :
    [grey]You are still not answering my question. I want the pointer to the actual data, not a copy of the data in it self.

    DjSpirit[/grey]

  • GenjuroGenjuro Posts: 913Member
    : : : : [b][red]This message was edited by nimnul2 at 2002-11-14 7:35:23[/red][/b][hr]
    : : : : Get its hDC. For graphics it's like a pointer.
    : : : :
    : : : [grey]That's not good enough, I'm not looking to do GDI grafical functions, I'm going to modify the memory directly.
    : : :
    : : : DjSpirit, it's not because it's better, it's because I want to[/grey]
    : : :
    : : :
    : :
    : : You can either use DirectX, or use the GetBitmapBits API (GDI32.Dll).
    : : Just to point out, a StdPicture.Handle is an HDC, so if you have an image, it will do fine.
    : :
    : [grey]You are still not answering my question. I want the pointer to the actual data, not a copy of the data in it self.
    :
    : DjSpirit[/grey]
    :
    :

    Well, "GetBitmapBits" does so. More or less.
    You can't get to the graphic board memory, not even in C++.
    You can try asm, if you feel like - write an ActiveX Dll in c++, that uses asm internally.
    There's no way to get an image data pointer, in plain C++ or VB.

    Besides using DirectX, of course - I replied all the same. DirectX *does* give you that pointer, through the "Lock" and "Unlock" methods (IDirectXSurface7 interface).

    I hope I replied now (not any more than the other time, anyway). Does it suffice?
  • DjSpiritDjSpirit Posts: 371Member
    [grey] I don't think the image returened by the image property of a form, or usercontrol is actually stored in video memory. Therefore I think there should be some other way around it. I'm currently working on a hack to see what data I can get out of the control itself. I'm using VarPtr with one of its properties and have gotten interesting results so far.

    DjSpirit, there is always a way[/grey]
  • GenjuroGenjuro Posts: 913Member
    : [grey] I don't think the image returened by the image property of a form, or usercontrol is actually stored in video memory. Therefore I think there should be some other way around it. I'm currently working on a hack to see what data I can get out of the control itself. I'm using VarPtr with one of its properties and have gotten interesting results so far.
    :
    : DjSpirit, there is always a way[/grey]
    :

    Probably, it isn't - in fact.
    But you won't get anywhere else than in a blue screen.

    Not that I really care if you stumble in a blue screen after another - I warned you, and that's all.

    Besides, VarPtr can't but access system memory anyways.

    What's that property? Handle? *LOL*
    If it's the case, keep in mind that an HDC is a void*, and that void* is a pointer to a BITMAP structure mantained by the GDI (if I'm not wrong).
    Well, that one is in system memory, so you would have done faster calling "GetBitmapBits". It does return exactly the same pointer, but you don't need to hack for it *LOL*
    Don't hack for it anyway - it's different from version to version - and you're supposed not to look in there all the same.

    This leaves the only option of using DirectX, who does that for sure, on every video board.
    I'd do that, if I was you.
  • DjSpiritDjSpirit Posts: 371Member
    [b][red]This message was edited by DjSpirit at 2002-11-21 4:45:45[/red][/b][hr]
    : If it's the case, keep in mind that an HDC is a void*, and that void* is a pointer to a BITMAP structure mantained by the GDI (if I'm not wrong).
    : Well, that one is in system memory

    [grey]Thank you, that is the only useable information I have gotten out of you, but still it is something.

    DjSpirit, the case isn't to draw graphics, it's to use pointers in VB to modify it.[/grey]




  • KDivad LeahcimKDivad Leahcim Posts: 3,948Member
    : [b][red]This message was edited by DjSpirit at 2002-11-21 4:45:45[/red][/b][hr]
    : : If it's the case, keep in mind that an HDC is a void*, and that void* is a pointer to a BITMAP structure mantained by the GDI (if I'm not wrong).
    : : Well, that one is in system memory
    :
    : [grey]Thank you, that is the only useable information I have gotten out of you, but still it is something.
    :
    : DjSpirit, the case isn't to draw graphics, it's to use pointers in VB to modify it.[/grey]
    :
    :
    :
    :
    :

    Seems if you want to modify that image, GetBitmapBits and SetBitmapBits would be fine, though that doesn't answer your question either...
Sign In or Register to comment.