|
What are you asking exactly ? How does the 16 digit number relate to the 8 digit number ? I can't see what it is you're chasing...
Christian
Secrets of a happy marriage #27:
Never go to bed if you are mad at each other. It's more fun to stay up and fight
|
|
|
|
|
Can anyone tell me why the following code does what it does:
(Note that the code has been trivialised for readability )
ZeroTime.SetDateTime( 1970, 1, 1, 0, 0, 0 );
OtherTime.SetDateTime(1970, 1, 1, 0, 0, 10);
COleDateTimeSpan TimeDifference;
TimeDifference= (OtherTime - ZeroTime);
CString Seconds, TotalSeconds;
Seconds.Format("%10d", TimeDifference.GetSeconds());
TotalSeconds.Format("%10d", TimeDifference.GetTotalSeconds());
Seconds.Replace(' ','0');
Seconds.Replace(' ','0');
After all that I get the following output:
Seconds = 0000000010
TotalSeconds = 0000000000
Why can't GetTotalSeconds determine the correct number of seconds??
Environment is Visual C++ 6, SP5 on Win NT4 SP6
It's driving me nuts!!
Thanks anyone that can help!
Senior Test Engineer
GLI Australia
www.gli.com.au
|
|
|
|
|
The problem is that you are trying to format the return value of GetTotalSeconds function as if it were an integer. According to MSDN the function is prototyped as a double even though it returns an integer.
Try this:
TotalSeconds.Format("%10d", (int)TimeDifference.GetTotalSeconds());
This works for me.
|
|
|
|
|
Yes, thanks for the info, I ended up doing this:
long Difference = (long)TimeDifference.GetTotalSeconds();
TotalSeconds.Format(("%10d", Difference);
(or something similar anyway).
No need to tear my hair out anymore! Thanks for the info!
Regards
Senior Test Engineer
GLI Australia
www.gli.com.au
|
|
|
|
|
Hi, I'm Pham minh Quang. I live in VietNam
I'm learning VC++ now and i will have to create a project soon.
I want to write a program like a HTML Editor.
Do you show me where I can download a demo source code?
Thank you very much.
p/s: sorry for my English
|
|
|
|
|
If you're learning you should get a grasp of C++ first, not MFC or programming the Win32 SDK. Doing the stuff you see in Windows GUI wise is pretty easy but knowing C++ will make what you learn that much easier. Anyone can tell you how to do someting but once you understand the concept it becomes much easier...
Sam C
----
Systems Manager
Hospitality Marketing Associates
|
|
|
|
|
Release build optimized for minimum size I get 36k when #if 0. With #if 1 I get 84K. Why do the stream classes add 48K to my project?
#include "stdafx.h"
#include <sstream>
int main(int argc, char* argv[])
{
#if 0
std::stringstream oss;
oss << 1;
#endif
return 0;
}
<pre>
|
|
|
|
|
The CRT + stream templates? Templates are known for bloat under VC++ as there's no partial template specialization.
CodeGuy
http://groups.yahoo.com/group/wtl
|
|
|
|
|
Thanks ahead of time.
I'd like to use functions in a .dll.
I have no .def or .lib, however.
Any ideas on how to reverse engineer these??
thanks again
|
|
|
|
|
This was covered a while back, but I can't seem to find the thread, you should check out Q131313 in the KB.
http://support.microsoft.com/support/kb/articles/Q131/3/13.asp
-Ben Burnett
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
to know the functions in the dll
you can use the cmd window and type:
dumpbin /EXPORTS YourDLL.DLL
the dumpbin.exe located in your "C:\Program Files\Microsoft Visual Studio\VC98\Bin" dir. (default)
this will show the function you can use from the .dll.
like: ?Func1@@YAHXZ
?Func2@@YAXPAUHWND__@@PAUHHOOK__@@PAD@Z
and more.
the "@@YAXPAUHWND__@@PAUHHOOK__@@PAD@Z" and suff like this means the arguments that the
function gets.
I figured out that:
'YAXPAUHWND__' = HWND
'YAHXZ' means nothing. Func1()
Name: STR
BTW: for some of you that wished for CodeProject irc server
I create a channle on DalNet called "#CodeProject"
|
|
|
|
|
Use depends.exe to get list of exports.
It is a part of MsVisual C++, and in new version (which You have to download from ms site) it can undecorate c++ names.
|
|
|
|
|
I'm trying to use the Class wizard to generate some code of my own. To do this, I need first to add my classes in the Class wizard (in the "Message Map" tab, the "Class name" combo-box), and then to add my own functions in the "Messages" list-box.
Does anybody know how to do this?
Thanks,
Bruno
|
|
|
|
|
Hy!
To add a class just press "Add Class..." buton in the upper right corner of ClassWizard dialog box. In the "Messages" list-box are not listed function. There a messages that you can get in that class from the OS.
There is actualy 2 ways to add a function to your class: you can do it by hand like in any other C++ program, or you can do it using "ClassView" tab by right click-ing on the name of the class and then selecting "Add member function ... "
Bye,
Orbital
...the night is long ... but not long enought to do some real coding ...
|
|
|
|
|
If your class is not a subclass from an MFC class then the dialogue you refer too isn't relevant.
You need to go to Insert/Class and set the class type to "Generic". Then specify the superclass (if any).
Then use the class view to add members and member functions.
|
|
|
|
|
Hi,
I am playing around with resizing bitmaps and the GDI. I am trying to resize a bitmap from disk and then
display it in a CStatic.
Code As Follows:
// LOAD BMP FROM DISC
// ******************
HBITMAP testbmp;
testbmp= (HBITMAP) LoadImage(0,"C:\\test.bmp",IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
//CREATE SOURCE DC
//****************
CDC hdc;
hdc.CreateCompatibleDC(NULL);
hdc.SelectObject(testbmp);
//CREATE DESTINATION DC AND RELATED BMP
//*************************************
CDC destination ;
CBitmap bmp;
bmp.CreateCompatibleBitmap(&destination,100,100);
destination.CreateCompatibleDC(NULL);
CBitmap *old = destination.SelectObject(&bmp);
//PERFORM THE RESIZE
//******************
destination.StretchBlt(0,0,100,100,&destination,0,0,640,480,PATCOPY);
destination.SelectObject(&old);
//OUTPUT RESIZED BMP TO CSTATIC CONTROL
//*************************************
m_bmp.SetBitmap(*bmp);
Can anyone point out where I am going wrong
Cheers
Richard
|
|
|
|
|
You should use a BITMAP structure to get the size of your bitmap, but I assume it's really 640x480.
You can check out where you are going wrong by creating a CWindowDC like this
CWindowDC window(NULL);
Then you can draw your bitmap to this DC and it will go to the screen. That way you can tell if the bitmap has loaded, if it is being resized, etc., and so know where it's going wrong.
As to specifics, you should try passing the actual HINSTANCE into ::LoadImage, which you get from (from memory) AfxGetInstance(). Apart from that, if there's a glaring error there, it's too early in the morning for me to spot it ;0)
Christian
Secrets of a happy marriage #27:
Never go to bed if you are mad at each other. It's more fun to stay up and fight.
|
|
|
|
|
Hi,
How can I print the following two strings, "carpet", "lamp"
How can I: center, aling left, align righ , put tab space , and most importantly how can I put them on sepparate lines.
I know that printing is basicly like sending text to the screen, but I just don't know how to code it, basic syntax.
Thanks a lot guys.
|
|
|
|
|
Use the CDC::DrawText function.
|
|
|
|
|
Would it be possible to give me an example, please!
|
|
|
|
|
We get the Tooltips if we hover the mouse on some filename in Windows Explorer.
This Tooltip contains Type of File & Size.
How can I have the same functionality enabled with file type associated with my application.
Any clues where in the MFC App can it go in.
|
|
|
|
|
See part 8 of my shell extension series. At the end I have a blurb about customizing tooltips. Basically, in HKCR\.XXX you create a string value "InfoTip" and set it equal to the tip you want. Win 2K lets you put predefined properties in there as well.
--Mike--
http://home.inreach.com/mdunn/
A recent survey reports that 1/4 of all internet users in England surf for porn.
The other 3/4 just didn't want to admit it.
|
|
|
|
|
Is there a function that can bring up a color picker dialog box?
Thank You
|
|
|
|
|
CColorDialog dlg;
if (dlg.DoModal()==IDOK)
{
COLORREF return = dlg.GetColor();
}
Christian
Secrets of a happy marriage #27:
Never go to bed if you are mad at each other. It's more fun to stay up and fight.
|
|
|
|
|