|
After looking at this closer it turns out I don't understand how this works. If CWinFileInOut derives just from interfaces, doesn't that mean I have copy the implementations of the interfaces of CWinFileIn and CWinFileOut to CWinFileInOut, which makes inheritance pointless
|
|
|
|
|
There's no such thing as interfaces in C++. These are base classes which define the interfaces. Yes, perhaps this is not what you want, but a virtual base class will have the same problem.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
"base classes which define the interfaces" is what i meant when saying interfaces, sorry for confusing the terms. so, um, sorry if i'm being dense but is what i was originally asking even possible? in the example with the virtual base classes, the derived classes CWinFileIn and CWinFileOut have to implement the virtual functions, and the same virtual functions have to be implemented again in CWinFileInOut, which kinda defeats the purpose of inheritance.
|
|
|
|
|
Yes, that's definately the problem, I doubt what you want to do is possible. You can make a class that is all three class types, but you need to copy a bit of code between the classes to do it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
go for virtual base class
|
|
|
|
|
You can place the common elements in a virtual base class.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
hi all...I have troubles in accessing and editing the tab control member's attributes. I've followed the codeproject article on making the tab control application(which is creating a new class for example CMyTabCtrl derived from CTabCtrl and inserted with other classes for exmaple CTabOne,CTabTwo,etc). How to access the CTabOne attributes(for example its edit box)? Does anyone can help me?From where I can access to CTabOne attributes?Is it from the Main Dialog Class, CMyTabCtrl, or from the CTabOne directly?Pls help...
|
|
|
|
|
This question is about a specific wrapper class, so you should be asking the article author. Broadly, the CTabOne class will have an instance in your tab control class probably, which means you need it should be accessible from there. It's accesible from whatever class contains it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
How to access it. I'm making a member variable for the edit box. How to access the member variable? I'm making a program that has tree control and tab control. If I click the tree attributes, the tab control content will change according to the selected tree item. But I'm so confused. pls help...
|
|
|
|
|
Your member variables should not be public. Make a public method on the class that you can call. I'd say at a guess that the pages are in this wrapper class as instances of hte base class, if so, you need to find the right one and cast it to get access to your custom properties and methods. But like I say, I don't know what article code you're using, so you should ask the author.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
ok..will try it. The problem is, I forgot who is the author(I've download the source code,but in the source code, he didn't put his name but his email ben@shido.fsnet.co.uk)
thx.
|
|
|
|
|
Try searching the articles for a class name from the project.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I use Ado to connect SQL Server,when I deleted a record,the Provider report a Error Message:"Row handle referred to a deleted row or a row marked for deletion".
The following is my sample code:
pRecordset->delete(adAffectCurrent);
pRecordset->Update();
pRecordset->MoveFirst();
i=0;
while(!m_pRecordset->adoEOF)
{
varValue = pRecordset->GetCollect(long(i);
i++;
if (varValue.vt == VT_NULL)
bstrValue = "";
AfxMessageBox(bstrValue);
m_pRecordset->MoveNext();
}
|
|
|
|
|
Is it pRecordset, or m_pRecordset?
|
|
|
|
|
HELP!
I've searched all over this, Microsoft's, and many other sites. In using EnumJobs in C++ version 6, I am specifying a JOB_INFO_2 structure. According to the MSDN:
Time
Specifies the total time, in milliseconds, that has elapsed since the job began printing.
However, this value is always zero. The EnumJobs function always returns TRUE, and the rest of the structure's members seem OK. Does anyone out there know if there is a bug in the API that discusses anything about this? I greatly appreciate it in advance!
|
|
|
|
|
Has the job been printed yet? If not, zero would be the right value.
|
|
|
|
|
Hey thanks for your input!
Hmmmm. Good question. I have the job paused, so no, it hasn't been printed. I assumed, perhaps incorrectly, that the time would be updated on each call to EnumJobs. Did I miss something in the documentation?
What I'm trying to do is capture all jobs for printers that I am monitoring. I pause the job, then notify another program (via the clipboard) that a job is being printed. I need to know when the other app is is finished adding its content to the job (or some period of time) so I can unpause it.
While I know there are several solutions to what I need to do, I thought that time member of the JOB_INFO_2 struct would do the trick. But alas it doesn't get updated.
|
|
|
|
|
MSDN says:
Specifies the total time, in milliseconds, that has elapsed since the job began printing.
As I read that, the value will be zero until it actually starts printing.
|
|
|
|
|
Also try calling GetJob on the specific job you are interested in.
That might 'coerce' the printer driver or printer monitor into filling in more current data.
|
|
|
|
|
Keith E. Cooper wrote:
However, this value is always zero.
Don't dismiss the possibility that the printer driver mfg. may not be updating/returning that information.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Well, it turns out I had two problems. One, I wasn't selecting the JOB_NOTIFY_FIELD_TIME in my FindFirstPrinterChangeNotification and FindNextPrinterChangeNotification calls, and two, y'all were right, that field doesn't get modified until the printer started actually printing.
I was able to use the JOB_NOTIFY_FIELD_TOTAL_BYTES field to get the event when the other application was writing to the spool file (it's a long story).
Thanks to you all who responded!
|
|
|
|
|
hi
when compuer shut down or restart etc it send the wm_queryterminate message to the application i want to know that how to check that this message is send to ur application.
ddd
|
|
|
|
|
wm_queryterminate? NO SUCH MESSAGE.
Lookup WM_QUERYENDSESSION in the MSDN: "The system sends the WM_QUERYENDSESSION message to each window,..."
If the above is correct; you simply need to add a message handler for WM_QUERYENDSESSION in any window of your application that needs to know when the system request you to terminate you application.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Hi
I have a CString alpha. Now I want to send this string to COM1. For this, I figured, I can only send single bytes to COM1.
So how would I do this? Can I simply send the ascii character code for each character of my string?
Thanks for any help very appreciated
quarry
|
|
|
|
|
Use CreateFile(...) to open the comport and then use WriteFile(...) to send the string/data. How many bytes you can write to the output buffer, depends on the com-diver and the size of the output buffer. In general, you do not need to worry about the size of the output buffer, but you do need to check the number of bytes sent value returned by WriteFile(...) so you know how many are left to be sent.
How about trying: http://www.codeproject.com/system/serial.asp[^]
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|