|
Roger Wright wrote:
What I'm trying to do is quickly gain some experience with ODBC in C++ in preparation for a hoped for interview in a few weeks, coming from a history of doing only dialog and console apps. I found out in the first interview that they're using MFC to access SQL Server and a database on a remote AS400 system, so I suspect ODBC is the best choice for me to tackle first.
A lot depends on the age of their code and the experience of their current developers. I haven't used MFC built in CRecordset/CDatabase stuff since about '98.
If you've used ADO with VB/ASP, then using it in C++ is pretty much the same, apart from having to do a bit more typing.
The #import "C:\Program Files\Common Files\System\ADO\msado15.dll" generates a nice ADO COM wrapper which will let you do most database calls just like you would with ASP. There are some good classes here on CP which go into further detail.
I haven't looked at the MFC classes in quiet a while, but as they are quiet old MSDN has plenty of topics on the subject.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_Database_Topics_.28.General.29.asp[^]
might be a good starting point (if you haven't already seen it)
Michael
Blue canary in the outlet by the light switch
Who watches over you
Make a little birdhouse in your soul - They Might Be Giants
|
|
|
|
|
Michael P Butler wrote:
A lot depends on the age of their code and the experience of their current developers
Considering that the IS Manager I interviewed with this week proudly displays a framed MFC Certificate on his wall, I think I'm fairly safe in assuming that MFC is the way to go for now. He also informed me that they use VS6 exclusively and have no near-term plans to move to .Net. I don't know about the experience level there, but the boss is an accountant who taught himself programming and one of the staff I met teaches at the college (VS5). I know I have a lot to learn, but it shouldn't be hard to manage; besides, it's so much easier to learn quickly when you have access to coworkers with more detailed knowledge. The code is old, but they're staffing up for a complete rewrite of the casino player management system, and I want to play!
Thanks for the link! I've been there before, but I'll be spending a lot of time with it.
"Your village called - They're missing their idiot."
|
|
|
|
|
If you really want to shine, you could always use OLE DB. Sure, it's a bit more low level than ADO, but if you're not dealing with data bound controls, then ADO doesn't really offer anything but tedious _bstr_t s and _variant_t s.
OLE DB consumers (client code) are quite easy to get going with as this article[^] shows. <plug>And if you'd like nice versions of CCommand and CDynamicAccessor, then you can always try out my stuff[^]. It probably won't compile with VC6, but I don't think it would take too long to get it to work with VC6.</plug>
But using static accessors (used in the first article I mention), you'll get perfomance ADO won't ever come close
--
He is the painkiller. This is the painkiller!
|
|
|
|
|
Hi
I am not using mfc or any kind of complex thing
I just work with windows forms using c++.
My question is how can I have a have the following.
by clicking the fist Button. user starsts a while loop. In the loop a series of events take place, and then we ask the user to input something to textBox. user enters the data and,clicks the 2nd Button. the program gets the data and goes back to the loop continueing its job.
what i have so far is :
private: System::Void 1stbtn_Click(System::Object * sender, System::EventArgs * e)
{
while (mycondition is true)
{
...do the job
wait for 2ndbtn to be pressed;
...do the job
}
}
private: System::Void 2ndbtn_Click(System::Object * sender, System::EventArgs * e)
{
lol = textBox->Text;
}
what is the sytax and what libreries should be used?
|
|
|
|
|
You're thinking sequentially, which is not how windows forms (or any windows based program) works. The wait for the 2nd and further button is done by .NET itself.
Thus, when the first button is clicked, you do some stuff inside it's handler. When the second button is clicked, you do some stuff inside it's handler and so on.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I want to write a function that will have a different return type depending on the state of the class. i.e. - something like this for my header file:
if(this->SomeProperty & CHECK_PROP)
CFoo& operator()(const CClass&);
else
CBar& operator()(const CClass&);
I'm thinking templates, but when I tried this:
template <typename T> T& operator()(const CClass&)
{
if(this->SomeProperty & CHECK_PROP)
return m_foo;
else
return m_bar;
}
I would do: (knowing CHECK_PROP is set)
foo = testClass(m_class);
and that would generate:
<br />
error C2783: 'T &CTestClass::operator ()(const CClass&)' : could not deduce template argument for 'T'<br />
Any ideas how I could accomplish this without writing two seperate functions.
(which I tried, but you cannot have functions with the same signature that differ only by return type )
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
This cannot be done. How did you expect to know the type the function would return when assigning the return value to a variable?
What I suggest you do is derive the two types that your functions would return from a common class, have it return that and then do a dynamic downcast to determine which type was returned.
Ivor S. Sargoytchev
Dundas Software
|
|
|
|
|
Hello all,
I just wanted to ask if any of you know how to hook the Startbar for just the following messages - I'm new to this hooking stuff, and a lot of it doesn't make sense to me so if you could be gentle, that would be great:
WM_ACTIVATE
WM_MOUSEMOVE
WM_MOUSELEAVE (by using TrackMouseEvent on the Startbar)
I want to try and not use a global hook since I'm just hooking 1 window, but if that is what I need to do, I guess I'll do it. Any suggestions?
Sean Payne
|
|
|
|
|
Hello there
I was wondering if there is anybody who could help me out, or point me in the right direction on the following issue:
I would like to implement a toolbar that changes dynamically between a compact and an extended mode, depending on where the user decides to dock the toolbar.
In my app I the user can choose a number of different objects to draw in a window, to delete the selected one, and to delete them all.
This toolbar is currently implemented with an initial dropdown menu toolbutton that contains all the objects (with a default when just the button is clicked), and the two toolbar buttons for delete selected, and delete all. This is exactly the functionality that I am looking for when the toolbar is horizontally docked (i.e. top or bottom). (This compact mode would in my case contain three buttons.)
What I am (unsuccessfully) trying to implement, is for this compact toolbar to dynamically change to an extended toolbar, if the user chooses to dock it vertically. This extended toolbar would - instead of the dropdown menu - contain all the different objects on individual buttons (ideally with separators where the menu has separators), with the two delete buttons at the end (i.e. bottom). (This extended mode would in my case contain nObjectCount + 2 buttons.)
(Have I made my problem clear enough???)
Does anybody know how to detect that the toolbar docking state is changing and how to dynamically add, delete or hide buttons?
/jnks
|
|
|
|
|
I can help out with one side of it. You can change the buttons on the toolbar by just calling LoadToolbar(ID) on it again. If you have 2 versions of your toolbar resource available for horizontal and vertical dock, you just need to call the LoadToolbar() with the correct ID on your toolbar object.
As for detecting the docking.... I will do a quick bit of research.
Roger Allen - Sonork 100.10016
If your dead and reading this, then you have no life!
|
|
|
|
|
If you override CFrameWnd::RecalcLayout in your CMainFrame clas, you should get a call here everytime the window is resized or the docking layout changes.
To see whether the toolbar is horizontal or vertically docked, my best suggestion is to get the rectangles of the 1st and 2nd items in the toolbar and see whether it is to the right (horizontal) or below (vertcal) to work out the docking state. Then if its different call LoadToolbar() with the correct resource ID to get the version of the toolbar you will need.
You will need at least the same 2 buttons in both toolbar resources for this to work.
Roger Allen - Sonork 100.10016
If your dead and reading this, then you have no life!
|
|
|
|
|
Thanx. I'm trying it now.
Do you know if there is any way to ask the toolbar the ID of it's loaded resource?
|
|
|
|
|
Hello again
Never mind my previous question. I just ask the toolbar for the index of the dropdown button that is only present in the compact version.
Almost everything works great, the only problem is that I need for the toolbar to recalculate its size when it becomes floating after it has been vertically docked. But I think I can figure this one out.
/jnks
|
|
|
|
|
I have a dialog window with a Tab Control. When I run the program the Tab Control is covering the text that should be a part of the Tab. If I call UpdateData(FALSE) two of the text controls are shown but not all of them. I'm can't find a way to send the Tab Control to the back of the frame or don't know if this is the problem. Any suggestions would be helpful.
Steve
|
|
|
|
|
Is it possible to buy a dvd or cd with all the CP MFC/c++ articles/demos/srcs?
Thanks,
ns
|
|
|
|
|
Ooohhh! Wouln't that be sweet!
Chris? Any plans?
I Dream of Absolute Zero
|
|
|
|
|
But then you'd never visit!
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Not true!!!
Its just that I have this awful thought that someday I'll try to come to the site and it will have vanished!!! I know I know --- its ridiculous...but there it is. The CD would just give me some peace of mind ya know! And we could buy new ones every 3-4 months with the updated and new articles....
I use CP articles etc all the time! I'd say 90% of what I've learned in programmming so far has been thanks to this site....
|
|
|
|
|
What happend to the TabCtrl?
I've tried to add a XP-style vertical TabCtrl in a litle application and was all amazed to get rubbish instead of a cool gui. Off course I added a mainfest and called InitComm... (you know what to do). But the tabs are drawn like horizontal tabs, though nicely placed and sized. No text on the tabs at all. The mouse interface still works fine, you even get hottracking, but of what use is that.
Than I sayed: I'l draw it myself! Bu Oh oh. After a troublesome time, scanning the 'Visual styles' documentation in the MSDN (which is by the way deep below MSDN standards in size and quality):
There are only style-definitions for vertical tab controls. Am I right or am I blind?
Someone must have seen this before. Please help!
( PS: I've just tried TCS_BOTTOM style -> )
|
|
|
|
|
XP Themes don't support vertical style tabs. Sorry.
--
Joel Lucsy
|
|
|
|
|
... and bottom tabs.
but thanks anyway
|
|
|
|
|
I think you forgot to include the implementation.
Are the implementation files (.cpp ) included in your project ? or if it's a lib, added to the lib include setting in the project setting;
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
yup, thats it.
i was including the .h files, not the .cpp files.
everythings working now.
cheers.
btw, do you know any links where i can learn about the whole compiling/linking process, and how to create libraries etc.
thanks for your help,
henry
|
|
|
|
|
wht's the exact effect of the functions Escapecommunication(SETBRK) and Escapecommunication(CLRBRK) on serial port
can any one have an answer plz.....
adi
|
|
|
|
|
I haven't used the function (nor even seen it), but I do recall a lot about ancient communication methods. Modems using the Hayes AT command set used to have an escape pattern that would access the modem, rather than transmittting the data following it over the communication link. This was +++ and it was used issue commands. The BRK command interrupts the data flow until it is cleared. This is used when a buffer is full to prevent the opposite end of the connection from continuing the stream of data. Where did you run across this? Google and MSDN return nothing.
"Your village called - They're missing their idiot."
|
|
|
|