Click here to Skip to main content
15,895,538 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to connect to database in MFC? Pin
cx_jin7-Nov-07 15:18
cx_jin7-Nov-07 15:18 
Questionhelp me Pin
SnaKeBeD5-Nov-07 21:06
SnaKeBeD5-Nov-07 21:06 
AnswerRe: help me Pin
Hamid_RT5-Nov-07 21:08
Hamid_RT5-Nov-07 21:08 
GeneralRe: help me Pin
Nelek5-Nov-07 21:16
protectorNelek5-Nov-07 21:16 
GeneralRe: help me Pin
Hamid_RT5-Nov-07 21:27
Hamid_RT5-Nov-07 21:27 
AnswerRe: help me Pin
ThatsAlok5-Nov-07 21:21
ThatsAlok5-Nov-07 21:21 
QuestionUrgent please help , problem with relative path and win32 / MFC appliction Pin
xanagan6665-Nov-07 20:30
xanagan6665-Nov-07 20:30 
AnswerRe: Urgent please help , problem with relative path and win32 / MFC appliction [modified] Pin
Nelek5-Nov-07 20:49
protectorNelek5-Nov-07 20:49 
To ensure that you are in your APP folder:

char FileName[MAX_PATH];
GetModuleFileName(NULL, FileName, MAX_PATH);
CString m_szPath = FileName;
m_szPath = m_szPath.Left(m_szPath.ReverseFind('\\'));


Afterwards you can this to open/create files in the folder or whatever you need.

m_szPath += "MyDll.dll";

HINSTANCE hInst = LoadLibrary (m_szPath);


or...

m_szPath += "AnyDataFile.ext";

CFile f (m_szPath, CFile::modeCreate | CFile::modeWrite);



And with this you don't have to worry about the CurrentDirectory modified by CFileDialog, actually I use both options, but for different things.

Hope it helps


EDIT: Ups, I missed your "since absolute path dont desired", your idea about saving the current directory in a variable and set it back after modifying will work perfectly. But watch out here you save it. You may overwrite it without pretending it.


-- modified at 3:11 Tuesday 6th November, 2007

Greetings.

--------
M.D.V.

If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?

Help me to understand what I'm saying, and I'll explain it better to you

Wink | ;)

GeneralRe: Urgent please help , problem with relative path and win32 / MFC appliction Pin
xanagan6665-Nov-07 21:13
xanagan6665-Nov-07 21:13 
GeneralRe: Urgent please help , problem with relative path and win32 / MFC appliction Pin
Nelek5-Nov-07 21:21
protectorNelek5-Nov-07 21:21 
AnswerRe: Urgent please help , problem with relative path and win32 / MFC appliction Pin
Llasus5-Nov-07 20:50
Llasus5-Nov-07 20:50 
GeneralRe: Urgent please help , problem with relative path and win32 / MFC appliction Pin
xanagan6665-Nov-07 21:33
xanagan6665-Nov-07 21:33 
Questionmaking two DLLs into one DLL Pin
George_George5-Nov-07 20:29
George_George5-Nov-07 20:29 
AnswerRe: making two DLLs into one DLL Pin
ThatsAlok5-Nov-07 21:24
ThatsAlok5-Nov-07 21:24 
GeneralRe: making two DLLs into one DLL Pin
George_George5-Nov-07 21:44
George_George5-Nov-07 21:44 
GeneralRe: making two DLLs into one DLL Pin
ThatsAlok5-Nov-07 22:44
ThatsAlok5-Nov-07 22:44 
AnswerRe: making two DLLs into one DLL Pin
toxcct6-Nov-07 3:17
toxcct6-Nov-07 3:17 
GeneralRe: making two DLLs into one DLL Pin
Mark Salsbery6-Nov-07 5:17
Mark Salsbery6-Nov-07 5:17 
GeneralRe: making two DLLs into one DLL Pin
toxcct6-Nov-07 5:26
toxcct6-Nov-07 5:26 
JokeRe: making two DLLs into one DLL Pin
Nelek6-Nov-07 21:16
protectorNelek6-Nov-07 21:16 
GeneralRe: making two DLLs into one DLL Pin
toxcct6-Nov-07 21:23
toxcct6-Nov-07 21:23 
QuestionMenu Item? Pin
gunaarun5-Nov-07 19:52
gunaarun5-Nov-07 19:52 
AnswerRe: Menu Item? Pin
Rajesh R Subramanian5-Nov-07 20:29
professionalRajesh R Subramanian5-Nov-07 20:29 
AnswerRe: Menu Item? Pin
Hamid_RT5-Nov-07 20:53
Hamid_RT5-Nov-07 20:53 
QuestionMenu Item? Pin
gunaarun5-Nov-07 19:47
gunaarun5-Nov-07 19:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.