Hi everyone. I need to detect whether or not DAO 3.5 or higher is installed on a system, specifically the Jet engine. Both my installer and the program itself will detect this. I looked over at codeguru and found an article which says to check to see if the key "HKEY_LOCAL_MACHINE\Software\Microsoft\Jet\3.5\Engines". I assume, logically, I would check to see if the Jet 3.5 subkey exists to check if the Jet 3.5 engine is installed. My question is, is this the best way to do this, and is it the way Microsoft recommends? I searched MSDN for hours and couldn't find an article on the proper way to detect a DAO installation. And, will this work if the user has a higher version than 3.5 installed? Thanks!
John Clump
Posts
-
How Do I Detect DAO Installed? -
CDaoDatabase Open Jet Database CrashingHi everyone. I have an MFC app which usesDAO to access Jet/Access databases. The development machine is Win2000 sp3 with Visual Studio 6 installed. The app is statically linked so MFC DLL version conflicts shouldn't be an isue. The app works 100% of my development machine, but I tried it on a Win98se machine and it won't open a Jet database file. The Win98se machine has DCOM98 and MDAC 2.5 installed on it, and only necessary software installed. Only my app is running whne I tested it. The app runs fine until I attempt to open a database. The code below is how I open the database
CDaoDatabase* db; CEDaoRecordset* rs; CString strSQL; long int lTemp; try { db = new CDaoDatabase(); db->Open(strDBPath, FALSE, TRUE, _T(";PWD=")); rs = new CEDaoRecordset(db); //..
strDBPath is the path to the DB Jet database file, which is known to be valid, and not read-only. Once it hits db->Open() I get an "unknown exception" error and the program closes. I know it could be anything, but does anyone have any ideas as to what could cause this? Did I forget to install something? The app is MBCS based, not unicode. -
MFC DLL Distribution QuestionHello everyone, I have a question about how to distribute the MFC DLLs with an application. I have read elsewhere how to distribute the MFC DLLs and which ones I need using Dependency Walker. I have code that properly installs the DLLs, which I believe are for all Windows versions, but I am unsure whether this is the best way to do it under Windows 2000 and XP. Instead of installing the DLLs into the system folder etc., should I put the DLLs in the application's folder along with a .local file? Or should I go ahead and install them into the system as usual for Win95/98/Me etc? Also, I have Visual C++ Professional, and could statically link to the DLLs. Is there any disadvantage to statically linking to the DLLs, instead of dynamically and having to install the MFC DLLs? Are there times when I should dynamically link, and times I should statically link? (assuming I am running VC++ professional)?
-
Getting The My Documents Path For Current UserHello everyone. I am writing a program which is going to create a new folder inside the current user's My Document folder. How do I find the path to the current user's My Document folder? ie. "c:\my documents" on Win98 or "C:\Documents and Settings\SomeUserName\My Documents" in win2000? And what should my application default to when it goes to create datafiles if run on Win95, since there is no "My Documents" folder in Win95? Default to the application's path? I was told by other developers that an application should default to the My Documents folder when creating a new datafile for the first time (like Word does).
-
Setting Dialog Tab Order With PropertysheetI looked up SetWindowPos in MSDN, and tried a few things, but none of them affected the tab order from the dialog controls to the propertysheet, and the propertysheet is last in the tab order. Here is the code I use to create the propertysheet dynamically, IDC_PPS_MAIN is a dialog resource, m_ppsMain is a CPropertysheet object. This code is ran in a dialog in its OnInitDialog() function:
m_ppsMain.Create(this, WS_CHILD | WS_VISIBLE, 0); m_ppsMain.ModifyStyleEx(0, WS_EX_CONTROLPARENT); m_ppsMain.ModifyStyle(0, WS_TABSTOP); CRect rcSheet; GetDlgItem(IDC_PPS_MAIN)->GetWindowRect(&rcSheet); ScreenToClient(&rcSheet); m_ppsMain.SetWindowPos(NULL, rcSheet.left- 7, rcSheet.top - 7, 0, 0, SWP_NOZORDER | SWP_NOSIZE); // set all pages active once to avoid assertions m_ppsMain.SetActivePage(1); m_ppsMain.SetActivePage(2); m_ppsMain.SetActivePage(3); m_ppsMain.SetActivePage(4); m_ppsMain.SetActivePage(0);
-
Setting Dialog Tab Order With PropertysheetI have a dialog box with various buttons and controls on it, as well as a static text box which is used as a placeholder, and in code it creates a propertysheet where the static text box is. I set my desired tab order, with the static text box as #13 in the tab order. But instead of tabbing off the #12 order (a button) and going to the propertysheet's active tab/page, it goes to the #14 control (a listview), then, at the end of the ta order sequence, ends up on the propertysheet. Is there a way I can set the tab order so that the tab order is properly set, so that the propertysheet is #13 in the tab order? Thanks!
-
Hotkeys Listed in Dialog App MenuI have a dialog based applicattion, which uses hotkey accelerators. I used Nish's article concerning hotkeys with dialog based apps. It works fine, but I want to display the hotkey in the menu item that corresponds to the hotkey, as is standard in windows apps. Problem is, I can't get the text to line up on the right hand side, so all of the hotkeys are lined up on the right, like in most windows apps, like IE. Is there a way to set the menu item text so part of a second part of the text is lined up, so I can enter the hotkeys manually? Thanks!
-
Dynamically Setting Tab Title on PropertysheetHi everyone. I have a dialog with a propertysheet with a tab control style. The propertysheet has 5 propertypages, all of the same class. I want each tab to have a different title on it, eg. "One", "Two", etc. Since they are all of the same class, I can't set the title statically. In the propertypage's OnInitDialog() I try to set the title, but it won't change the title on the tab. Is there a way to set the tab titles in the propertypage's OnInitDialog()? I could create 5 different dialog classes for each propertypage and could set the title statically, but that would be wasteful. I use the code below. It doesn't set the title. It also crashes when the program is in release mode, which I can't understand. Thanks for any help!
BOOL CDlgMyDialog::OnInitDialog() { CDialog::OnInitDialog(); //... // m_ppgMyPropPages is an array of m_ppgMyPropPage for(i = 0; i < 5; ++i) { m_ppgMyPropPages[i].SetMode(i); m_ppsMyPropSheet.AddPage(&m_ppgMyPropPage[i]); } // create the sheet m_ppsMyPropSheet.Create(this, WS_CHILD | WS_VISIBLE, 0); m_ppsMyPropSheet.ModifyStyleEx(0, WS_EX_CONTROLPARENT); m_ppsMyPropSheet.ModifyStyle(0, WS_TABSTOP); CRect rcSheet; GetDlgItem(IDC_PPS_MAIN)->GetWindowRect(&rcSheet); ScreenToClient(&rcSheet); m_ppsMyPropSheet.SetWindowPos(NULL, rcSheet.left- 7, rcSheet.top - 7, 0, 0, SWP_NOZORDER | SWP_NOSIZE); //... } BOOL CPpgMyPropPage::OnInitDialog() { CPropertyPage::OnInitDialog(); if(m_iMode == 0) SetWindowText("One"); if(m_iMode == 1) SetWindowText("Two"); if(m_iMode == 2) SetWindowText("Three"); if(m_iMode == 3) SetWindowText.SetWindowText("Four"); if(m_iMode == 4) SetWindowText.SetWindowText("Five"); //.... }
-
CFile QuestionHi everyone. I have a question about the use of CFile. I have the code below, and the filename is that of a file which I have tested and determined exists, and is not shared. The file is an HTML file, and I want to take the contents of the HTML file (the text), and put it into a CString. The string will then be parsed and the hyperlinks extracted.
CFile cFile; CString strFileContents; cFile.Open(m_strFileName, CFile::modeRead | CFile::shareExclusive); cFile.Read(&strFileContents, cFile.GetLength()); cFile.Close();
The problem with the code above is that when the Read is performed, the program crashes. I tried using an old style C string in place of a CString, the data is read but a bunch of garbage chars are at the end of the string, and the program crashes when I hit Close(). Anyone know what I am doing wrong? I really want the file contents in a CString, because the necessary memory is allocated dynamically, and the CString Find functions are great for parsing. -
How Do I Test If A File Is Open By Another Process?Here is a simple question I have had a hard time finding an answer for. I have a program which reads and writes MS Jet DB (.mdb) files. I want to make sure that the files are not in use by another process, and the the program has exclusive access to the file. Is there a function that I can use to determine if the file is open or not? Or should I use the CDaoDatabase functions to see if it is use? I assume I should test the file to see if it is open. I know CFile will return an error, but is there a way to test if the file is open before it is opened? Thanks for any help!
-
CSV File FormatTurns out one doubles up quotes within the data string. Thanks for the link! ;)
-
CSV File FormatHi everyone. I recently wrote a program which saves data into a CSV (comma separated value) file. I searched and was unable to find the exact specifications for the format. Since each data string is surrounded in quotes in the file itself, how do I handle quotes in the data string itself? Do I leave them, and only change the commas between quotes, which signify a break between strings? And if I change them, what do I change them to? One CSV file I downloaded had the quotes in the strings changed to %22's. Anybody know more or where I can find more info, so my CSV is compatible with other programs which may read it?:confused:
-
Serious Warning to Norton Anti-Virus UsersI am running win2000, Norton AV 8.0 (2002) and C++ 6.0 and never had a problem like that. Maybe it is a different version of AV? Or a WinXP issue? That does sound very serious, I hope Norton or MS addresses that. :(
-
Dynamically Changing CComboBox From Dropdown To DroplistThanks! Your code worked great, except the dropdown height was not preserved, and I could not change it via SetDroppedWidth(). So the user could not see the "Yes" and "No" I put in the combobox. The font and such were preserved. Why couldn't I change the dropped width?
-
Dynamically Changing CComboBox From Dropdown To DroplistHi everyone. I have a dialog with 2 combo boxes, one is for setting what kind of data which will be put into the second combo box. For example, "String" will set the data box into a dropdown were the user can type in a string, or "boolean", which would set the data box into a drop list (where there are two entires, "Yes" or "No". I want to be able to do this dynamically, as the user selects either "String" or "boolean". I tried the following to set the data combobox from a dropdown to a drop list, with the dropdown already successfully created by default in the resource editor. When this code is run, the combo box font changed, the size of the box changed, and I could not set the drop down width to anything, and the width would be zero. The combobox did change to droplist though. Is it possible to change the combobox from sropdown to drop list dynamically? Is there a correct way to do it, so I don't have to use an extra combobox? Thanks in advance for any help!
// pFrom is a pointer to a CComboBox control CRect rect; pFrom->GetWindowRect(rect); ScreenToClient(rect); pFrom->DestroyWindow(); pFrom->Create(CBS_DROPDOWNLIST, rect, this, IDC_CBO_DATA); pFrom->AddString("Yes"); pFrom->AddString("No"); pFrom->SetCurSel(0); pFrom->ShowWindow(TRUE); pFrom->EnableWindow(TRUE); pFrom->SetDroppedWidth(70);
-
CSV file databases and DAOI could do that, and still might. Creating the file isn't too bad, but parsing it back out will be a chore, possible to do but a chore. I was hoping DAO could read the file back for me. Oh, well :rolleyes:
-
CSV file databases and DAOHi everyone. I have a program which opens and writes to MS Jet databases using DAO. I want to be able to open a table in a Jet database and convert it to a CSV (comma separated value) database. MSDN says you can use DAO to read/write to CSV databases, but I cannot find any examples on how to do this. Do you use it just like Jet database? Any help is greatly appreciated!
-
Turning Off Web page Debugging Under Visual Studio 6Hi everyone. I have various web filtering software, which filters out various unwanted content. This, as a side effect, "breaks" various scripts and I constantly get messages about whether or not I want to debug the web page (obviously, I wouldn't). Is there a way to tell Visual Studio I do not want to debug web pages? I have put up with it for a while, but it is very annoying :-D
-
Best Way to Get Installed DLL VersionHi everyone. In a program I am writing, I need to check which version of some system dlls are installed, for example. mfc42.dll, comctrl.dll, and a few others. I know there is a few ways of doing this, but what would be the "best" way to do this so that it will be compatible with future versions of Windows, and requires the least amount of overhead? Thanks in advance for any help!
-
MFC+DAO database, 0 records inspite of data in fileNot sure if you know this already or not, so please forgive me if it is obvious. Try calling the CDaoWorkspace::RepairDatabase function. Set up a CDaoWorkspace with your database, then call the function. I believe this will fix your problem. The other way I can think of is it to make a copy of the database (use the compactdatabase function of CDaoWorkspace), set a flag, then if the update is successful reset the flag. If the machine crashes, it will check that flag, and if set will erase the old database and replace it with the new. These only work with Jet databases, but you mentioned access so I assume they are always Jet databases ;)