problems with pointers a dword?

This is a discussion on problems with pointers a dword? within the C++ Programming forums, part of the General Programming Boards category; i can't seem to get the code right, the program shal return something in parm2 but it can't, i can ...

  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    33

    Post problems with pointers a dword?

    i can't seem to get the code right, the program shal return something in parm2 but it can't, i can someone make it so it can?

    Code:
    int main ()
    {
    int lol=0;
    HANDLE hread;
    
    GetExitCodeProcess(hread,lol*);
    }

  2. #2
    Registered User
    Join Date
    Aug 2003
    Posts
    127
    Code:
    GetExitCodeProcess(hread, &lol);
    Nana C++ Library is a GUI framework that designed to be C++ style, cross-platform and easy-to-use.

  3. #3
    Registered User
    Join Date
    Feb 2009
    Posts
    33
    what do you mean the code dosent work?

  4. #4
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,265
    It's probably not working because your HANDLE is bad. What does your code look like?

  5. #5
    Registered User
    Join Date
    Feb 2009
    Posts
    33
    WHOLE CODE, INCLUDED SOME EXTRA FILES JUST GET THEM AWAY, IT ONLY NEED WINDOWS.H
    Code:
    #include <exception>
    #include <cstdlib>
    #include <windows.h>
    #include <iostream>
    using namespace std;
    
    
    
    int main ()
    {
    HANDLE hread;
    
    int lol;
    
    
    GetExitCodeProcess(hread,&lol*);
    
    
    }
    
    /*
        
    TerminateProcess(
      __in  HANDLE hProcess,
      __in  UINT uExitCode
    );
    
      */

  6. #6
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,265
    Your handle is not initialized. What are you trying to do? GetExitCodeProcess() gets the termination status of the process matching the HANDLE passed to the function. You are just declaring a HANDLE and passing it to GetExitCodeProcess which will always fail.

  7. #7
    Registered User
    Join Date
    Feb 2009
    Posts
    33
    then how do i intialize it do you have a tutorial on how to make the handle return thing working?

  8. #8
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,265
    Initialize it to what? A HANDLE represents a process. What process are you trying to get the termination status of?

  9. #9
    Registered User
    Join Date
    Feb 2009
    Posts
    33
    explorer.exe

  10. #10
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,265
    This assumes you know the process ID of explorer.exe
    Code:
    int main()
    {
    	DWORD dword;
    	HANDLE handle = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, explorerProcessId);
    	GetExitCodeProcess(handle, &dword);
    }

  11. #11
    'Allo, 'Allo, Allo
    Join Date
    Apr 2008
    Posts
    612
    If you don't launch it yourself
    Code:
    DWORD explorerExitCode = 259;
    No faffing required.

  12. #12
    Registered User
    Join Date
    Feb 2009
    Posts
    33
    don't get it why should it be so hard?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. swapping pointers
    By csvraju in forum C Programming
    Replies: 17
    Last Post: 04-01-2009, 04:18 AM
  2. Using pointers to pointers
    By steve1_rm in forum C Programming
    Replies: 18
    Last Post: 05-29-2008, 06:59 AM
  3. VC++ problems with pointers
    By GOBLIN-85 in forum C++ Programming
    Replies: 4
    Last Post: 11-15-2007, 08:47 PM
  4. Array of Pointers + Deleting An Object = Problems
    By Nereus in forum C++ Programming
    Replies: 3
    Last Post: 03-04-2004, 12:16 PM
  5. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM

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