|
AFTER getting currenttime
you can use Format method for changing time format as you want
|
|
|
|
|
The documentation[^] is always the first place to look.
It's time for a new signature.
|
|
|
|
|
CTime::GetCurrentTime() returns a CTime object, not a string, so it has not a format.
To get the formatted string, have you used the CTime::Format function?
Use it with %I instead of %H.
P.S.: you cannot read the documentation on MSDN?
|
|
|
|
|
I am using like
szTimeDisplay.Format(L"%02d:%02d:%0d",tm.GetHour(),tm.GetMinute(),tm.GetSecond());
I also tried as you told but not worked?
|
|
|
|
|
CTime::Format only takes one parameter, and that's a format string. The format is based on strftime rather than the printf style you're expecting. MSDN has an example[^] at the bottom of the page that might give you a leg up in the right direction.
Cheers,
Ash
|
|
|
|
|
use this instead:
szTimeDisplay = tm.Format(_T("%I:%M:%S"))
|
|
|
|
|
Thanks, how to get AM/PM ?
|
|
|
|
|
use %p
szTimeDisplay = tm.Format(_T("%I:%M:%S %p"))
|
|
|
|
|
Hi All
I am using MFC SDI application. We give release version of executable to the customer.
Application get's crahses in real time. I heard through pdb file we can debug the release version. Can any one tell how to use the pdb file. In real time we cannot debug the executable via code. Also it occurs in rare case. Finding the solution is bit difficult. Can anyone assist me in resolving this issue.
|
|
|
|
|
I have not used it to actually debug an application at runtime, but rather used it when analyzing crash dumps from release builds, but I suppose that is possible too. The pdb file contains the symbol information needed to trace instructions back to source code. If the problem occurs infrequently, it might be better to go the crash dump analysis path.
There is a discussion here[^] on how to do this.
|
|
|
|
|
Hi all,
I am drawing one rectangle with some given values and degree.
Now i want to give the mouse event if i click the mouse on that rectangle,it should be activated so that i can drag it and resize.
The code i am using to draw rectangle is:
LPTSTR lpsz;
ColliAngle = "45";
int ang;
ang = _ttoi(ColliAngle);
float Angle = ( 3.142 * ang ) / 180;
int x[4];
int y[4];
x[0] = -x1 * cos(Angle) - y2 * sin(Angle);
y[0] = x1 * sin(Angle) - y2 * cos(Angle);
x[1] = -x1 * cos(Angle) + y1 * sin(Angle);
y[1] = x1 * sin(Angle) + y1 * cos(Angle);
x[2] = x2 * cos(Angle) + y1 * sin(Angle);
y[2] = -x2 * sin(Angle) + y1 * cos(Angle);
x[3] = x2 * cos(Angle) - y2 * sin(Angle);
y[3] = -x2 * sin(Angle) - y2 * cos(Angle);
for (int i=0; i<4; i++)
{
x[i] += center.x;
y[i] += center.y;
}
MoveToEx(pCellInfo->hDC,x[3],y[3],NULL);
for (int i=0; i<4; i++)
{
LineTo(pCellInfo->hDC, x[i],y[i]);
}
Please help me i dont know how to start and totally hanged.
Thanks
Raj
|
|
|
|
|
To identify if the mouse is clicked on the line use the LineDDA function.
This function calls a callback function with each point on the line.
Compare this will the point where the mouse was clicked.
|
|
|
|
|
You can also insipre from here^
|
|
|
|
|
Hallo as in the Subject described how can i convert the Bitmap from the resource to a Wmf file i found an article how to convert it in EMF but not in WMF
can somebody help me
thanks
|
|
|
|
|
Assuming you are using MFC, doesn't CMetaFileDC::Create[^] create a WMF (while CMetaFileDC::CreateEnhanced[^] creates an EMF)? Then you can use blitting -i guess- to place the bitmap in the metafile.
p.s: if you are not using MFC then there's CreateMetaFile[^] API call...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
yes CMetaFileDC::Create creates a meta file just i have in my resource a bitmap file im loading it to an CBitmap and then i dont know how to convert it and i dont know what blitting is or how it works im sorry im new in mfc we never had that at school ![Frown | :(](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_frown.gif)
|
|
|
|
|
Ah, i thought your problem was that you wanted a WMF and not an EMF file.
Try something like this:
CMetaFileDC metaDC;
metaDC.Create(...);
CBitmap bitmap;
bitmap.LoadBitmap(...);
BITMAP bitmapInfo;
bitmap.GetBitmap(&bitmapInfo);
CDC memoryDC;
memoryDC.CreateCompatibleDC(&metaDC);
CBitmap *originalBitmap = memoryDC.SelectObject(&bitmap);
metaDC.BitBlt(0, 0, bitmapInfo.bmWidth, bitmapInfo.bmHeight, &memoryDC, 0, 0, SRCCOPY);
memoryDC.SelectObject(originalBitmap);
memoryDC.DeleteDC();
DeleteMetaFile(metaDC.Close());
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
after loading the bitmap i get at CreateCompatibleDC a zero value and then asserts
the bitmap file is loaded into CBitmap and the create gives also a valid value
what am i doing wrong ![Frown | :(](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_frown.gif)
|
|
|
|
|
Ok now it works the complete source looks like this
<br />
CMetaFileDC metaDC;<br />
metaDC.Create();<br />
<br />
CBitmap bitmap;<br />
bitmap.LoadBitmap(IDB_BITMAP2);<br />
<br />
BITMAP bitmapInfo;<br />
bitmap.GetBitmap(&bitmapInfo);<br />
<br />
CDC memoryDC;<br />
(memoryDC.CreateCompatibleDC(NULL);<br />
<br />
CBitmap *originalBitmap = memoryDC.SelectObject(&bitmap);<br />
metaDC.BitBlt(0, 0, bitmapInfo.bmWidth, bitmapInfo.bmHeight, &memoryDC, 0, 0, SRCCOPY);<br />
<br />
HMETAFILE Handle = metaDC.Close();<br />
CopyMetaFile(Handle,"filename.wmf");<br />
memoryDC.SelectObject(originalBitmap);<br />
memoryDC.DeleteDC();<br />
<br />
<br />
DeleteMetaFile(Handle);<br />
<br />
<br />
thank you alot
|
|
|
|
|
Glad you figured it out, sorry i didn't answer earlier but by the time you submitted your reply i was probably already in bed. Nice work.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
WMF and EMF has an advantage that it will be scaled for the destination device context.
These files contain records of coordinates and the corresponding shapes.
Using these records, the image is scaled and redrawn.
When you put a bitmap into an EMF or WMF, this advantage is lost.
The image will either remain the same size if you do a BitBlt or will be stretched/shrunk if a StretchBlt is done.
What I'm saying is that there is no real advantage in converting a bitmap to an EMF.
|
|
|
|
|
yes i know but im using the wmf file just for converting it into a Rtf object which is made by the rtfGenerator class and it only accepts wmf ![Laugh | :laugh:](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_laugh.gif)
|
|
|
|
|
Hi,
I created a control(C1) at run time and one more control(C2) at run time on a dialog.
I want C2 on the Top of C1. I used SetWindiwPos but no use..
How can I do it?
|
|
|
|
|
AbhiHcl wrote: I used SetWindiwPos but no use..
What happened? How are you verifying the Z-order was not changed?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
What kind of controls are they(C1 & C2)? If you could be more specific what to do you want to achieve, its easier for people to help.
Regards,
--
"Programming is an art that fights back!"
|
|
|
|