|
David,
I made a mistake; I agreed with you and then ask MFC help to check in case I was wrong. I did not realize that it was giving me the description of StringFormat::SetTabStops instead of CEditView::SetTabStops.
“Each tab-stop offset in the tabStops array, except the first one, is relative to the previous one. The first tab-stop offset is relative to the initial offset position specified by firstTabOffset. For example, if the initial offset position is 8 and the first tab-stop offset is 50, then the first tab stop is at position 58. If the initial offset position is zero, then the first tab-stop offset is relative to position 0, the string origin.”
Oh well, that is what happens when you get out of practice.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Hi,
I need to know how to draw the checkbox button text background transparent.
Thanks
|
|
|
|
|
You could try the usual tricks - the WS_EX_TRANSPARENT flag, handling WM_ERASEBKGND, etc.
but I suspect they won't work on checkboxes.
You can always render the text yourself
|
|
|
|
|
Hi,
I have tried to handle WM_ERASEBKGND and I have also set WS_EX_TRANSPARENT for my CButton derived control, but the background still is not transparent.
How can I render the text only? I don't want to draw the box and the checkmark myself.
Thanks
|
|
|
|
|
Yeah... most, if not all, of the standard controls use opaque background on their text.
You can draw it yourself using something like DrawText(). Obtain the checkbox rect in
OnInitDialog() and set the controls text to an empty string (you could get the text first so you
have the text string). In OnPaint(), call the base class OnPaint() then get a DC for the window
and select a pen of the text color into it, set its background mode to transparent, and use
DrawText() to render the string.
The Microsoft recommended method is owner draw.
Mark
|
|
|
|
|
Did you try it with ON_WM_CTLCOLOR_REFLECT ?
for my purposes, it worked...
<br />
class CTransparentCheckbox : public CButton<br />
{<br />
public:<br />
CTransparentCheckbox();<br />
<br />
virtual ~CTransparentCheckbox();<br />
protected:<br />
afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);<br />
DECLARE_MESSAGE_MAP()<br />
};<br />
<br />
<br />
CTransparentCheckbox::CTransparentCheckbox()<br />
{<br />
}<br />
CTransparentCheckbox::~CTransparentCheckbox()<br />
{<br />
}<br />
BEGIN_MESSAGE_MAP(CTransparentCheckbox, CButton)<br />
ON_WM_CTLCOLOR_REFLECT()<br />
END_MESSAGE_MAP()<br />
<br />
HBRUSH CTransparentCheckbox::CtlColor(CDC* pDC, UINT nCtlColor) <br />
{ <br />
ASSERT(nCtlColor == CTLCOLOR_STATIC);<br />
pDC->SetBkMode(TRANSPARENT);<br />
return (HBRUSH)GetStockObject(NULL_BRUSH);<br />
}
greetings,
ralf.
|
|
|
|
|
Hi Ralf,
your tip works perfectly for me! Thank you very much !!!
Greetings
|
|
|
|
|
Hi,
I am developing a dll which uses NetUserGetInfo to retreive the home directory of a Domain user.
NetUserGetInfo returns 1008 error code.
my usage of function:
NetUserGetInfo(Domain-server,domain-user,11,buf)
The problem i was thinking was, The dll is launched by a local user(admin privilages) on a system which is in the same domain. SO may be the local user does not have enough permissions to use the NetUserGetInfo function to retreive the necessary information.
My questions:
1. Is it possible to provide enough permissions for the local-user, How?
2. The other alternate is to connect to domain-server with some power user and then use the NetUserGetInfo function. But I do not find suitable function to connect to domain server with a power user credentials in windows network management API(netapi32.lib)
Thanks for the help
|
|
|
|
|
gbabu17 wrote: NetUserGetInfo returns 1008 error code.
Which is ERROR_NO_TOKEN .
What are Domain-server , domain-user , and buf ?
Do you have UNICODE and _UNICODE defined?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
they are passed to the function correctly, because i am printing them just before passing to the NetUserGetInfo.
|
|
|
|
|
gbabu17 wrote: they are passed to the function correctly...
But are they wchar_t or TCHAR types?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
They are wchar_t types.
i think it is something related to permissions(may be ACL) but i cannot figure it out.
thanks
|
|
|
|
|
In the MSDN-documentation for the InitializeCriticalSection-function it says :
In low memory situations, InitializeCriticalSection can raise a STATUS_NO_MEMORY exception.
Now, what exactly do i have to catch here ?! Couldn't find any hint anywhere.
|
|
|
|
|
Mr.Brainley wrote: Now, what exactly do i have to catch here ?!
There's nothing to catch.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Ok, rephrasing the question : What should i do ? Current strategy : nothing. But what exactly happens in such a low memory situation ? Does it crash the program ?
|
|
|
|
|
Mr.Brainley wrote: What should i do ?
Based on what I read, nothing (can be done).
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: nothing (can be done).
you mean besides stopping an unhandled exception from closing your app?
led mike
|
|
|
|
|
led mike wrote: you mean besides stopping an unhandled exception from closing your app?
Since the exception is not raised in an exception-safe manner, I'm not sure. Don't try and catch it is the only thing I know to do.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Just a guess...
__try
{
::InitializeCriticalSection(...);
}
__except (GetExceptionCode() == STATUS_NO_MEMORY ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
{
...STATUS_NO_MEMORY exception
}
|
|
|
|
|
Hi there,
I have an application that exchanges messages (text message) between a mobile device and another appication software using socket connections (udp to the mobile device and TCP to the second application) and now I need in some circumstances send a short message to a mobile phone (cell phone) so that if the person can not access the mobile device, he can receive a text on his cell phone to go to look into the mobile device. I need to know how I can provide the connection from my application (windows base)to mobile phones using their phone numbers.
I appreciate any usefull idea.
Best regards,
nahitan
|
|
|
|
|
Onw way is to just send an e-mail to their_number@their_carrier. Other than that, is SMS an option?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
As far as i know, i think it can be done using GSM modem and AT commands.
KIRAN PINJARLA
|
|
|
|
|
Can anyone tell me what conditions would cause a call to gmtime() to crash the program?
|
|
|
|
|
SteveRubio wrote: Can anyone tell me what conditions would cause a call to gmtime() to crash the program?
When it's used incorrectly.
Seriously, if you can provide a code snippet, better help can be provided.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Fair enough
static char * yetanotherfunction(){
struct tm *newtime;
time_t ltime;
time(<ime);
newtime = gmtime(<ime);
return (asctime(newtime));
}
The commented line is where the crash occurs. And I've tried moving it around and it is the call to gmtime() that causes problems.
I'm modding a project that I've inherited and this block of code has never caused problems in previous iterations.
|
|
|
|