|
Actually I do not think this is a bug, the problem comes from the fact that the Access 2000 uses new version of DAO (3.6) and MFC by default supports version 3.5. To correct this all you have to do is chage version of MFC that you are using. This can be done with following line of code, just make sure that you call this before you try to open the database:
AfxGetModuleState()->m_dwVersion = 0x0601;
Pz
|
|
|
|
|
Hi,
Many many thanks. I think your line of code works. Atleast it went thru that line in debug mode.
One more thing...
I am creating an access file in runtime with this code:
db.Create("DOB.mdb", dbLangGeneral, dbVersion30);
db.Execute("CREATE TABLE DOB (Name Text, Email Text)");
What happens is that this creates a file comaptible with Access97. Now I want to create a file for Access2000. dbVersion30 is for A97. I tried dbVersion35 and dbVersion40 but these two are undeclared identifier.
How to create Access2000 mdb file?
I have VC 6.0 Enterprise Ed.
Ammar
|
|
|
|
|
Thanks for the solution. It works fine.
However I couldnt find any info on AfxGetModuleState() in MSDN. Can you help me on this? Where to find info about this API and AFX_MODULE_STATE ?
Your email address will be appreciated.
Thanks,
Ammar
|
|
|
|
|
Are all the VCPP Common Controls Active X controls? For example CEdit.
|
|
|
|
|
No - they are classes derived from CWnd.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Actually, CEdit is actually a Windows CONTROL which CEdit subclasses.
|
|
|
|
|
I'm a Windows programming beginner, been programming DOS for some time, starting to make the switch and I'm having a niggly bit of trouble trying to display a messagebox immediately after a dialog.DoModal() . Has anyone out there seen this type of behaviour where any messagebox call after a dialog box fails to be displayed? Did I miss something obvious?
The application was created as an simple MFC GUI app.
Your help is much appreciated.
//*********************************************************************
dlg.m_strWarningtext.Format(strMsgBuf);
nResponse = dlg.DoModal();
// >>>>> At this point, any messagebox call returns IDOK without even being displayed.
if (nResponse == IDOK)
{
// Do stuff
sprintf(strMsgBuf,"Messagebox text ");
nRetVal = MessageBox( NULL, (LPCTSTR)strMsgBuf, "Error", MB_OK | MB_ICONERROR );
// >>>>> nRetVal is always == IDOK and the messagebox won't display
}
else if (nResponse == IDCANCEL)
{
// Do stuff
}
//*********************************************************************
|
|
|
|
|
I don't know the answer, but if you're using MFC, replace the last two lines with
nRetVal = AfxMessageBox("MessageBox Test");
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Hello, the codegurus around the world.;)
If you use the debugger, you may find the reason.
I think that ::MessageBox() should be called in if (response == IDOK)
The other way is that we put MessageBox() in CMyDialog::OnOK().
We often tend to use MessageBox() to check something.
But, TRACE, TRACE1, and so on works also in the debug mode.
void CMyDialog::OnOK()
{
MessageBox("OK button works", "Test");
TRACE ("OK button works")
CDialog::OnOK();
}
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
Just spent 10 minutes putting together an eloquent version of this question together only for everything to screw up when I clicked the Submit button, so here is the short version.
Apologies for dumbness of question, 3 years as Consultant has left brain as mush and programming memory has faded. Decided to get back in to programming and am working through tutorials to get up to speed. Starting with do nothing dialog application that contains many of the Controls available so I have at least implemented each control and have an understanding of them.
Right now I am attempting to use the Picture Control and obviuosly am having some trouble or I wouldn't be here. MSDN CD's that shipped with Visual Studio 6 have shed no light and can't find any Code Project articles that answer my question. Picture control Properties tell me I can use Icon, Bitmap or Enhanced Metafile. If I add a control variable via ClassWizard it is CStatic, looking up it's Member Functions I find only functions for Bitmaps (just looked at Class Members and found the functions for Icons and Enhanced Metafiles).
This shortens and slightly changes the question. These functions are using HICON, HBITMAP etc. which means it isn't loading the separate files from disk but must have the files loaded via resources(???) prior to compiling.
Is this correct?
How do I load the relevant files?
If I'm not even close what should I do?
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
You can use ::LoadImage to load an image from disk if it's a .bmp or .ico ( which is a bmp with a bit of extra info ).
If you have an image as a resource and are using MFC, you can do this
CBitmap bmp;
bmp.LoadImage(IDB_BITMAP);
a CBitmap will cast to HBITMAP, if not it has a m_hbitmap member variable and a GetSafeHandle() method ( which needs casting ).
You can also set the bitmap from resources in the dialog editor.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
I am using a CComboBox with some of Chris's mod's to make it so I can enter text
and have it populate the CEdit with the CComboBox content as I am typing.
(eg: Days of the Week, if I typed 'Mond' it would display the 'ay' as selected)
This is all good stuff - Thanks Chris.
However, I would like the DropDown to work at the same time. I added:
if (!this->GetDroppedState())
this->ShowDropDown();
to the OnEditUpdate method, but no matter which methods I try none seem to allow
the typing of text to "Highlight the selection of closest match".
I really don't want to implement my own dropdown window (as in the excellent
ComboTree example), so I was hoping there was some cool way to get the Handle to
the DropDown.
If you have any suggestions, or if you actually KNOW the solution (hope hope),
please post a reply.
many thanks
Julien.
|
|
|
|
|
to get the handle to the dropdown, why not try the ChildWindowFromPoint() function specifing a point just below the edit window?
I don't know, just a suggestion
---
Multitasking: Screwing up several things at once.
|
|
|
|
|
I've finished my ID3 tag editor ( I intend to ask permission from the person whose base code I used for the ID3 stuff and then submit it ), but I have one final problem. It compiles and runs in debug mode ( and works a treat, I've been using it ), but in release the linker complains that _main is not defined. The program was created with the appwizard for WTL that was in the OCt SDK, and the main dialog class is called CMain, so I don't know if it's getting confused, but I went through the settings looking for a discrepancy and could not find one. The debug build is 370 k, the release build ( after I put a dummy main() function in that just returns 0 ) is about 74.
The release build runs and gives me a dialog, but if I click a button or my listctrl, the whole thing crashes. Which is why I think the compiler is confused as to what constitutes my main dialog class.
If anyone has any suggestions, I sure would appreciate it...
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
I know this is in the KB somewhere, but the quick synopsis is that you are using some CRT string functions, but by default release mode ATL projects don't link with the CRT, so that's why you get an unresolved symbol. Go to your project options and remove the ATL_MIN_CRT symbol from the preprocessor definitions to fix this.
--Mike--
http://home.inreach.com/mdunn/
All your base are belong to ME~!
|
|
|
|
|
Hi,
I want to monitor the audio recording level, and change it. Like in the Windows Volume Control App.
Anyone got a hint to what functions I should take a look at. I have been searching through the MSDN, but can't seem to find the right ones...
My problem is that I record my old (pre CD) records using CoolEdit, and save them as .wav files, and to change the recording level I have to use the Windows Volume Control. But, the sliders in here are small with a very rough control, so I want to make an app with some bigger (longer) sliders with a more granular control...
I just need a hint in the right direction...
- Anders
|
|
|
|
|
You want to use the Mixer API, but be warned.. It's a nightmare. It's very involved and requires a lot of work, so don't expect to get anything working very quickly.
|
|
|
|
|
Thanks
- Anders
|
|
|
|
|
<<< In the name of GOD >>>
Hi there.
I want to read from file.
I haven't any problem, but for it, i used of CString variable for get data from file.
This variable define in global mode.
Now i want to get data to LPSTR variable, in global mode, but compiler give me error.
This is my code about CString variable:
CString szText; // Global variable
.
.
.
void CEditorDlg::Loading()
{
CFile file;
file.Open("Hadi.txt", CFile::typeBinary | CFile::modeRead);
file.Read(szText.GetBufferSetLength(file.GetLength()), file.GetLength()); // I want to put LPSTR variable instead CString variable.
file.Close();
}
Thanks for reply.
Hadi Rezaie
|
|
|
|
|
Have you considered using CStdioFile?
--
Alex Marbus
www.marbus.net
But then again, I could be wrong.
|
|
|
|
|
hmmmmm.
Ok, i must use CStdioFile for it.
But i want to know which is better and faster to use CFile or CStdioFile and why ???
Thanks.
Hadi Rezaie
|
|
|
|
|
I'm not sure what's faster; using CFile and your own routine to read/write plain text line-by-line, or using CStdioFile and use ReadString and WriteString. If you write your own functions to do this, you'll probably end up doing the same thing as CStdioFile does internally (I haven't looked at the MFC code yet, no development-environment on the machine I'm currently writing this message).
CStdioFile is the right class if you only want to read/write plain text from/to file. It's very easy to use. Saves you a lot of thinking
G'luck
--
Alex Marbus
www.marbus.net
But then again, I could be wrong.
|
|
|
|
|
Ok,
I have two other questions:
Q1. What is Buffer in file that use for writing and reading from file ?
Q2. Can i use of typeBinary flag for open the file in CFile object ?
Hadi Rezaie
|
|
|
|
|
Usage of the GetBufferSetLength member function of CString class is
CString diva("Madonna");
LPTSTR ptrdiva = diva.GetBufferSetLength( 10 );
try using it like this
file.Read((void *)szText.GetBufferSetLength(file.GetLength()), file.GetLength());
as Read requires a (void *) i.e. a void ptr...
Dharne Atul
---------------------------------------
do not rely on any code till ya try it
|
|
|
|
|
Maybe its 3:30 and My Head is Not Straight, But Im having trouble Figureing this one out.
This is my First VC++ App and things are going quite well.
My Problem is I have a CListCtrl that is representing "Tasks" in a Queue. I would like the USer to Be Able to Delete any number of Selected Items in the Queue. So if they Select Five Items and Click "Remove" those Items and Their Corresponding Data will be deleted.
My problem is Navigating Through the Selected Item List.
In Other CListCtrls I use I use the Same Method of moving through the Item List with no Problem.
Whats the best Method for Deleteing Items from a CListCtrl that are Selected.
GetNExtSelected or using the LVIS_SELECTED mask to identify selected Items and remove them?
quick sample code would be appreciated.
recurse.org - Recusion For the Rest Of Us.
|
|
|
|