|
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
|
|
|
|
|
Trupti Mehta wrote: In the Control Box, can't find any control for Masked edit.
It's not a built-in control. You'll have to roll your own. CP has dozens of examples.
"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
|
|
|
|
|
I do programming using Visual C/C++. A friend wanted a couple very simple functions his small hand held phone/PC could perform. He said his device was Windows CE compatible. Basically, he wanted two things. Ability to enter some data via the keypad and have a simple math result calculated and displayed, and also the ability to send data to his phone and have a simple math result displayed when selected.
I don't understand what the best development tool would be for something like this, and what things I should be wary of.
I would like to do the initial development using my Visual C++ 6.0 on my desk top PC, and then transform the code to move to the Windows CE environment.
Any suggestions?
Thanks!
|
|
|
|
|
Hi everybody,
i want to draw an effect on a view, which seems like the view is locked.
The whole view should be dark.
Till now, i made it this way:
<pre>void MyView::OnDraw(CDC* pDC)
{
for(int lin=0; lin<height; lin+=2) {
for(int col=0; col<width; col+=2 {
pDC->SetPixel(col,lin,RGB(0,0,0));
}
}
}</pre>
it works for the background, but the controls on the view are drawn correctly.
It's logical that only the background is "colored" this way.
But how is it possible to draw on the entire view with'in the controls?
Big thanks for any help
|
|
|
|
|
Well that's not the fastest code to erase view area with a given color.
As for controls, each control is a window, hence you have to handle the draw of all of them (see WM_CTLCOLOR message on MSDN [^]).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Thanks for your answer
So i place a locked variable into my view
And the derived controls (for example MyTextBox) have to handle the drawing if the locked-variable of the parent is set to TRUE. You mean it this way?
So that each control on the view draws itself the shadow?
Thanks
|
|
|
|
|
Yes.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Two suggestions: CDC::FillSolidRect () is a more efficient way to make a solid rectangle on your view. Also using an owner-drawn button would allow you to make any color or shadow you want.
|
|
|
|