|
Hello,
I am trying to set password for a existing user in active directory. I have created user in active directory successfully, and when i am trying to set password using the foloowing code it failes. When i tried calling ADsGetLastError i am not getting any error message or error code. It is showing 0 (Error code) always..
IADsUser *pIADsUser = 0;
try{
hr = ADsGetObject(L"LDAP://CN=prasad,OU=Sales,DC=ads,DC=com",IID_IADsUser,(void**)&pIADsUser);
_variant_t ovar;
hr = pIADsUser->SetPassword(L"prasad");
//hr = pIADsUser->SetInfo();
}
catch(const _com_error *e)
{
_bstr_t bst = e->Description();
}
DWORD dwLastError;
WCHAR szErrorBuf[MAX_PATH];
WCHAR szNameBuf[MAX_PATH];
hr = ::ADsGetLastError(&dwLastError,szErrorBuf,MAX_PATH -1 ,szNameBuf,MAX_PATH-1);//it returns dwLastError = 0
It will be apreciated if anybody can help me...
regards
prasad
|
|
|
|
|
prasadkmadam wrote:
try{
hr = ADsGetObject(L"LDAP://CN=prasad,OU=Sales,DC=ads,DC=com",IID_IADsUser,(void**)&pIADsUser);
if(FAILED(hr))
return hr;
if(!pIADsUser)
return E_FAIL;
_variant_t ovar;
hr = pIADsUser->SetPassword(L"prasad");
//hr = pIADsUser->SetInfo();
}
Could you please make the suggested changes and see if any of the added conditions are true.
P.S. Please, please, please use CComPtr instead of raw pointers.
|
|
|
|
|
Thanks for your reply.
I tried with your suggestions but ADsGetObject() funtion is working fine.
It returned SUCCESS (means 0) and the pIADsUser is having a proper value.
There is no assertion while calling SetPassword() and the call is taking some time also (it seems it contacting the server) but it is returned hr contains some junk value and when i tried calling ADsGetLastError it returned me last error as 0..i dont know what went wrong..
It is not even giving a proper error code..
please help
regards
prasad
|
|
|
|
|
hi All,
I have a form-view app. I have changed the color of the form into blue. i have placed one CStatic control (text) on this form. This control background color is gray. To change this background into the form color(blue), I did subclassing and immplemented "message reflection". But still the CStatic is having gray background. i have written the following code in MyCStatic control class.
// this is the handler for WM_CTLCOLOR message
HBRUSH mystatic::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
pDC->SetBkColor(RGB(0,0,255));
m_brush.CreateSolidBrush(RGB(0,0,255));
hbrush = (HBRUSH) m_brush;
return hbrush;
}
|
|
|
|
|
Did you try handling CTLCOLOR_STATIC inside your form view's OnCtlColor function?
|
|
|
|
|
For colored statics, you may find useful info in these articles:
* Using colors in CEdit and CStatic[^]
* Colored/Blinking Controls and Dialogs with any Font[^]
Using message reflection is the way to do so (ON_WM_CTLCOLOR_REFLECT)
You shouldn't create your brush each time OnCtlColor is called. You could initialized it only once and then pass its handle. Moreover, for each CreateSolidBrush should there be a DeleteObject, or your system will run low for GDI objects.
HTH,
K.
HTH,
K.
Angels banished from heaven have no choice but to become demons
Cowboy Bebop
|
|
|
|
|
Hi, thanks alot . Suggestions by both of you helped me really well.
|
|
|
|
|
MAPISendDocuments on Win2K functioned not, with a CreateProcess call by a Printer PortMonitor.
Hello,
I has the following problem:
if I a program normally start and the MAPI function sending document call can I a document by mail dispatch.
if the program startet by a CreateProcess by a PrinterMonitor from a Printer called functions this not and I receive the error message MAPI_E_LOGON_FAILURE
Thanks for answer, K. Bauer
Sorry for my bad english.
|
|
|
|
|
hi coders,
does somebody of you know how to change the IP of a WINNT System in VC++ ??
Thanks
da sonu
|
|
|
|
|
Sonu Kapoor wrote:
IP of a WINNT System in VC++
calling the right API interface?
Really, just entering "IP" into MSDN revealed that IPHelper might be what you want.
From there you can start to follow the references.
Glad to have helped - the only thing need to do yourself is the reading!
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
is there someone who uses TVM_GETISEARCHSTRING?
t!
http://www.codeproject.com/treectrl/rgtree.asp?forumid=2494&exp=0&app=50&select=131468&df=100&tid=131468#xx131468xx
|
|
|
|
|
Hi,
I try to compile this code:
std::sort(actionlist.begin(), actionlist.end(), compareActionlist);<br />
actionlist is a vector.
But i get this error:
error C2039: 'sort' : is not a member of 'std'
I have tried to put using namespace std in the top, but that doesn't help.
Can someone help me? Thanks!
|
|
|
|
|
have you done this:
#include < algorithm >
?
WWT2D?
|
|
|
|
|
Thanks, i get now some other errors but i think i can make it.
|
|
|
|
|
Hi,
Consider a thread function:
MyThreadFunc()
{
<code> Sleep(50000);</code>
return;
}
As can be seen above that my thread blocks in the middle. What i want is that whenever user close my application, all the threads no matter what are they doing should first end gracefully but immediately. But suppose that my thread is stick on some blocking operation as shown in above code. How can i immediately cancel this blocking call and ask the thread to exit properly?? Infact i am using events after every next statements to check their status and exit my threads, but under such situations where the thread is stuck in a long blocking call my application waits like a hell. I want to immediately finish this thread. How ???
Example: In MSN messenger there is an option of cancel sign in . If we select this option then the connecting thread "immediately" stops working. Of course this thread calls various blocking Winsock calls especially for domain resolving, but it ends immediately.
|
|
|
|
|
See WaitForSingleObject in the MSDN and set the event when you want the Thread to stop.
Arjan.
|
|
|
|
|
So what kind of blocking functions are you calling? If you're using Winsock you can create a non-blocking socket and check to see if a connection has been made or a message has been sent/received using the select function. If you want, this select function can 1) not block at all (not recommended) or 2)block for a set amount of time. If you are using sockets I would loop through: telling the select function to block for an undetectable fraction of a second, check to see if the operation has completed, and repeat until the operation either completes, is cancelled, or is timed out.
-Michael Anderson- 完成の円
|
|
|
|
|
My suggestion is to make it appear that the thread exits immediately even though it doesn't. In your MSN message example, how do you know the thread stops immediately? If a dialog box goes away, maybe it wasn't controlled by the blocked thread. After all, how does it respond to your click on "cancel sign in" if the thread is blocked?
Also, are you sure the MSN messenger thread is blocked? Maybe it made an asynchronous call and is processing messages until it gets a reply.
If you absolutely have to have the thread exit immediately, you can call TerminateThread, but read the docs about why it's a bad idea.
|
|
|
|
|
Shah Shehpori wrote:
How can i immediately cancel this blocking call and ask the thread to exit properly?
In addition to the obvious answers you'll get, I thought I'd add a little apparently-not-too-well-known-something.
Depending on what the thread is blocked by, what you request might actually not be possible. There are instances when a thread hangs in the kernel, making it effectively impossible to terminate the process (the only way to terminate such a process is power off or hardware reset).
|
|
|
|
|
Umm I have no idea where to look to find out how to make my MFC program run in the system tray, can someone please point me in a general direction, much appreciated
|
|
|
|
|
|
I searched through the stuff but nothing came up, who feels like a loser now :P
|
|
|
|
|
Does the code you need?
//////////////////////
#define WM_SYSTRAY WM_USER +100
BEGIN_MESSAGE_MAP(CAppDlg, CDialog)
//{{AFX_MSG_MAP(CAppDlg)
ON_MESSAGE(WM_SYSTRAY,OnNotifyMsg)
END_MESSAGE_MAP()
///////////////////////////////////////////////////////////
// add to systray
NOTIFYICONDATA niData;
HICON hIcon;
hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
niData.cbSize = sizeof(NOTIFYICONDATA);
niData.hWnd = m_hWnd;
niData.uID = 100;
niData.uFlags = NIF_ICON|NIF_MESSAGE|NIF_TIP;
niData.hIcon = hIcon;
niData.uCallbackMessage = WM_SYSTRAY;
sprintf(niData.szTip,"app name");
Shell_NotifyIcon(NIM_DELETE ,&niData);
///////////////////////////////////////////////////////////
// message handle
afx_msg LRESULT CAppDlg::OnNotifyMsg(WPARAM wParam, LPARAM lParam)
{
switch(lParam)
{
case WM_LBUTTONDOWN:
break;
case WM_LBUTTONDBLCLK:
this->OnRestore();
break;
case WM_RBUTTONDOWN:
....
}
Our way isn't a soft-glass
It is a mountain with path is rock
But it goes towards, forward upward the sun.
|
|
|
|
|
Hi,
Anyone knows how to implement a class similar to RichEdit control (i.e. with text formattings) and the method we can get the mouse click on some words (or "links") in its content ?
Thanks
|
|
|
|
|
hi,
I got a dll file in which one of its function process time
is about 5 seconds.
When I do iteration, the process time becomes 5 seconds x
number of iterations which makes my application very slow.
I tried to create multiple threads in my application
but it didn't have effect because those thread will
share a single thread of the dll.
According to what I've read in MSDN, all windows application
share the same dll process in memory. So if many application
use it, its process becomes slow.
My question is, Is there a way to create multiple process
of the DLL in memory? So I can use different processes of
DLL for each iteration? any pointers or any article suggestions..please..thanks in advance
Himanshu
|
|
|
|