Thread: Win32 Interrupts

  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.

    http://cboard.cprogramming.com/showthread.php?t=52345
    http://cboard.cprogramming.com/showthread.php?t=70265
    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 int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    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.

  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, 03: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, 05:57 PM
  4. Thread Synchronization :: Win32 API vs. MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 08-09-2002, 09:09 AM
  5. Win32 API Tutorials?
    By c++_n00b in forum C++ Programming
    Replies: 9
    Last Post: 05-09-2002, 03:51 PM