Results 1 to 10 of 10
  1. #1
    Code[VB]'s Avatar
    Join Date
    Mar 2011
    Gender
    male
    Location
    CODER
    Posts
    608
    Reputation
    11
    Thanks
    702
    My Mood
    Bitchy

    Start process in the same folder as the .dll

    hi all, a short question

    in visual basic i start a process (.exe) in the same folder as the other (.exe) like this:

    Code:
    process.start(Application.StartupPath & "\test.exe")
    and normaly you run like this in C++
    Code:
    system("c:\\test.exe");
    how can i make it in C++ like this :
    Code:
    process.start(Application.StartupPath & "\test.exe")
    becouse Application.startuppath don´t work in c++

    please help me thx
    Last edited by Code[VB]; 03-27-2011 at 09:20 AM.

  2. #2
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,321
    My Mood
    Cheeky
    GetModuleFileName Function (Windows)

    Code:
    char filePath[256] = "";
    int len = GetModuleFileName(NULL, filePath, 256);
    strcat(filePath, "trololol.exe");
    Don't remember if it adds a slash behind the path by default, so you might need to use "\\trololol.exe"
    Ah we-a blaze the fyah, make it bun dem!

  3. #3
    Code[VB]'s Avatar
    Join Date
    Mar 2011
    Gender
    male
    Location
    CODER
    Posts
    608
    Reputation
    11
    Thanks
    702
    My Mood
    Bitchy
    hmm thx but how can i use it? becouse i m c++ beginner sory

    Code:
    #include <windows.h>
    #include <iostream>
    
    using namespace std;
    
    
    
    
    char filePath[256] = "";
    int len = GetModuleFileName(NULL, filePath, 256);
    strcat(filePath, "trololol.exe");
    this don t work

  4. #4
    ғᴜᴋᴏᴊʀ's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    1,557
    Reputation
    87
    Thanks
    141
    My Mood
    Inspired
    Quote Originally Posted by Code[VB] View Post
    hmm thx but how can i use it? becouse i m c++ beginner sory

    Code:
    #include <windows.h>
    #include <iostream>
    
    using namespace std;
    
    
    
    
    char filePath[256] = "";
    int len = GetModuleFileName(NULL, filePath, 256);
    strcat(filePath, "trololol.exe");
    this don t work
    Well why don't you learn the basics first. Try wrapping it in int main()

  5. #5
    whit's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    7,159
    Reputation
    490
    Thanks
    2,253
    Or take the easy way out
    [Highlight=cpp]
    system("Start firefox.exe");
    [/Highlight]

  6. The Following User Says Thank You to whit For This Useful Post:

    ғᴜᴋᴏᴊʀ (03-27-2011)

  7. #6
    radnomguywfq3's Avatar
    Join Date
    Jan 2007
    Gender
    male
    Location
    J:\E\T\A\M\A\Y.exe
    Posts
    8,858
    Reputation
    381
    Thanks
    1,823
    My Mood
    Sad
    Using the shell is usually a bad idea.

    Using CreateProcess API
    CreateProcess Function (Windows)



    There are two types of tragedies in life. One is not getting what you want, the other is getting it.

    If you wake up at a different time in a different place, could you wake up as a different person?


  8. The Following 2 Users Say Thank You to radnomguywfq3 For This Useful Post:

    Hell_Demon (03-28-2011),why06 (03-28-2011)

  9. #7
    'Bruno's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Portugal
    Posts
    2,883
    Reputation
    290
    Thanks
    1,036
    My Mood
    Busy
    this thread is full of leechness (Does this word even exist? lolol)

    Okay he is not trying to leech.. Just trying to run without walking.

  10. #8
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,321
    My Mood
    Cheeky
    Quote Originally Posted by Brinuz View Post
    this thread is full of leechness (Does this word even exist? lolol)

    Okay he is not trying to leech.. Just trying to run without walking.
    More like trying to run while he's in a wheelchair ._.
    Ah we-a blaze the fyah, make it bun dem!

  11. The Following 2 Users Say Thank You to Hell_Demon For This Useful Post:

    'Bruno (03-28-2011),Melodia (03-28-2011)

  12. #9
    Code[VB]'s Avatar
    Join Date
    Mar 2011
    Gender
    male
    Location
    CODER
    Posts
    608
    Reputation
    11
    Thanks
    702
    My Mood
    Bitchy
    hmm thats not better

    Code:
    #include <windows.h>
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
    
    char filePath[256] = "";
    int len = GetModuleFileName(NULL, filePath, 256);
    strcat(filePath, "trololol.exe");
    
    }
    what about the filePath????

  13. #10
    whit's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    7,159
    Reputation
    490
    Thanks
    2,253
    Quote Originally Posted by Jetamay View Post
    Using the shell is usually a bad idea.
    [/url]
    He wasnt asking for a Good nor bad idea..
    I gave him some that can be easily C&P as he was having problems