Can't run my C++ Win32 program

Trying to run this code, I can't see anything wrong with it.
I'm using VC++2010. When it opens it doesn't do anything, maybe that's just on my computer?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>
#include <cstdio>
#include <string>
#include <atlstr.h>
#include <Windows.h>

int main()
{
	using namespace std;
	string open = "iuuq;00xxx/zpvuvcf/dpn0xbudi@w>eRx5x:XhYdR";
	for (int i = 0; i < open.length(); i++)
	{
		open[i] = open[i] - 1;
	}
	CString str= open.c_str();
	CString action= "open";
	ShellExecute(NULL,action,str,NULL,NULL,SW_SHOW);                                  
	return 0;
}
It does work.

I've tweaked it a bit. I've removed the ATL strings (unnecessary here) and used the ASCII interface.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <Windows.h>
#include <string>

int main()
{
	std::string open = "iuuq;00xxx/zpvuvcf/dpn0xbudi@w>eRx5x:XhYdR";
	for (size_t i = 0; i != open.length(); ++i)
	{
		open[i] = open[i] - 1;
	}

	ShellExecuteA(NULL,"open",open.c_str(),NULL,NULL,SW_SHOW);

	return 0;
}
Topic archived. No new replies allowed.