Is this a managed C++ application? If so, you can extract the directory name from Application.ExecutablePath to get the path to concatenate to your relative path.
(Using a relative path directly is unreliable because the working directory can change. OpenFileDialog/SaveFileDialog is the usual culprit for changing the working directory on you.)
If this is not a managed application, then this is the wrong forum. (But look into GetModuleFileName http://msdn.microsoft.com/en-us/library/ms683197.aspx with hModule = NULL to do the same kind of thing as Application.ExecutablePath.)
String^ s = System::IO::Path::Combine( |
System::IO::Path::GetDirectoryName(System::Windows::Forms::Application::ExecutablePath), |
"image\\image1.bmp"); |
(Using a relative path directly is unreliable because the working directory can change. OpenFileDialog/SaveFileDialog is the usual culprit for changing the working directory on you.)
If this is not a managed application, then this is the wrong forum. (But look into GetModuleFileName http://msdn.microsoft.com/en-us/library/ms683197.aspx with hModule = NULL to do the same kind of thing as Application.ExecutablePath.)