Use the CDatabase and CRecordset classes to access the DB.
Mike Danberg
Posts
-
How to create a login form by using a database in MFC dialog based application -
Constructor help – getting data from CListView to dialog.Couldn't you just change the colors to your desired COLOREF values in the dialog's OnInitDialog() function? Maybe it's not as nice as setting it through the constructor, but it's better than using global variables. Mike
-
reading values within std::list typesYou need to use an iterator to traverse the elements in the list. Try something like: list::iterator start = Sentences.begin() while ( start != Sentences.end() ) { if(sentence matches) // probably want to try something like string == (*start) { //do something break; // if you hit a match break } start++; } Hope that helps. There are plenty of articles on using iterators as well. -- modified at 23:54 Sunday 27th August, 2006
-
maybe a stupid Question,but need help!CFormView is the only way I know how to do that. That makes it look more like a dialog though, so might not be what you are looking for.
-
Output from screen to printerHere's some links. http://www.codeproject.com/printing/printing_wo_docview.asp[^] This is an article showing some generic printing functions. It's what I used to learn how to print. It uses MFC however. If your program isn't real big I might be able to help you out. http://www.codeproject.com/printing/printingtricksandtips.asp[^] There's some good tips in this article. http://www.codeproject.com/printing/printmechanism.asp[^] This article might help, haven't really looked at it much though. Again all of these use MFC and if your program isn't too big, maybe I can help you out with it.
-
Output from screen to printerFirst off I have seen you post this at least 4 times. Yet, everyone who responds seems to be thinking like a rocket scientest. For anyone who reads this, all he wants to do is provide printing options for his program. i.e. File ... Print. It's a simple concept. From what I've read over the last week or so, he has a console application that does a bunch of stuff and displays it on the screen in the console. All that he wants to do is print what's in the console. So anyone that knows a simple way of printing from the console, post it, so we don't have to continue reading the same post. Brimid, I told you before, go to the printing section of this site and read some of the articles. I'll even point a few out to you in a few mins. I don't know what to tell you about using MFC, because its not something you can just jump right into and understand. It takes time. But I'll go find a few articles for you to look at anyway.
-
SAP R/3I'm an SAP beginner, but I can hopefully give you some sort of help. Yes SAP does support programming. ABAP/4 which you found on google is what you program it in. I just learned very basic ABAP in a training class, so I can't really tell you if it can do all that. However it can connect to sockets, as the setup we had in the training class there was a main SAP server computer that each of us connected to in order to access our programs. I'd imagine it also can connect to web services as well. That's all that I know as I'm a beginner and don't know too much about it. There are a few books on Amazon that teach ABAP if you wanted to look into it more.
-
CListCtrl Row heightHi, I replied to your other post about this a few days ago. Have a look at this article. http://www.codeproject.com/combobox/listboxex.asp[^] This is basically about making your own version of a control. It uses a listbox as an example, but its the same general idea with any control. The author works with height and width in it so that should help you out. Getting back to your original problem, I think that there may be an easier way to get it to display. Either there is a property in the list control that controls this or there is a function that allows the text to display. If you click on a file you'll notice that it seems to toggle the text to on, and then when you switch to another file it goes back to the "...". So I think there's a function that you can use. However, if you have a lot of text, it will overlap with images below it, so you would have to adjust the row height as well if that's the case.
-
Program closingWell I'm pretty sure that's what happens when you press the big orange 'X' button. Try this and you'll see what it does. In any of the drop down menus you have create an option called "Quit" and in the code just put PostMessage(WM_QUIT, 0, 0); That will quit the entire app.
-
new to dll fileshey, just came across this. don't know if you've figured it out yet but I'll help you out anyway. Its hard for me to tell what is causing the problem without seeing some code, so I'll just give you a quick rundown of what you should be doing to make it run correctly. Some of this probably is obvious but I'll say it anyway. Make sure every function in the dll that you are going to use has the dll export and import statements in your dll and main app. Secondly, for what you are saying, this is how it should work. In the main application temp variable = 1st dll function(); 2nd dll function(temp variable); That's all there is to it.
-
Program closingHmm. I'll try to help you out more, although I don't know that much about overriding those messages as I've never done it before. I've only worked with closing the program in a dialog based app. The code I posted before should work for manually closing the program. I don't see why it would be any different in an SDI. I'd suggest working with the WM_QUIT message first since that is the message sent when the program terminates. As far as I know the WM_CLOSE message is used if you have for instance a pop-up dialog and want to close it, so it shouldn't be sending any WM_CLOSE messages upon termination of the entire program.
-
Program closingYou have to override the WM_QUIT and WM_CLOSE messages. The WM_QUIT message is the one that terminates the entire application. WM_CLOSE is sent when exiting a window such as a dialog. An example of how to manually quit the program would be PostMessage(WM_QUIT, 0, 0) Similarly WM_CLOSE can be used as well. Hope that helps.
-
CListView ProblemHi, While I've never done anything with images and text in a ListView I have an idea that might help you. This is the same thing that happens if you look in any folder and the name is too long. The obvious reason you get the "..." is because displaying the full name could overlap with an image below the text. Each row has a certain height to it and if the text goes beyond the height it gets truncated. At least that's how I see it. So my idea is for you to manually override the row height and change it to make the text fit. I don't know if this definitely will work, but its worth a shot. Edit: After messing around inside a folder, it seems that there usually is enough space to display most names without doing that. Maybe there is a property you can check to allow it to display?
-
C++ HelpAssuming you mean printing the output on a printer, I would suggest looking in the articles under the Printing section. I've never done any printing outside of an MFC app, so I can't help you much. There may be some easy way of printing from a console, but I couldn't tell you what it is. The articles provide some good starting points, but judging from the simplicity of your application its probably more work than its worth.
-
PropertyPage help instantiatingIf you are setting the property sheet up correctly then they should all load with no problems at all. If you are just clicking on the tab itself and you're running into problems, then something is wrong with the way you added pages to the property sheet. Maybe if you posted a code snippet of when you instatiate the property sheet, it would help. As far as the problem with the third tab error, you can't access a control on the other tab. It's exactly the same as having a dialog that's not open yet. The control isn't there, so you can't access it. Hope that helps. Can't really tell you much more since I don't know exactly what you're doing.
-
CListCtrl w/ multiple attributesHey, I might be able to help you if you still haven't figured it out. I've worked a bit with the CListCtrl and could at least help you out in finding a solution. You'll have to explain the problem a little more. From what I gather, the problem you have is that when you load something into the List Control it's taking quite a bit of time, in effect hanging the app for 3 or 4 seconds. I have that problem in one of my applications which I haven't bothered to fix, which is mainly why I want to help. Anyway let me know if that is the problem you're talking about and if so we can try to figure out a better way of loading data into the list control. I have a few ideas, but not sure whether they will work or not. Mike
-
ms flexgridhi everyone, I'm trying to use the activex control MS Flexgrid. However, if I try to add it to a dialog it tells me that it can't be instantiated because I don't have a run-time license. From what I was able to dig up searching the net about this problem was that I needed to manually give the control a license. This makes no sense to me as I don't understand why you'd need to do something like that if its already in visual c++. Now I don't know the first thing about ActiveX or COM so that might be why. Is there any way to use this control without knowing ActiveX? I just want to be able to have a nice database view such as in Access or if you chose a database view using the single doc architecture (i'm using dialog based). Right now I'm stuck using a listview which simply doesn't look as nice. I suppose I could try using a grid from one of the articles on this site, but it'd be easier to just use the ms flexgrid if possible. Thanks, Mike
-
Enabling/Disabling Menu ItemsYou should add OnUpdate commands to the message map. For example if you have a menu item titled "New" that has OnNew(). You'd have OnUpdateNew(CCmdUI *pCmdUI) { pCmdUI->Enable(FALSE); // disables menu item } Thats the easiest way to do it. Never tried it with GetMenu() so I can't help with that.
-
HelpHelps to post exactly what you're having problems with.
-
Dialog windows -- where does the application code goDecided to continue my post since I didn't really mention what you were asking. Anyway I recommend that first you start out by making a simple Dialog based MFC app using the wizard. I think this is the easiest thing to understand and its what I started out learning. You can immediately run the program and it will show you the default dialog that was created. Open up the file projectnameDlg.cpp (projectname is what you called the project). This is where you will be adding code. In a dialog window all the code that handles things displayed to the screen generally is done within the dialog's class. It can be done outside of it, but that's more advanced so I won't get into it. Some main places that your code can go is in OnInitDialog() and in functions for each control. Its kinda hard to tell you how to do things here, so the only thing I can really tell you without walking you through an example, is to double click on the OK button in the resource and it will generate the function for when the button is clicked. This is an example of where you'd put code that you want to execute when the button is pressed. Now for what you want to do, you'd be choosing an SDI application. To me an SDI makes more sense if you understand dialog based although many people will say its the other way around. The way an SDI works is you paint things onto the screen. This is done in the ChildView using the OnPaint() function. That's where you can put code in order to draw things. Generally you won't be doing the drawing directly from OnPaint, but rather you'll be calling other functions you create to do something and then draw things from there. But for a simple example just to learn you can draw a circle directly in the OnPaint() function. Hope this helps. Anyway like I said in my previous post I'm more than willing to walk through some examples with you. Helps me sharpen me skills :). Mike