Start process in the same folder as the .dll

Posts 110 of 10 · Page 1 of 1
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
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"
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
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()
Or take the easy way out
[Highlight=cpp]
system("Start firefox.exe");
[/Highlight]
Quote Originally Posted by radnomguywfq3 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
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.
Quote Originally Posted by 'Bruno 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 ._.
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????
Posts 110 of 10 · Page 1 of 1

Post a Reply

Tags for this Thread

None

Need help?