|
amistry_petlad wrote: ...but rund time break the application
And rightfully so since you did not change sprintf_s() .
"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
|
|
|
|
|
now its working when i used sprintf but in the dialog it should be print hh:mm:yy
I have debug the application i got the perfect string in all varibals but when display in the static control its only shows the hour nothing more. So here in US 1:40:40 so must be displayed but it show me 1 only ?
|
|
|
|
|
amistry_petlad wrote: ...now its working when i used sprintf but...
It makes no difference whether you use sprintf() or sprintf_s() . If you have a malformed format string, you can't expect correct results.
What is the value of buf prior to calling SetDlgItemText() ?
"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
|
|
|
|
|
buf has garbage value now In my debugging i have seen that if 15:22:34
Then in buf shows L(1) only show what is the reason?
so then this character display in the static control
|
|
|
|
|
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
|
|
|
|