|
if you look to the documentation for SYSTEMTIME :
It is not recommended that you add and subtract values from the SYSTEMTIME structure to obtain relative times. Instead, you should
- Convert the SYSTEMTIME structure to a FILETIME structure.
- Copy the resulting FILETIME structure to a ULARGE_INTEGER structure.
- Use normal 64-bit arithmetic on the ULARGE_INTEGER value.
instead LARGE_INTEGER you can use the __int64 on microsoft compilers
|
|
|
|
|
SYSTEMTIME sysTime;
..
..
..
CTime tm (sysTime);
tm += 60;
tm += 3600
sysTime.wYear = tm.GetYear();
sysTime.wMonth = tm.GetMonth();
sysTime.wDay..
sysTime..
sysTime..
|
|
|
|
|
Good
It is very simple!!!
Thank you!
|
|
|
|
|
The following sentence can work well for your the last five sentences.
tm.GetAsSystemTime(sysTime)
|
|
|
|
|
|
How to add right-aligned keystrokes to menu?
|
|
|
|
|
In the properties of the menu item.. in the caption field use a \t to "tab" the keystrokes.. like
ID: ID_FILE_NEW Caption: &New\tCtrl+N
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
I've tried this, but the keystrokes are not rigth-aligned.
How can I make them aligned to the right?
|
|
|
|
|
Hi all,
I am creating an MDI Application which is using CRichEditView as one of its view. i am doing some processing and have to displaying a set of values in the RichEditView. but what is the way in which i can display the text in the CRichEditView. It is compulsory that i have to use the RichEditView since my data size is huge. can anybody send me a sample or help me in sorting out this. Plz tryin respond fast. I need it very fast.
Sreeramachandra G
|
|
|
|
|
Hi,
use CString to show data in RichEditView. Use Format() Function. "/r/n" as new line feeder. Set appropriate properties of CRichEditCtrl.
The chosen One
|
|
|
|
|
If I have a dialog window, I can dynamically disable a button like this...
GetDlgItem(IDC_BWHATEVER)->EnableWindow(FALSE);
But how do I dynamically disable the buttons in the system menu at the top of the dialog?
|
|
|
|
|
Use CWnd::GetSystemMenu to get a pointer to the system menu of your dialog, then CMenu::EnableMenuItem to enable/disable the items. Use SC_CLOSE, SC_MOVE, or SC_SIZE as menu ID's (see in winuser.h)
|
|
|
|
|
Hi, everybody,
How to create a project template from an existing project (in VC++ .NET2003)?
Thank you
|
|
|
|
|
Does someone knows what function to use to retrieve the standard width of a vertical scrollbar (or height of an horizontal one) ? Damned, I can't find back in MSDN!
Thanks in advance.
Regards
|
|
|
|
|
I have found!
GetSystemMetrics(SM_CXVSCROLL)<br />
GetSystemMetrics(SM_CYVSCROLL)
|
|
|
|
|
I've got a rookie question. In an SDI or MDI app, in the View Class I can get a pointer to the current instance of the Document class and I don't have to create a new instance of CDocument.
So ... If I have two independent classes, what is the procedure, what do I have to do so the classes see eachother without declaring new instances of them ?????
Thank you!
|
|
|
|
|
As you said, in your view-class, you have a CDocument-pointer.
You can then call functions on the pointer, just as if it were a local variable:
CDocument* pDoc [needs to hold the pointer to the current Document]
pDoc->ADocumentFunction();
But this way you can only access functions of the MFC-CDocument-class, not any extension you made in a derived class CMyDocument.
For this, you need to cast. But for that, you need to be sure that you are working with an instance of CMyDocument. But that is easy, unless in very special circumstances where your application can open different type of documents and you have made different classes derived from CDocument.
Here is how to cast:
CMyDocument* pMyDoc = static_cast<CMyDocument*>(pDoc);
This line tells the compiler to treat your CDocument-pointer as the CMyDocument-pointer that it really is and assign it to the variable pMyDoc . Subsequently, CMyDoc points to the same object as pDoc, but treats it as a CMyDocument instead as a CDocument (as pDoc does).
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
What I meant is communication between two generic classes, not necessarely the Document and the View class.
|
|
|
|
|
Ok, it works just the same.
The hardest part is to get a valid pointer of the class you want to access.
I typical use an extra constructor parameter, e.g. for access to the Document in dialogs, or special Set-functions (but I then normally make my pointer a const pointer to a const object and carefully test for non-nullness).
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Assuming that you know ahead of time which classes need access to each other, you can hardwire it in. Write a function in each class to receive a pointer to the other class (the one it has to communicate with), and in that other class write a function that will send a pointer to itself to the first class. Do this as often as you need to, depending on the number of the classes that need to interact and the required directions of the interaction (i.e, one-way or two-way).
Ed
|
|
|
|
|
I need to be able to open a .pdf file (by launching acrobat reader or writer) and show a specific page.
This should be a simple thing, but I googled the whole freaking internet + news groups and could not find any usefull information. It seems the only way to find out how to do this is to buy the adobe SDK, but I don't have the funds to do that. Besides, I don't want to incorporate the whole freaking reader in my own application, I just want to open a file on a certain page!
So is there anyone out there that can solve my problems and frustrations ?
|
|
|
|
|
Use ShellExecute[^]. You will, of course, have to have Acrobat Reader installed on any PC that it runs on.
|
|
|
|
|
jdunlap wrote:
Use ShellExecute[^]. You will, of course, have to have Acrobat Reader installed on any PC that it runs on.
I thought about that, but then I still can only open the document, and not display a specific page of that document.
|
|
|
|
|
Should have paid closer attention to what you said in your post! I wonder if there's a command line option that will let you specify the page.
|
|
|
|
|
i always thought that the Adobe Reader installs an ActiveX Control. With this this should be possible. (the only thing.. you have to make a dialog with the Control on it)
"I'm from the South Bronx, and I don't care what you say: those cows look dangerous." U.S. Secretary of State Colin Powell at George Bush's ranch in Texas
|
|
|
|