|
Hi all:
I am using OLE DB consumer templates to access database like:
datasource.Open(...);
session.Open(datasource);
command.Open(session,...)
Question is how could I know there is something or nothing (rows) returned from command.Open() method?
Thank you very much!
Lisoft
|
|
|
|
|
I have been programming for years and thought I know my stuff. Apparently Not. this is a simple CString operation. I have done this many times and never had a problem. The following makes no sense.
//..............
CString asset_class;
CString asset_sub_class;
Object my_object;
asset_class = "Garden Tools";
asset_sub_class = my_object.GetName();
//The GetName function returns a CString containing "Power Tools"
//I know this because I have it on my watch list
m_header_1.SetWindowText("Category: " + asset_class);
m_header_2.SetWindowText("Sub Category: " + asset_sub_class);
m_header_3.SetWindowText(my_object.GetName());
//.........................
the control m_header_1 prints "Category: Garden Tools"
the control m_header_2 prints "Sub Category: "
the control m_header_3 prints "Garden Tools"
The m_header_2 control is not printing "Sub Category: Power tools"
Does anyone have any ideas why?
|
|
|
|
|
Only thing that comes onto my mind is that the function GetName() returns just a reference on a CString object.
But I doubt it's the problem...
--------
Dave
[Math Studio]
|
|
|
|
|
I tried that. If I store the return value in a CString object the object has the data. If i am not concatenating, the window does not show it. I used another solution, i created another static field. I think it might have been that the pixel width given to the control was not large enough to show the full string.
Anyaways - thank you for your time.
|
|
|
|
|
|
Is there anyway to make a class a friend of it and anything that inherits from it? Thanks.
-Ken
|
|
|
|
|
Classes are by definition friends to themselves ( anyone who is not their own friend has serious issues ), and anything derived from it ( most of us try to be friends with our offspring ).
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hey Everybody,
I made a dialog that has 2 sets of a radio button and combo box. When one radio button is set, it disables the other combo box (and enables it's own combo box) and vice versa. I can't seem to find an example where that can be done in the articles. I also want to return the results of the dialog to the calling function. I know it has to do with the DoDataExchange function. I've read though examples but they just say "do this and do that" but they don't tell me how to get it working with my own program. If I can get a set of steps to get it working, I can try and figure it out, I just need some breadcrumbs.
Any help would be greatly appreciated because the data exchanging thing is a very important part of MFC, thanks in advance.
|
|
|
|
|
One method is to create the radio button variables as controls not ints, and create event handlers that enable and disable controls when the respective button has been clicked. Then the OnOK can be overridden. This part is dangerous. I would recommend instead, creating a public variable that stores the radio button state, and then after the DoModal() function returns IDOK pull the value from the variable. Let me know if you would like more detail.
|
|
|
|
|
I understand that but I would like more on your recommendation. From what I read, you are supposed to create an integer public variable for only the first radio button and that will indicate which other radio button is selected. Beyond that, it's each variable for itself, at least the controls I'm using.
|
|
|
|
|
Hey all,
I've got a dialog program with a menu. I want to add a bitmap on the actual menu bar, not in a drop down. I want it next to the items... Example:
(BITMAP) File Edit View Help
Is there anyway to do this, and if so, how? I've tried everything, but nothing is working. Thanks a lot.
Dave
|
|
|
|
|
|
Mickael Dunn'advice is good.but I think there must be a method to do it by using member's function of menu class in MFC.you can refer to Microsoft Internet Explorer, bitmap lies of left of the items in "favourite"
your friend:bobi
|
|
|
|
|
Hey. After posting this, I found modified the 'Real' bitmap on menu and capion bar in the articles section. Thanks tho
Dave
|
|
|
|
|
I need to present the user with a disclaimer . The text is long and i want it to be hardcoded .
char *disclaimer = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa......" ;
Is there a limitation on the size of this string ?
for ease of reading I need to be assigning this as
char *disclaimer = "aaaaaaaaaaaaaaaaaaaaaaaa // line 1 (what delimiter to use ? )
aaaaaaaaaaaaaaaaaaaaaaaa // line 2
aaaaaaaaaaaaaaaaaaaaaaaa" ; // last linem
How can i achieve the above . in other words what is the delimiter to use ? is it \\
|
|
|
|
|
Use CString.format.
example
CString myText;
myText.Format("This is line one \n This is line two \n This is the last line.");
AfxMessageBox(myText);
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
act_x wrote:
I need to present the user with a disclaimer . The text is long and i want it to be hardcoded .
char *disclaimer = "aaaaaaaaaaaaaaaaaaaaaaaa // line 1 (what delimiter to use ? )
aaaaaaaaaaaaaaaaaaaaaaaa // line 2
aaaaaaaaaaaaaaaaaaaaaaaa" ; // last linem
How can i achieve the above . in other words what is the delimiter to use ? is it \\
Here is another way to do it (ANSI C):
char *disclaimer = "aaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaa" ;
-- Ricky Marek (AKA: rbid)
-- "Things are only impossible until they are not" --- Jean-Luc Picard
My articles
|
|
|
|
|
act_x wrote:
Is there a limitation on the size of this string ?
No. I've seen message boxes that consumed my entire 1024/768 screen.
act_x wrote:
what delimiter to use?
The delimeter for the text in the messagebox is \n .
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thanks for ur help , but i guess i didnt phrase my question properly
For the string to be displayed in seperate line I know that I have to use \n . but my question is
My IDE is complaining of the new line when i do this
char *disclaimer = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n <what needs="" to="" be="" put="" here="" ?="">
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n";
|
|
|
|
|
act_x wrote:
My IDE is complaining of the new line when i do this
The code snippet provided by rbid is what you are after.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I'm wanting to add a OnTimer event to me UI thread class, but cannot seem to get it to work. I assume that the time only works with some kinda dialog, but my thread does not have that, only my main app does. Is there a way to add this event to my thread with out adding a dialog?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
So what does not work? When you create a timer via SetTimer() , it communicates back to the application in one of two ways: the function pointer that was provided, or by posting a WM_TIMER message.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
It's never getting to my OnTimer function.
When you say function pointer ...what do you mean?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Tom Wright wrote:
When you say function pointer ...what do you mean?
A callback function.
void CALLBACK TimerProc(...)
{
}
SetTimer(..., TimerProc);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Never worked with callbacks....guess it's time to learn.
Thank again David
Tom Wright
tawright915@yahoo.com
|
|
|
|