Click here to Skip to main content
15,891,529 members
Home / Discussions / C#
   

C#

 
QuestionHow to autohide cursor after some time Pin
DarthVelorien22-Mar-06 2:54
DarthVelorien22-Mar-06 2:54 
QuestionWhat's font fastest when draw? Pin
pmasknguyen22-Mar-06 2:33
pmasknguyen22-Mar-06 2:33 
AnswerRe: What's font fastest when draw? Pin
Ed.Poore22-Mar-06 6:38
Ed.Poore22-Mar-06 6:38 
Questionuser: esjq question Pin
Rmokkenstorm22-Mar-06 1:08
Rmokkenstorm22-Mar-06 1:08 
AnswerRe: esjq Pin
J4amieC22-Mar-06 1:50
J4amieC22-Mar-06 1:50 
QuestionSending the active window to the printer Pin
Chals22-Mar-06 0:39
Chals22-Mar-06 0:39 
AnswerRe: Sending the active window to the printer Pin
sreejith ss nair22-Mar-06 2:26
sreejith ss nair22-Mar-06 2:26 
QuestionP/Invoke: Working with LDAP. Can't get all attributes. (Wldap32.dll) Pin
subAdm21-Mar-06 23:19
subAdm21-Mar-06 23:19 
Hello!
In my project I try to use LDAP services via P/Invoke (it's a mustFrown | :( . All the stuff worked fine till the certain moment. Now when I need to go thru the object's attributes I just stumble upon the problem that I can't get an attribute other then the first!!! Just because function ldap_next_attribute returns a zero value instead of the pointer to the next attribute in the array. Here is the code:
<br />
        private static NameValueCollection WR_LDAPGetAllAttributes(IntPtr pEntry)<br />
        {<br />
            NameValueCollection nvcAttrVals = new NameValueCollection();<br />
            IntPtr pBer = new IntPtr();<br />
            IntPtr ppValue;<br />
            int iValueCnt=0;<br />
            IntPtr pAttribute = ldap_first_attribute(pLDAP, pEntry, out pBer);<br />
            while (pAttribute != IntPtr.Zero)<br />
            {<br />
                ppValue = ldap_get_values(pLDAP, pEntry, pAttribute);<br />
                if (ppValue == IntPtr.Zero)<br />
                {<br />
                    nvcAttrVals = null;<br />
                    return nvcAttrVals;<br />
                }<br />
                else<br />
                {<br />
                    iValueCnt = ldap_count_values(ppValue);<br />
                    if (iValueCnt==0)<br />
                    {<br />
                        nvcAttrVals = null;<br />
                        return nvcAttrVals;<br />
                    }<br />
                    else<br />
                    {<br />
                        string sAttrVal = "";<br />
                        int ippValue = ppValue.ToInt32();<br />
                        for (int z = 0; z < iValueCnt; z++)<br />
                        {<br />
                            ippValue = ippValue + sAttrVal.Length * z;<br />
                            IntPtr pVal = Marshal.ReadIntPtr(new IntPtr(ippValue));<br />
                            sAttrVal = Marshal.PtrToStringAuto(pVal);<br />
                            nvcAttrVals.Add(Marshal.PtrToStringAuto(pAttribute), sAttrVal);<br />
                        }                        <br />
                    }<br />
                }<br />
                pAttribute = ldap_next_attribute(pLDAP, pEntry, ref pBer);<br />
            }<br />
            return nvcAttrVals;<br />
        }<br />

here is the origial definitions:
<br />
// there seem to be no problems with this one<br />
PCHAR ldap_first_attribute(<br />
   LDAP* ld,<br />
   LDAPMessage* entry,<br />
   BerElement** ptr<br />
);<br />
[DllImport("Wldap32.dll", EntryPoint = "ldap_first_attribute", CharSet = CharSet.Auto)]<br />
   private static extern IntPtr ldap_first_attribute(<br />
   IntPtr id,<br />
   IntPtr entry,<br />
   out IntPtr ber);<br />
<br />
// the problem come up with this function<br />
PCHAR ldap_next_attribute(<br />
   LDAP* ld,<br />
   LDAPMessage* entry,<br />
   BerElement* ptr<br />
);<br />
[DllImport("Wldap32.dll", EntryPoint = "ldap_next_attribute", CharSet = CharSet.Auto)]<br />
   private static extern IntPtr ldap_next_attribute(<br />
   IntPtr id,<br />
   IntPtr entry,<br />
   ref IntPtr ber);<br />


I will appreciate way much if anyone help me. Thank you in advance.
QuestionSerialport Communication Pin
ASGuru21-Mar-06 23:02
ASGuru21-Mar-06 23:02 
QuestionAccessing Variables / Functions Pin
FireDK21-Mar-06 22:36
FireDK21-Mar-06 22:36 
AnswerRe: Accessing Variables / Functions Pin
CWIZO21-Mar-06 23:03
CWIZO21-Mar-06 23:03 
GeneralRe: Accessing Variables / Functions Pin
FireDK21-Mar-06 23:19
FireDK21-Mar-06 23:19 
GeneralRe: Accessing Variables / Functions Pin
CWIZO21-Mar-06 23:23
CWIZO21-Mar-06 23:23 
GeneralRe: Accessing Variables / Functions Pin
FireDK21-Mar-06 23:40
FireDK21-Mar-06 23:40 
GeneralRe: Accessing Variables / Functions Pin
CWIZO21-Mar-06 23:42
CWIZO21-Mar-06 23:42 
GeneralRe: Accessing Variables / Functions Pin
FireDK21-Mar-06 23:46
FireDK21-Mar-06 23:46 
QuestionPriniting Problem Pin
shubhabratam21-Mar-06 21:41
shubhabratam21-Mar-06 21:41 
AnswerRe: Priniting Problem Pin
Vasudevan Deepak Kumar21-Mar-06 21:43
Vasudevan Deepak Kumar21-Mar-06 21:43 
GeneralRe: Priniting Problem Pin
shubhabratam21-Mar-06 22:04
shubhabratam21-Mar-06 22:04 
AnswerRe: Priniting Problem Pin
albCode21-Mar-06 22:14
albCode21-Mar-06 22:14 
Questionhelp in using Ado.net Pin
malak nour21-Mar-06 21:40
malak nour21-Mar-06 21:40 
AnswerRe: help in using Ado.net Pin
Vasudevan Deepak Kumar21-Mar-06 21:45
Vasudevan Deepak Kumar21-Mar-06 21:45 
AnswerRe: help in using Ado.net Pin
V.21-Mar-06 22:09
professionalV.21-Mar-06 22:09 
AnswerRe: help in using Ado.net Pin
albCode21-Mar-06 22:19
albCode21-Mar-06 22:19 
QuestionReorganize directories project Pin
fregolo5221-Mar-06 20:55
fregolo5221-Mar-06 20:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.