Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Confussion with Assigning an applications's process priority [modified]

Confussion with Assigning an applications's process priority [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
comquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kitty5
    wrote on last edited by
    #1

    After reading the article: Enumerating processes : A practical approach By Irfan Dawood. I found this really helpfull with what I have to do. However, I only have the name of the application (hello.exe). The processInfo=new PROCESSENTRY32; has a member variable: szExeFile which is a: "Pointer to a null-terminated string that specifies the name of the executable file for the process. " I figure after getting all the processes if I just search for my process using the name I can obtain the process ID of the "hello.exe" process therefore then be able to set the priority: //Here we are trying to get all possible access. HANDLE hProcess=OpenProcess(PROCESS_ALL_ACCESS,TRUE,processID); if(hProcess==NULL) { cout<<"Unable to get handle of process: "< but whenever I try to do: `if( processInfo->szExeFile == _T("hello.exe"))` it doesn't work. and when I try to print out `cout<szExeFile;` I get "Name: 0036630C"... Am I completely off my rocker? Thanks, -- modified at 11:36 Thursday 24th August, 2006 -- modified at 11:44 Thursday 24th August, 2006 Kitty5

    W 1 Reply Last reply
    0
    • K kitty5

      After reading the article: Enumerating processes : A practical approach By Irfan Dawood. I found this really helpfull with what I have to do. However, I only have the name of the application (hello.exe). The processInfo=new PROCESSENTRY32; has a member variable: szExeFile which is a: "Pointer to a null-terminated string that specifies the name of the executable file for the process. " I figure after getting all the processes if I just search for my process using the name I can obtain the process ID of the "hello.exe" process therefore then be able to set the priority: //Here we are trying to get all possible access. HANDLE hProcess=OpenProcess(PROCESS_ALL_ACCESS,TRUE,processID); if(hProcess==NULL) { cout<<"Unable to get handle of process: "< but whenever I try to do: `if( processInfo->szExeFile == _T("hello.exe"))` it doesn't work. and when I try to print out `cout<szExeFile;` I get "Name: 0036630C"... Am I completely off my rocker? Thanks, -- modified at 11:36 Thursday 24th August, 2006 -- modified at 11:44 Thursday 24th August, 2006 Kitty5

      W Offline
      W Offline
      Waldermort
      wrote on last edited by
      #2

      kitty5 wrote:

      but whenever I try to do: if( processInfo->szExeFile == _T("hello.exe")) it doesn't work. and when I try to print out cout<szExeFile; I get "Name: 0036630C"...

      processInfo->szExeFile is a pointer. When you try comparing it or print it you are really testing the address. You should de-reference it first ie if( *processInfo->szExeFile == _T("hello.exe")) cout<szExeFile;

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups