Click here to Skip to main content
15,917,565 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralAre Named Pipes Supported in Windows XP Pin
Lim Bio Liong22-Jan-03 17:53
Lim Bio Liong22-Jan-03 17:53 
GeneralSharing Dial-Up-Connection Pin
Deepak Bajaj22-Jan-03 17:52
Deepak Bajaj22-Jan-03 17:52 
Generalfastest, easiest XML library, C++ Pin
Roman Nurik22-Jan-03 17:52
Roman Nurik22-Jan-03 17:52 
GeneralRe: fastest, easiest XML library, C++ Pin
Stephane Rodriguez.22-Jan-03 19:02
Stephane Rodriguez.22-Jan-03 19:02 
QuestionDoes anyone know of universal naming convention (UNC) path? Pin
Anthony_Yio22-Jan-03 16:46
Anthony_Yio22-Jan-03 16:46 
AnswerRe: Does anyone know of universal naming convention (UNC) path? Pin
Chris Richardson22-Jan-03 19:10
Chris Richardson22-Jan-03 19:10 
Generalhelp needed Pin
BORICUA22-Jan-03 16:30
BORICUA22-Jan-03 16:30 
GeneralRelative Path not available in startup Pin
fordge22-Jan-03 15:21
fordge22-Jan-03 15:21 
I initially started this message thread as I had a problem getting the ado connection at startup....

i had written the exe path in a key in registry
"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\\Run"...though the exe startsup an ado connection error is thrown if ado connection is tried in InitInstance of the app

ive finally got it right..consider the following code

-----------------------------------
CoInitializeEx(NULL, 0x02);
try{
_ConnectionPtr mpDBConnection;
mpDBConnection.CreateInstance(__uuidof(Connection));
HRESULT hRes=mpDBConnection->Open(_T("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=database\\TrialDB.mdb;Persist Security Info=False"),"","",adConnectUnspecified);

CStartUpDlg dlg;
m_pMainWnd = &dlg;
...
...
..
-----------------------------------
this works fine when normally executed and the database connection is ok.

however in startup when saying "database\TrialDB.mdb" instead of refering to the relative path of the application it assumes it as being in "c:\" drive.....

and therefore looks for the database in "c:\database\TrialDB.mdb" ..

and obviously as there is no database there the connection fails.

however if the code is changed tohaving the follwoing lines occure before the connection is opened like below
-----------------------------------
CoInitializeEx(NULL, 0x02);
try{
CStartUpDlg dlg;
m_pMainWnd = &dlg;

_ConnectionPtr mpDBConnection;
mpDBConnection.CreateInstance(__uuidof(Connection));
HRESULT hRes=mpDBConnection->Open(_T("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=database\\TrialDB.mdb;Persist Security Info=False"),"","",adConnectUnspecified);


...
...
..
-----------------------------------
the conection works fine in startup as well..

but unfortunately as i need to do the database connection before I create the dialog object..... the question persists...

1.Why cant i get the relative path in startup????

2.Please suggest an alternative solution to get the relative path....
i mean besides using get CurrentDirectory() and that kind of stuff



Consider for example when we create a shortcut
we can specify a 'start in' directory
and all relative paths refer to this strt in directory right??

is there anywhere i can specify such a 'start in' directory for an application in registry!!!
if there is any other method to get the relative path of the app please tell me...
GeneralRe: Relative Path not available in startup Pin
Chris Richardson22-Jan-03 19:16
Chris Richardson22-Jan-03 19:16 
GeneralRe: Relative Path not available in startup Pin
fordge23-Jan-03 14:08
fordge23-Jan-03 14:08 
GeneralRe: Relative Path not available in startup Pin
Chris Richardson24-Jan-03 6:47
Chris Richardson24-Jan-03 6:47 
GeneralRe: Relative Path not available in startup Pin
jimNLX24-Jan-03 10:44
jimNLX24-Jan-03 10:44 
GeneralWhy does the following code call the same Dialog box twice? <Long> Pin
VanHlebar22-Jan-03 13:52
VanHlebar22-Jan-03 13:52 
GeneralRe: Why does the following code call the same Dialog box twice? <Long> Pin
Christian Graus22-Jan-03 14:02
protectorChristian Graus22-Jan-03 14:02 
GeneralRe: Why does the following code call the same Dialog box twice? <Long> Pin
Chris Losinger22-Jan-03 14:03
professionalChris Losinger22-Jan-03 14:03 
GeneralRe: Why does the following code call the same Dialog box twice? <Long> Pin
VanHlebar22-Jan-03 16:07
VanHlebar22-Jan-03 16:07 
GeneralRe: Why does the following code call the same Dialog box twice? <Long> Pin
Roger Allen23-Jan-03 2:25
Roger Allen23-Jan-03 2:25 
GeneralRe: Why does the following code call the same Dialog box twice? <Long> Pin
VanHlebar24-Jan-03 1:32
VanHlebar24-Jan-03 1:32 
GeneralRe: Why does the following code call the same Dialog box twice? <Long> Pin
Roger Allen24-Jan-03 1:57
Roger Allen24-Jan-03 1:57 
QuestionPossible with shell extensions? Pin
Anonymous22-Jan-03 13:49
Anonymous22-Jan-03 13:49 
AnswerRe: Possible with shell extensions? Pin
Lim Bio Liong22-Jan-03 17:27
Lim Bio Liong22-Jan-03 17:27 
GeneralRe: Possible with shell extensions? Pin
Anonymous23-Jan-03 4:34
Anonymous23-Jan-03 4:34 
GeneralMemory Management & Windows Messenger Pin
Mike.NET22-Jan-03 11:39
Mike.NET22-Jan-03 11:39 
GeneralRe: Memory Management & Windows Messenger Pin
John M. Drescher22-Jan-03 13:04
John M. Drescher22-Jan-03 13:04 
GeneralRe: Memory Management & Windows Messenger Pin
Mike.NET22-Jan-03 15:14
Mike.NET22-Jan-03 15:14 

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.