|
Of course, you're right, OLEDB/ATL is not easy and may be overkill. And my comment about ADO was just kidding - I think ADO is good for simple DB apps with low requirements to performance and amount of data. I just don't think that DAO is easier than ADO (it's even the same three letters, just shuffled around ), and I don't think ODBC is easier than any of them.
But if the app has any seriousness in it it should use OLEDB/ATL (or a native interface)
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Steen Krogsgaard wrote:
I just don't think that DAO is easier than ADO
I disagree - it's waay easier to use CDaoXXX classes which are integral part of MFC than to #import ADO stuff. For simple app accessing .mdb files it's more than enough.
Steen Krogsgaard wrote:
should use OLEDB/ATL (or a native interface)
You mean Jet native interface? This would kill any chances of easy migration to real SQL database. Long time ago when I was actually working with OLEDB we had a quite compilcated program which could easily run on Jet or MSSQL without recompiling.
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
Tomasz Sowinski wrote:
You mean Jet native interface?
No, I actually ment native interfaces to databases that are more enterprise-minded (like SQL Server, DB2, Oracle, MySQL etc). I'm not even sure there is a native Jet interface? I guess DAO is the closest you get to a native Jet interface. And native interfaces should only be used if performance is more important than portability. That's what I like about OLEDB - you get a reasonable performance and a high degree of protability.
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
This may depend on the version of the OS and/or the version of the ODBC driver... but check to see if you can set the buffer size. I think I ran into something like when moving one of my application to ME and I may have been moving to a newer ODBC driver at the same time (sorry I don't have details on version number just now). Anyway I think there was something that set the buffer to 1024 and I changed it to 256 (or something like that).
|
|
|
|
|
I have a custom control derived from CListBox and instead of using DrawItem I am using OnPaint() instead because the gui is to complex for OwnerDraw (Or so i've determined while attempting to do so).
Anyways the question I have is this:
I have created the listbox with the extended BIT checked and have had problems while painting the control for multiple selection (Although this would be really nice feature).
Using GetSel() and GetCaretIndex()
Doesn't seem to work and causes problems when drawing multiple selections (like drawing items which aren't really selected).
I'm thinking of using the CListBox::GetSelItems() instead, but would prefer to use the above for simplicity. Has anyone ever tried this before and had better luck with using the multiple selection functions...?
Thanks!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I've always used DrawItem() for custom painting of list boxes....Which has always worked well for me....I know that typically DrawItem code can look complex ( and it can be if you are doing way over the top custom painting ) but it works well nonetheless.
There are dozens of samples on this site of how to use that approach. If you can't get your approach working, maybe you should consider the DrawItem approach.....
Just trying to keep the forces of entropy at bay
|
|
|
|
|
AFAIK DrawItem() won't work so i'm left with no choice but to draw with OnPaint() instead.
Everything works fine, but the hilighting of multiple selections.
Ah well it's not really required it would just be nice...
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hi All,
I need to access some properties of the computer using the ADSI interface.The interface I'm using is the IADsDomain interface.To use this interface I need to get the object of the active directory which I'm doing by the ADsGetObject method.The first parameter to be passed to this methos is the binding string to the particular object.
Since I want to connect to the local computer I'm using the string::
"WinNT://computername,computer"
But the method is not getting executed properly and I'm not able to get the handle of the object.
Can anybody help me out regarding this.
Thanks,
Abhishek.
Learning is a never ending process of Life.
|
|
|
|
|
How can I define the transparent color of the bitmaps I added to a tree control?
I have a tree control with a image list. So, some bitmaps should have a transparent background, when I added in the tree control. How can I define, that a special color (like red, ...) are the background color, and doesn't draw in the tree control?
--
Nice greets, Daniel.
|
|
|
|
|
Use the ILC_MASK in addition to ILC_COLORxxx flag when creating the CImageList, and use the right Create method btw to pass the key color :
BOOL Create(
UINT nBitmapID,
int cx,
int nGrow,
COLORREF crMask
);
sometimes it helps to look at the IL generated code
a MS guy on develop.com "answering" .NET issues
|
|
|
|
|
I created my COM dll using MFC. Now i want to fire events from it. Can anyone tell me how. (i don't want to use ATL)
|
|
|
|
|
|
I'm having a problem getting a menu to display in a window.
This is a simple class assignment. I can get the thing to show up with Create but not CreateEx. Can someone tell me why? The debugger crashes when it reaches the m_btnAdd.Create function.
The error in the debugger window first show 0x00000579 which is an invalid menu handle.
The message that is displayed at crash is:
First-chance exception in CIS279_4.exe (MFC42D.DLL): 0xC0000005: Access Violation.
I have an .rc file where the menu is created and a header file with #define IDR_MAINMENU 3000.
CString strWndClass = AfxRegisterWndClass(CS_DBLCLKS, <br />
AfxGetApp()->LoadCursor(IDC_ARROW), <br />
(HBRUSH)(COLOR_3DFACE+1),<br />
AfxGetApp()->LoadIcon(IDI_ICON1));<br />
<br />
m_btnRect = CRect(0,0,80,30);
<br />
CreateEx(WS_EX_OVERLAPPEDWINDOW, strWndClass, _T("Jeff's Calculator"), <br />
WS_OVERLAPPEDWINDOW, m_rect, NULL, IDR_MAINMENU, NULL);<br />
<br />
m_btnRect.OffsetRect(85,100);<br />
m_btnAdd.Create(_T("&Add"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, m_btnRect, this, ID_BTNADD);
My instructor has tried to help with no luck and the Prosise book and MSDN aren't specific enough. My instructor is accepting the assignment with the Create function instead so now I just have a burning desire to know.
Can anyone help?
Thanks
Jeff Patterson
Programmers speak in Code.
http://www.anti-dmca.org
|
|
|
|
|
It seems you've misinterpreted the 7th CreateEx argument. It isn't menu ID, it's menu *handle*. You need to create CMenu object, call CMenu::LoadMenu and pass the handle to CWnd::CreateEx.
In fact, the MSDN docs aren't clear on this, but quick loook at source reveals that nID parameter is cast to HMENU and passed to other CWnd::CreateEx overload, which in turn calls ::CreateWindowEx.
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
Thank you. After I figured out how to create that handle and changed the m_rect in the CreateEx to 0,0,640,480 it worked great.
This would have taken me many many hours to figure this out Thank you very much.
Jeff Patterson
Programmers speak in Code.
http://www.anti-dmca.org
|
|
|
|
|
i want to disable all those messages that are generated by the mouse and keyboard how to that untill my application is running?
and all those messages that my program send through
postmessage command must work ?
but the messages that are generated by mouse and keyboard should not work?
r00d0034@yahoo.com
|
|
|
|
|
Use a global hook
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
how to use it :
can u provide the linkk of any example where global hook is used?
or any helping metrial?
r00d0034@yahoo.com
|
|
|
|
|
I'm afraid all i've read about hooks has been from tiny numerous articles here and there across the NET and in some books I have.
In your MSDN look up the function SetWindowsHookEx
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
How do I add an MFC control (ie: CEdit) to a MDI child window? Note: I'm not using the Doc/View archictecture.
Thanks,
Dave
|
|
|
|
|
Use the controls Create() member function specifying your CView as the parent window.
If you have a lot of controls, consider using a CFormView .
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
If I'm using the code below:
Connection CDataManDlg::CreateDBConnection()
{
Connection con (use_exceptions);
try {
con.connect ("fatapes", m_strHost, "root");
}
catch (BadQuery e) {
TRACE (_T ("Error in CreateDBConnect = %s"), e.error.c_str ());
MessageBox (_T ("Unable to create database connection"), _T ("Connection Error"));
}
return con;
} is the reason that I can't use the 'Connection' object after the return becuase it's destroyed? Doesn't the function return a copy of the object before it gets destoryed?
Thanks in advance.
- monrobot13
|
|
|
|
|
Modify your function to return a Connection* and remember to delete the pointer after usage, perhaps in a different member function named CloseDBConnection.
Or add a Connection member to your CDataManDlg class.
Regards,
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Thanks for the help, it clarifies things for me.
- monrobot13
|
|
|
|
|
I have Windows XP with VC++ .NET. My program was using visual styles beautifully, until yesterday! Now my app looks like it does in Windows 98 I have absolutely no idea why it's not working, except that I was doing a little re-arranging in my resource.h. The xml file is still there, though. Could you walk me through the steps in enabling visual styles?
Thanks!
|
|
|
|