|
hi,
this is the one way, try it
COleDateTime t1,t2,t3;
t1.SetDate(2003,11,1);
t2.SetDate(2003,11,25);
t3 = t2 - t1;
COleDateTimeSpan ts = t3;
int t5 = ts.GetTotalDays();
result t5= 24 days. you can hour difference in GetTotalHours(), GetTotalMinutes(), GetTotalSeconds()
Have A Nice Day.
Murali.M
|
|
|
|
|
I've used the app wizard (.NET) to create a basic single view app, w/o doc-view architecture. I've added a few things to the file menu using the resource editor (new, load, save, etc..) and added message handlers to the main frame using the wizard. I have no problem checking any of the menu items using "GetMenu()->CheckMenuItem()" but i can't seem to disable any of the menu items "GetMenu()->EnableMenuItem()" I have tried using the sub-menu, and the main menu, and I have tried BYCOMMAND and BYPOSITION but I can't get it to work. I also can't get it to default as disabled using the resource editor. Is there something I'm forgetting? I'd appreciate any suggestions or comments.
|
|
|
|
|
You 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.
|
|
|
|
|
|
Hello all
I want to code an application which can read and write using usb interface. As I'm very new to programming using usb interfaces, not able to understand how to do it. I want to use VC++ environment and want to develop a application which can read and write using usb interface just like we do with a serial port.
Can anyone help me in this. Any sample code or links to articles abt the same are very much appreciated.
Thanks for your help
Hari.
|
|
|
|
|
USB devices have a virtual serial port, their device driver is supposed to emulate a "normal" serial port. Therefor look at PlatformSDK/Device IO, and functions like SetupComm, ReadFile, WriteFile, or take a look at this library:
http://www.codeproject.com/system/serial.asp[^]
Peter Molnar
|
|
|
|
|
I am writing an application to create thumbnails (files) in the fly when an image file name (jpeg, bmp, etc.) is entered. I tried aspjpeg.dll with no success. Can someone help?
Elizabeth
|
|
|
|
|
Try CxImage (search codeproject).
Mike
|
|
|
|
|
Use the new CImage class in MFC 7.
|
|
|
|
|
Whats the easiest way of doing this?
It MSDN says I handle them inside CMainFrame ?
Are messages sent to CMainFrame as a WM_NOTIFY or what?
I can't seem to get anything working
Thanks
p.s-a small example would work wonders
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|
|
A CDialogBar has to be programmed in terms off massage handling just like a CDialog
by creating message maps:
Within you CDialogBar:
BEGIN_MESSAGE_MAP(CYourDialogBar, CDialogBar)
ON_MESSAGE(WM_INITDIALOG, OnInitDialog)
ON_BN_CLICKED(IDC_BUTTON_ONYOURDIALOGBAR, OnBnClickedOnyourdialogbar)
END_MESSAGE_MAP()
Peter Molnar
|
|
|
|
|
By drawing Bitmap, utilizing "StretchBlt" (VC++ 6), I get upside down image. Please suggest ways to get the correct Bitmap picture.
Any help would be greatly appreciated.
German
Ls2333@mail.biu.ac.il
|
|
|
|
|
dc.SetWindowOrg(m_rect.TopLeft());
|
|
|
|
|
Change the hight sign.
Read the MSDN snippet about StretchBlt:
StretchBlt creates a mirror image of a bitmap if the signs of the nWidthSrc and nWidthDest parameters or if the nHeightSrc and nHeightDest parameters differ. If nWidthSrc and nWidthDest have different signs, the function creates a mirror image of the bitmap along the x-axis. If nHeightSrc and nHeightDest have different signs, the function creates a mirror image of the bitmap along the y-axis.
|
|
|
|
|
Anyone has an idea on how to write Outlook Express extensions like OE-QuoteFix?
Regards,
BB
|
|
|
|
|
Hi,
I am unable to watch a static variable in a watch window while debugging. The compiler is Visual C++ 6.0 (without any Service Pack).
Please note that I m not taking about static member variables of a class. I am talking about static variables local to a procedure.e.g
void procedure(void)
{
static int i;
... code follows ...
... code follows ...
}
|
|
|
|
|
Do you have a breakpoint set in procedure() ? What error/message does the debugger give you when trying to view those variables?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I can't see them too - the debugger IDE behaves as if they didn't exist.
Regards,
BB
|
|
|
|
|
So if you have a non-static variable in that same function, will the debugger see it?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Yes, of course it will.
Regards,
BB
|
|
|
|
|
Definitely, in order to watch, I have to set a breakpoint. The debugger gives this error message.
CXX0017: Error: symbol "i" not found
What I understand here is that static variables are not created and destroyed when a procedure is called. They have a lifetime of program. Why debugger is showing this message is because, I have set the breakpoint in procedure(), so debugger has a context of procedure(). So, it is unable to provide a watch on "i".
I tried to watch "i" in WinMain() but again WinMain() is also a function. Now, what I left is that declare a global variable, set a breakpoint there and watch "i". Perhaps it work.
The other approach I am using is having a pointer to this static variable "i" in procedure(). In this way, I am able to watch the contents of static variable "i". e.g.
void procedure(void)
{
static int i;
int * pi = &i;
...... code follows ......
}
|
|
|
|
|
hashimsaleem wrote:
Why debugger is showing this message is because, I have set the breakpoint in procedure(), so debugger has a context of procedure(). So, it is unable to provide a watch on "i".
The debugger should show any and all variables that have "current" scope, whether they are global, static, or local. I just tried this and it does work. Something else is at play here.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
what do you mean by "current" scope? Please explain.
|
|
|
|
|
int a;
void procedure( int b )
{
static int c;
int d;
}
void foo( int e )
{
}
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
This is however VC6-only problem (I have SP4 on it). Under .NET everything is clearly visible.
Regards,
BB
|
|
|
|