|
Hmm, well it didn't work. The "register" IntPtr ALWAYS returns "0"! This is what was happening before.
|
|
|
|
|
Add CharSet=CharSet.Auto and/or CallingConvention=CallingConvention.CDecl to the DllImport attribute to make sure the unmangled DllRegisterServer vtable function is accessible from the outside.
|
|
|
|
|
Can you give me an example of how to use the "CallingConvention" please?
|
|
|
|
|
Well, I've tried it all and it still doesn't work!
The "GetProcAddress" still returns "0" as if it's not even recognizing that there is a function called "DllRegisterServer" which is impossible because if I open the DLL using WordPad I can find that exact text in there.
Here's what I've got so far:
'API Declarations
Private Declare Auto Function FreeLibrary Lib "kernel32.dll" (ByVal hLibModule As IntPtr) As Integer
Private Declare Ansi Function LoadLibrary Lib "kernel32.dll" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As IntPtr
<DllImport("kernel32.dll", EntryPoint:="GetProcAddress", CharSet:=CharSet.Auto, CallingConvention:=CallingConvention.Cdecl)> _
Private Function GetProcAddress2(ByVal hModule As IntPtr, ByVal lpProcName As String) As IntPtr
End Function
Private Declare Auto Function GetProcAddress Lib "kernel32.dll" (ByVal hModule As IntPtr, ByVal lpProcName As String) As IntPtr
Private Declare Ansi Function CallWindowProc Lib "user32.dll" Alias "CallWindowProcA" (ByVal PrevWndFunc As IntPtr, ByVal hWnd As Integer, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Public Function Register() As Boolean
Dim hResult As Integer
Dim hLib, hAddress As IntPtr
hLib = Me.LoadLibrary(_Path)
If (hLib.Equals(IntPtr.Zero)) Then Return False 'Failed to Load the Library
Try
'Get the Address of the DllRegisterServer Function
hAddress = Me.GetProcAddress2(hLib, "DllRegisterServer")
If (hAddress.Equals(IntPtr.Zero)) Then Exit Try
'Execute the Function
hResult = CallWindowProc(hAddress, 0, 0, 0, 0)
Catch
Finally
'Free the Library
hResult = FreeLibrary(hLib)
End Try
End Function
Any ideas?
|
|
|
|
|
I need to add users and change password of some users throught code, by using C# in Active Directory. Does anyone have an example of this, or can point a URL with an example ?
thanks in advance
Mauricio Ritter - Brazil
Sonorking now: 100.13560 MRitter
Life is a mixture of painful separations from your loved ones and joyful reunions, without those two we'd just be animals I guess. The more painful the separation, that much more wonderful will be the reunion - Nish
"Th@ langwagje is screwed! It has if's but no end if's!! Stupid php cant even do butuns on forms! VISHAUL BASICS ARE THE FUTSHURE!" - Simon Walton
|
|
|
|
|
These lines are from Professional C# by Wrox press.I suggest you to download sample codes from www.wrox.com,There are two application in that source code that have all examples about Active Directory and C#.
Add user:
using (DirectoryEntry de = new DirectoryEntry())
{
de.Path = "LDAP://celticrain/OU=Wrox Press, DC=eichkogelstrasse, DC=local";
DirectoryEntries users = de.Children;
DirectoryEntry user = users.Add("CN=John Doe", "user");
user.Properties["company"].Add("Some Company");
user.Properties["department"].Add("Sales");
user.Properties["employeeID"].Add("4711");
user.Properties["samAccountName"].Add("JDoe");
user.Properties["userPrincipalName"].Add("JDoe@eichkogelstrasse.local");
user.Properties["sn"].Add("Doe");
user.Properties["givenName"].Add("John");
user.Properties["userPassword"].Add("someSecret");
user.CommitChanges();
}
Change properties(password):
using (DirectoryEntry de = new DirectoryEntry())
{
de.Path = "LDAP://celticrain/CN=John Doe, CN=Users, DC=eichkogelstrasse, DC=local";
de.Invoke("SetPassword", "anotherSecret");
de.CommitChanges();
ActiveDs.IADsUser user = (ActiveDs.IADsUser)de.NativeObject;
user.SetPassword("someSecret");
user.AccountDisabled = false;
de.CommitChanges();
}
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
Thanks Mazy !
Mauricio Ritter - Brazil
Sonorking now: 100.13560 MRitter
Life is a mixture of painful separations from your loved ones and joyful reunions, without those two we'd just be animals I guess. The more painful the separation, that much more wonderful will be the reunion - Nish
"Th@ langwagje is screwed! It has if's but no end if's!! Stupid php cant even do butuns on forms! VISHAUL BASICS ARE THE FUTSHURE!" - Simon Walton
|
|
|
|
|
Hello everyone.
How can build an exe file by VS .NET to execute it on Windows_98?
Thank you
|
|
|
|
|
If this is a .NET assembly, just make sure the .NET Framework is installed on the client's machine. If you built an unmanaged VC++ project, there are countless things you must insure. To name a few of the biggies:
- Make sure you're not using Unicode methods without the Unicode layer for Win9x
- Make sure you're not using methods that only work on Windows NT (such as the Network Management API or the GINA methods)
- If you do use Unicode, make sure you make two builds: 1 for ANSI and 1 for Unicode. Make sure you install the appropriate build on the appropriate platform.
"Well, I wouldn't say I've been missing it, Bob." - Peter Gibbons
|
|
|
|
|
I've got a huge database table (near 50000 records) and I want to use a ComboBox to select one of this records. First, I've used a DataSet like this :
<br />
DataSet ds=LoadArticlesDataSet();
this.comboArticles.DataSource=ds.Tables[0];<br />
this.comboArticles.DisplayMember="code_ne";
But the data loading was too long :
- LoadArticles took 3/4 seconds
- this.comboArticles.DataSource took 3/4 seconds
- this.comboArticles.DisplayMember took 3/4 seconds too.
To reduce the combo's time loading, I chose to construct the ComboBox at the start of the program in another class named CDataBase :
<br />
public FArticle(CDataBase db)<br />
{<br />
InitializeComponent();<br />
this.panel.Controls.Add(db.comboArticles);<br />
}<br />
Unfortenately, the first form's painting still takes 4/5 seconds.
Do you have a solution to make the ComboBox faster or do you know another control which could be used instead of the standard one ?
For example, Have you ever seen an Access-like combo control which shows only a part of its items and has an auto-completion ?
Thanks !
jpeg
|
|
|
|
|
I hope this is the right forum for this question.
I have several functions written in VBA that I use as Add-ins to Excel 2002 (v10). Several variations require iterations to solve so I want to modify these functions in C# and create several DLLs. I have created and built a DLL in C# for a coupled of simple functions that work when called from a console project. I have added a reference to C:\WINDOWS\assembly\GAC\Microsoft.Office.Interop.Excel\10.0.4504.0__31bf3856ad364e35\Microsoft.Office.Interop.Excel.dll in class module (dll) project. I want to have the users load/unload the Add-ins through Tools | Add-in dialog.
How do I now register this dll in Excel? Do I have to create a wrapper in VBA? Does anyone have an example?
Thanks
don
When you come to a fork in the road, take it! Y. Berra
|
|
|
|
|
I'm told that every c# application can be easily decompiled into source (and not crappy c++ decomilation, but nice readable code). So basically all the apps you write will be open source, not in the legal sense, but in the physical sense. Everyone I know who writes c# is either starting to face this issue or admits that he'll have to eventually. Seems to me this should have been part of VS.net.
What are you doing about it? I've heard there's going to be an obsucator out for C# that will cost like $1000, does anyone know of any others? I couldn't find articles about it here on codeproject...
Or do an of the MS guys know if MS will add obfuscation into vs.net?
thanks
"Outside of a dog, a book is Man’s best friend. And inside of a dog, it’s too dark to read."
-Groucho Marx
|
|
|
|
|
Dotfuscator claims that Microsoft will be using a community edition of their production in VS.NET.
Thanks,
Wes
|
|
|
|
|
Like Wesner said, the 2003 version of Visual Studio will contain a community version of "Dotfuscator", but you can already download it now.
I, too, am very worried about decompilation of my work. Anakrino makes it very easy to decompile any .net assembly function/type. With a little work, source code for an entire assembly can be reproduced from the DLLs and EXEs! Obfuscators will only slow down this process, but not disable it.
Any solutions appreciated...
VictorV
|
|
|
|
|
|
Well, I know several 'software engineers' who already do this... Damn, they are ahead in the game!
VictorV
|
|
|
|
|
Does anyone know if it is possible to get to the raw socket for the connection associated with an HttpRequest when writing an HttpHandler ?
|
|
|
|
|
The internal Socket connection is managed by the System.Net.Connection class. Unfortunately, there is no way to get this connection from the public properties of a current HttpWebRequest instance. You have to derive from this class.
|
|
|
|
|
hi,
beside a listbox,I put two buttons, one with up arrow icon, and one with down arrow icon.
I wish the selected item can be move up or down by pressing one of two buttons, for example,
there are 4 items in listbox, item1,item2,item3,item4, after selected item2, and press the up arrow button a time,the order become item2,item1,item3,item4, and if press the down arrow button three times,the order is
item1,item3,item4,item2.
and how can I do that?
thanks for any idea.
|
|
|
|
|
i have a clock function going . it is started by a seperate thread at the application startup
it works like this
while(myThread.IsAlive==true)
{StatusBarPanel.Text = DateTime.Now.ToString();}
it works but i want a more effientway (it eats too many cpu cycles) i tryed using timers.. i tryed reading the documentation but i cant seem to figure it out .. can someone PLEASE help me ? i dont understand i can import dll's all kinds of stuff.. but something as simple as this haunt's me. its got me up nights !!
Additional my program launches a recursive search agian with a new thread but set to the ThreadPriority.Highest Level i would like too disable this(clock) during that search.
|
|
|
|
|
|
I guess that would be the stack size limit.
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
|
Well, you could increase the size of the stack, don't know what the limit is with .NET, on the other hand, I never came across a recursive function *that* recursive
And remember that there is always a perfomance hit on each function call.
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|