Win32 Interrupts

This is a discussion on Win32 Interrupts within the Windows Programming forums, part of the Platform Specific Boards category; I would like to use PrintScreen as a way for my program to take a screenshot. I have read that, ...

  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    2

    Win32 Interrupts

    I would like to use PrintScreen as a way for my program to take a screenshot. I have read that, in DOS at least, a screenshot is generated with interrupt 5. So, I need a way to call this interrupt. I tried to write a very simple program just to try this out:

    Code:
    int main()
    {
                __asm { int 5 }
    return 0;
    }
    But I got an access violation when I ran it. So.. I guess user-level applications are not allowed to generate interrupts. My question is, can this be done with a driver? at all? I have no experience with drivers, so I want to know if this is at least possible before getting into it. Like I said in the title, this is for Windows 32-bit operating systems/processors.

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Moved to windows.

    >>I guess user-level applications are not allowed to generate interrupts<<

    No.

    There are winapi functions that can take a screenshot very easily - this has been discussed in the past so a search of this board will provide examples.

    get screenshot
    How can I load a screenshot of the desktop into my HBITMAP var?
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    2
    Thanks for the alternatives, but I am aware of them and am particularly interested in this method. So does a system driver have enough access to call int 5?

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,761
    Use the win32 API and stop thinking in DOS interrupt terms, it does NOT apply to win32 programming.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934

    Lightbulb

    >So does a system driver have enough access to call int 5?
    Where is Bubba when you really need him?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Win32 API or Win32 SDK?
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 07-20-2005, 04:26 PM
  2. Win32 Thread Object Model Revisted
    By Codeplug in forum Windows Programming
    Replies: 5
    Last Post: 12-15-2004, 08:50 AM
  3. OLE Clipboard :: Win32 API vs. MFC
    By kuphryn in forum Windows Programming
    Replies: 3
    Last Post: 08-11-2002, 06:57 PM
  4. Thread Synchronization :: Win32 API vs. MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 08-09-2002, 10:09 AM
  5. Win32 API Tutorials?
    By c++_n00b in forum C++ Programming
    Replies: 9
    Last Post: 05-09-2002, 04:51 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21