|
amistry_petlad wrote: sprintf_s(str,"02d%:02d%:02d%",time.wHour,time.wMinute,time.wSecond);
The format string is "02d%:02d%:02d%" or "%02d:%02d:%02d" ? Need to brushup those old C lessons?
BTW, Why can't you use CString?
SYSTEMTIME time;
GetLocalTime(&time);
CString csTime;
csTime.Format( _T("%02d:%02d:%02d"), time.wHour,time.wMinute,time.wSecond );
SetDlgItemText(IDC_STATIC1,csTime);
I apoligize that since i don't have VS2008 installed, the above code snippet is compiled in VS6.0. So try it.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
sorry ,in hurry i had type that things but in my code it is ok but sorry for that.
and you are genius becoz you find that mistake anyways thanks for this code
|
|
|
|
|
amistry_petlad wrote: and you are genius
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
You guys dont like _strdate and _strtime functions, do you??
Regards,
Sandip.
|
|
|
|
|
Why do you do this in the OnPaint ?
SetDlgItemText(IDC_STATIC,(LPCTSTR)str);
you want to print str or buf ?
This signature was proudly tested on animals.
|
|
|
|
|
ya buf i have chnaged , the code is working but its not display the hh:mm:yy its only shows current hours in the static control
<br />
GetLocalTime(&time);<br />
char str[256]; <br />
<br />
sprintf(str,"%d:%d:%d",time.wHour,time.wMinute,time.wSecond);<br />
<br />
std::string str1(str);<br />
int len;<br />
int slength = (int)str1.length() + 1;<br />
len = MultiByteToWideChar(CP_ACP, 0, str1.c_str(), slength, 0, 0);<br />
wchar_t* buf = new wchar_t[len];<br />
MultiByteToWideChar(CP_ACP, 0, str1.c_str(), slength, buf, len);<br />
SetDlgItemText(IDC_STATIC1,(LPCTSTR)buf);<br />
|
|
|
|
|
Can you show your code,please?
|
|
|
|
|
the code working but display hours only i have increased the size of control but still not able to see the entire string
<br />
GetLocalTime(&time);<br />
char str[256]; <br />
<br />
sprintf(str,"%d:%d:%d",time.wHour,time.wMinute,time.wSecond);<br />
<br />
std::string str1(str);<br />
int len;<br />
int slength = (int)str1.length() + 1;<br />
len = MultiByteToWideChar(CP_ACP, 0, str1.c_str(), slength, 0, 0);<br />
wchar_t* buf = new wchar_t[len];<br />
MultiByteToWideChar(CP_ACP, 0, str1.c_str(), slength, buf, len);<br />
SetDlgItemText(IDC_STATIC1,(LPCTSTR)buf);<br />
|
|
|
|
|
You can set size of font for this control.
|
|
|
|
|
How to convert grayscale image(.tif )to black & white ?
|
|
|
|
|
To do that, you just need to de-saturate the image.
The RGB colour-space does not easily lend itself to this operation, and the HSL colour model is far more useful here.
In an entirely non optimized method, you would:
Repeat loop for all pixels in source image
(1) convert pixel RGB to HSL
(2) drop the S value to 0
(3) convert back to RGB
(4) dump the converted pixel back
Here's some routines for colour-space conversion:
void hsvToRgb(float h, float s, float v, float *r, float *g, float *b)
{
int i;
float aa, bb, cc, f;
if (s == 0.0)
*r = *g = *b = v;
else
{
if (h == 1.0) h = 0.0;
h *= 6.0;
i = floor(h);
f = h - (float)i;
aa = v * (1.0 - s);
bb = v * (1.0 - (s * f));
cc = v * (1.0 - (s * (1.0 - f)));
switch(i)
{
case 0: *r = v; *g = cc; *b = aa; break;
case 1: *r = bb; *g = v; *b = aa; break;
case 2: *r = aa; *g = v; *b = cc; break;
case 3: *r = aa; *g = bb; *b = v; break;
case 4: *r = cc; *g = aa; *b = v; break;
case 5: *r = v; *g = aa; *b = bb; break;
}
}
}
#define myMin(a,b) (a<b?a:b)>
#define myMax(a,b) (a>b?a:b)
#define noHue 0
void rgbToHsv(float r, float g, float b, float *h, float *s, float *v)
{
float max = myMax(r, myMax(g, b)), min = myMin(r, myMin(g, b));
float delta = max - min;
*v = max;
if (max != 0.0)
*s = delta / max;
else
*s = 0.0;
if (*s == 0.0) *h = noHue;
else
{
if (r == max)
*h = (g - b) / delta;
else if (g == max)
*h = 2 + (b - r) / delta;
else if (b == max)
*h = 4 + (r - g) / delta;
*h *= 60.0;
if (*h < 0) *h += 360.0;
*h /= 360.0;
}
}
</b?a:b)>
I'll leave it to you to make them work with RGB values in the range [0..255]
|
|
|
|
|
enhzflep wrote: Here's some routines for colour-space conversion:
These functions does the same, right?
ColorRGBToHLS
ColorHLSToRGB
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
|
enhzflep wrote: That'll teach me for using a 11 year old API help file..
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Hello,
I have written a BHO for explorer.exe.
It is working fine with Win XP but same code is not working with Windows 2003 Server.
Does anybody has any idea about this?
Regards,
Tony
|
|
|
|
|
tony_udz wrote: but same code is not working with Windows 2003 Server.
Oh, it's not working? Well that explains a lot. Thanks for all the specific information.
led mike
|
|
|
|
|
I mean to say BHO Dll is not loaded when exlorer.exe is laucnched.
If you have any idea about this please let me know.
My concern is that is ther any significant difference between Win XP and Win 2003 Server with reference to BHo.
|
|
|
|
|
tony_udz wrote: I mean to say BHO Dll is not loaded when exlorer.exe is laucnched.
And how did you determine that?
Is it listed in the add-ons list?
led mike
|
|
|
|
|
Actually, to debug this dll i have inserted a MessageBox() in every function,
For e.g.
In windows XP flow is as follows: -
When dll is registered flow is as follows: -
1) DllMain.
2) Dll Register Server.
3) Dll Main.
When you open Explorer.exe
1) Dll Main.
2) Dll GetCLassObject.
3) SetSite.
When you close Explorer.exe
1) Dll Can Unload.
2) DllMain.
But in Windows 2003 flow is as follows: -
When dll is registered flow is as follows: -
1) DllMain.
2) Dll Register Server.
3) Dll Main.
When you open Explorer.exe
No call to DLLMain.
I dont know for few unknown reason DLLMain could not be called.
Please let me know if you have still not understood the problem.
|
|
|
|
|
I found the problem.
In Windows Server 2003, i had to enable 'Enable Third Party Browser' from
Tools-> Internet Options --> Advanced --> Enable Third Party browser extensions (requires restart).
Thanks for your help!!
|
|
|
|
|
In a textbox, I have associated a var of type CString. I want to set it as " / / " & make sure that the user can change or edit /, just add nos & done. What type of formatting should I do and plz show an small eg. if possible. Reqs is for CE.
Also, I need to show a dialog for few mins & then close it. How do I end up doing that part in CE.
Thanks
Terry
|
|
|
|
|
Sounds like you need a "masked" edit control.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
David, eVC++4 & CE doesn't support masked edit control. So, Is their any other better way to deal with the issue.
Thanks
Terry
|
|
|
|
|
Trupti Mehta wrote: eVC++4 & CE doesn't support masked edit control.
How so?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
David, check out this:
http://www.tech-archive.net/Archive/DotNet/microsoft.public.dotnet.framework.compactframework/2005-01/0499.html[^]
At first I checked in eVC4 help, din't find any thing like that. In the Control Box, can't find any control for Masked edit.
On searching for "Masked Edit CE" in google found links where people complain for masked edit not working or not working properly.
Other than the above, I have reached on CE & found that masked edit controls are not compatible with all smart devices.
Based on these resources I am telling that eVc4 & Ce doesn't support Masked.
If you have any way out, I would defintly try for one but not third party.
Thanks
Terry
|
|
|
|
|