what SHOULD be a painfully simple API call...

This is a discussion on what SHOULD be a painfully simple API call... within the Windows Programming forums, part of the Platform Specific Boards category; I created a simple Log Off application using Visual C++ 6.0; It was painfully easy, all I had to do ...

  1. #1
    Registered User Citizen Bleys's Avatar
    Join Date
    Jan 2002
    Posts
    9

    what SHOULD be a painfully simple API call...

    I created a simple Log Off application using Visual C++ 6.0; It was painfully easy, all I had to do was create a new Win32 application, gave it the "Simple Win32 Application" template, and replaced the TODO comment with ExitWindowsEx(EWX_LOGOFF | EWX_FORCE,0);, and it worked absolutely perfectly.

    Now, I wanted to create a version that would lock the workstation. I looked up ExitWindowsEx in the help and clicked on System Shutdown Functions under See Also, and found a function called LockWorkStation, which, according to the Help file, was exactly what I was looking for; It was defined in the same header as ExitWindowsEx, was also stored in user32.lib...basically, it's exactly identical except that it locks the workstation instead of logging out.

    Problem is, it doesn't work. At all. When I type it in, the parameter list (in this case, VOID) comes up, when I hover over it, I see the prototype, and when I hit F1, I get the help file. But when I compile, it says "error C2065: 'LockWorkStation' : undeclared identifier"

    It's *not* an undelared identifier, it's part of the API.

    What the *expletives deleted* do I have to do to accomplish what ought to be a dead simple API call? I even tried loading Visual Basic, even though I don't know anything about Visual Basic, and managed to accomplish...precisely bugger. VB won't make the API call, either.

  2. #2
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    LockWorkStation is an NT only API. Which means that if you compile for NT you will have this function. But it also means that your app will be an NT only app.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  3. #3
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    by the way:

    #define _WIN32_WINNT 0x0500

    is how you define it for Windows 2000 or later. The function is not available for anything older
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  4. #4

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. simple 2d "putpixel" api for windows?
    By spiky in forum C Programming
    Replies: 2
    Last Post: 10-27-2005, 02:44 PM
  2. Replies: 4
    Last Post: 07-05-2004, 07:41 PM
  3. FILES in WinAPI
    By Garfield in forum Windows Programming
    Replies: 46
    Last Post: 10-02-2003, 06:51 PM
  4. need an API call...
    By jjd228 in forum Windows Programming
    Replies: 4
    Last Post: 01-07-2002, 05:13 AM
  5. Pls help me to do this project in C I need source code
    By sureshmenon74 in forum C Programming
    Replies: 4
    Last Post: 10-04-2001, 06:57 AM

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