DatMCEyeBall Posted August 6, 2013 Share Posted August 6, 2013 (edited) I wrote a quick program in Managed C++ (CLR), when I compile it, it works on windows 7 and vista but when I try to run it on windows XP I get: Any reason why this happens? I'm using visual studio 2012, but I might try 2010 to see if that fixes the problem. Here's the code: expandcollapse popup// The following example codes demonstrate retrieving email from Gmail IMAP4 server // To get full sample projects, please download and install EAGetMail on your machine. // To run it correctly, please change email server, user, password, folder, file name value to yours #include "stdafx.h" using namespace System; using namespace System::IO; // Add EAGetMail namespace using namespace EAGetMail; int main(array<System::String ^> ^args) { // Create a folder named "inbox" under current directory // to save the email retrieved. String ^curpath = Directory::GetCurrentDirectory(); String ^mailbox = String::Format("{0}\\inbox", curpath); // If the folder is not existed, create it. if (!Directory::Exists(mailbox)) { Directory::CreateDirectory(mailbox); } // Gmail IMAP server is "imap.gmail.com" MailServer ^oServer = gcnew MailServer("imap.gmail.com", "someuser@gmail.com", "thisisnotapassword", ServerProtocol::Imap4 ); MailClient ^oClient = gcnew MailClient("TryIt"); // Enable SSL connection oServer->SSLConnection = true; // Set 993 IMAP4 SSL port oServer->Port = 993; try { oClient->Connect(oServer); array<MailInfo^> ^infos = oClient->GetMailInfos(); for (int i = 0; i < infos->Length; i++) { MailInfo ^info = infos[i]; Console::WriteLine("Index: {0}; Size: {1}; UIDL: {2}", info->Index, info->Size, info->UIDL); // Receive email from Gmail IMAP server Mail ^oMail = oClient->GetMail(info); Console::WriteLine("From: {0}", oMail->From->ToString()); Console::WriteLine("Subject: {0}\r\n", oMail->Subject); // Generate an email file name based on date time. System::DateTime d = System::DateTime::Now; System::Globalization::CultureInfo ^cur = gcnew System::Globalization::CultureInfo("en-US"); String ^sdate = d.ToString("yyyyMMddHHmmss", cur); String ^fileName = String::Format("{0}\\{1}{2}{3}.eml", mailbox, sdate, d.Millisecond.ToString("d3"), i); // Save email to local disk oMail->SaveAs(fileName, true); // Mark email as deleted from Gmail IMAP4 server. oClient->Delete(info); } // Quit and pure emails marked as deleted from Gmail IMAP4 server. oClient->Quit(); } catch (Exception ^ep) { Console::WriteLine(ep->Message); } return 0; } EDIT: I accidentally put my password so anyone can read my emails..fixed. Edited August 6, 2013 by DatMCEyeBall "Just be fred, all we gotta do, just be fred." -Vocaliod "That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha @tabhooked Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation Link to comment Share on other sites More sharing options...
wraithdu Posted August 6, 2013 Share Posted August 6, 2013 You need to install the VS 2012 runtime redistributables on your XP machine. Link to comment Share on other sites More sharing options...
DatMCEyeBall Posted August 6, 2013 Author Share Posted August 6, 2013 You need to install the VS 2012 runtime redistributables on your XP machine. Is there a way to do this if the target machine(s) don't have the VS 2012 runtime redistributables, or do the owners have to install them? "Just be fred, all we gotta do, just be fred." -Vocaliod "That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha @tabhooked Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation Link to comment Share on other sites More sharing options...
wraithdu Posted August 6, 2013 Share Posted August 6, 2013 I don't know exact steps, but if you distribute your app with an installer, you could have the installer install the required runtimes. Otherwise, no, the owner has to install them. Link to comment Share on other sites More sharing options...
wraithdu Posted August 6, 2013 Share Posted August 6, 2013 (edited) Actually, I think you could also statically link the runtime to your EXE. That would be in your project settings somewhere. I haven't built any EXEs with VS 2012 so I can't say where that option is exactly, or if you actually can do that. I've done it with DLLs, that's all. Edited August 6, 2013 by wraithdu Link to comment Share on other sites More sharing options...
DatMCEyeBall Posted August 6, 2013 Author Share Posted August 6, 2013 (edited) This page on mdsn explains it, but thanks anyways! Actually, I think you could also statically link the runtime to your EXE. That would be in your project settings somewhere. I haven't built any EXEs with VS 2012 so I can't say where that option is exactly. Well, what version of VS do you use? Edited August 6, 2013 by DatMCEyeBall "Just be fred, all we gotta do, just be fred." -Vocaliod "That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha @tabhooked Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation Link to comment Share on other sites More sharing options...
wraithdu Posted August 6, 2013 Share Posted August 6, 2013 VS 2012 on Win 8. Your link shows how to change the required platform, but doesn't integrate or install it. The target machine will still have to have what you're requiring. Better thread that explains more about the Runtime Library and /MD versus /MT. http://stackoverflow.com/questions/14749662/microsoft-visual-studio-c-c-runtime-library-static-dynamic-linking Link to comment Share on other sites More sharing options...
DatMCEyeBall Posted August 6, 2013 Author Share Posted August 6, 2013 So how is AutoIT compiled to run without any Runtimes? "Just be fred, all we gotta do, just be fred." -Vocaliod "That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha @tabhooked Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation Link to comment Share on other sites More sharing options...
Unsigned Posted August 7, 2013 Share Posted August 7, 2013 (edited) So how is AutoIT compiled to run without any Runtimes? AutoIt is written in native (unmanaged) C++ As for your problem, have you checked the .NET runtime version that you're targeting? VS2012 targets .NET 4.5 by default, but Windows XP only supports up to 4.0. You may need to change the targeted runtime in your project. Edited August 7, 2013 by Unsigned . Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now