Done with out of processs... need some help menu

Shout-Out

User Tag List

Page 5 of 5 FirstFirst 12345
Results 61 to 64 of 64
  1. #61
    lanman92's Avatar Active Member
    Reputation
    50
    Join Date
    Mar 2007
    Posts
    1,033
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Cypher View Post
    Fail. lrn2msdn.
    I did check the MSDN, but I couldn't find the 'proper' way to get a PID from a HWND or HANDLE.

    Done with out of processs... need some help
  2. #62
    Shynd's Avatar Contributor
    Reputation
    97
    Join Date
    May 2008
    Posts
    393
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Then you didn't check hard enough.

    Code:
    HWND hWnd;
    DWORD dwProcessId;
    HANDLE hProcess;
    
    hWnd = FindWindow(NULL, "World of Warcraft");
    if (hWnd == NULL)
        return; //error
    
    GetWindowThreadProcessId(hWnd, &dwProcessId);
    if (dwProcessId == 0)
        return; //error
    
    hProcess = OpenProcess(PROCESS_ALL_ACCESS, false, dwProcessId);
    if (hProcess == NULL)
        return; //error
    
    
    //...do bad stuff
    
    CloseHandle(hProcess);

  3. #63
    lanman92's Avatar Active Member
    Reputation
    50
    Join Date
    Mar 2007
    Posts
    1,033
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh, I didn't know you could pass the PID argument to getwindowthreadprocessid() as just a reference... Okay, I screwed up.

  4. #64
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1358
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Any part of the Windows API that requires a pointer usualy really wants you to pass it the 'address-of' the variable to fill. Because many APIs need to return multiple values and C++ has no native way of representing tuples this is the easiest way to do so.

    It is also a way of seeing how well people understand the APIs they're calling.

    Often you'll see retarded shit like this:
    DWORD MyDword = 0;
    SomeWindowsApi(Foo, Bar, (LPDWORD) MyDword, NULL);

    When whats really needed is:
    DWORD MyDword = 0;
    SomeWindowsAPI(Foo,Bar,&MyDword,NULL);

    Or then theres the infamous thread-creation cast in which rather than properly defining their threads calling convention, params, etc, people would rather just cast their function pointer as (LPTHREAD_START_ROUTINE) or w/e then be done with it. Which funnily enough crashes on x64 operating systems.

    PS. It's not a reference, you're passing the API the address of your variable (ie a pointer to your local variable). The difference may be subtle in some cases but a reference is different to a pointer.

Page 5 of 5 FirstFirst 12345

Similar Threads

  1. need some help with realmlist.wtf
    By AuRaGoD in forum World of Warcraft General
    Replies: 1
    Last Post: 05-20-2007, 11:33 PM
  2. Need some help with druid skins
    By Surikat in forum WoW ME Questions and Requests
    Replies: 0
    Last Post: 04-30-2007, 04:42 AM
  3. Need some help with Head changing
    By Emotion in forum WoW ME Questions and Requests
    Replies: 6
    Last Post: 01-01-2007, 07:12 PM
  4. Need some help with fishing bot
    By ralphie123 in forum World of Warcraft Bots and Programs
    Replies: 3
    Last Post: 11-24-2006, 09:41 AM
  5. NEED SOME HELP with Model Editing
    By Dwarf in forum World of Warcraft Model Editing
    Replies: 4
    Last Post: 09-12-2006, 08:12 PM
All times are GMT -5. The time now is 05:41 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search