std::vector<std::string> and push_back

admin

Administrator
Staff member
I operate a bunch of web sites so I was trying to make my list using

Code:
#include &lt;stdio.h&gt;
#include &lt;tchar.h&gt;
#include &lt;string&gt;
#include &lt;vector&gt;
#include &lt;iostream&gt;
#include &lt;iomanip&gt;
#include &lt;windows.h&gt;
//.......................................
#include "stdafx.h"

 HWND vbrowser;
 std::vector&lt;std::string&gt; sites;
 sites.push_back("https://hardcoregames.azurewebsites.net/wp-admin/");


 wchar_t *convertCharArrayToLPCWSTR(const char* charArray)
 {
//  wchar_t* wString = new wchar_t[4096];
    MultiByteToWideChar(CP_ACP, 0, charArray, -1, wString, 4096);
    return wString;
 }

 int main()
{
     CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
    ShellExecute(vbrowser, convertCharArrayToLPCWSTR("open"), convertCharArrayToLPCWSTR(url.c_str()), NULL, NULL, NULL);
     return 0;
 }

so I was thinking, I can hard code the sites, I only operate a few

but when I was attempting to use:

Code:
 sites.push_back ("https://hardcoregames.azurewebsites.net/wp-admin/");

vc 2017 did not like that, says there is no storage class or type specifier, then it suggested I use a semicolon;

my project is to open the admin page, and wait a few bit before moving on to the next site

vc 2017 community edition

I was wanting to be able to bring up the admins screens in wordpress

Code:
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
ShellExecute(vbrowser, convertCharArrayToLPCWSTR("open"), convertCharArrayToLPCWSTR(url.c_str()), NULL, NULL, NULL);