Click here to Skip to main content
15,906,574 members
Home / Discussions / C#
   

C#

 
GeneralRe: EventLog or System.Diagnostics classes not working.. Pin
20-Nov-01 12:15
suss20-Nov-01 12:15 
QuestionHow can show a child window whith the main window Pin
aner_glx15-Nov-01 22:31
aner_glx15-Nov-01 22:31 
GeneralRunning C# Windows Application Pin
Rick Crone15-Nov-01 6:03
Rick Crone15-Nov-01 6:03 
GeneralRe: Running C# Windows Application Pin
Nish Nishant15-Nov-01 13:41
sitebuilderNish Nishant15-Nov-01 13:41 
GeneralURL for .NET redistributable Pin
Nish Nishant15-Nov-01 13:50
sitebuilderNish Nishant15-Nov-01 13:50 
GeneralRe: Running C# Windows Application Pin
Paul Watson17-Nov-01 4:27
sitebuilderPaul Watson17-Nov-01 4:27 
GeneralRe: Running C# Windows Application Pin
5-Dec-01 22:51
suss5-Dec-01 22:51 
GeneralCalling a C++ DLL from C# Pin
Jose Fco Bonnin14-Nov-01 22:16
Jose Fco Bonnin14-Nov-01 22:16 
I have the next DLL:

".h"
#ifdef BABMD5_EXPORTS
#define BABMD5_API __declspec(dllexport)
#else
#define BABMD5_API __declspec(dllimport)
#endif

// This class is exported from the BabMD5.dll
class BABMD5_API CBabMD5 {
public:
CBabMD5(void);
};

BABMD5_API long WINAPI EncodeText(LPCTSTR p_sPlainText, LPTSTR p_sEncodedText, long nBufferLen);

".cpp"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}

BABMD5_API long WINAPI EncodeText(LPCTSTR p_sPlainText,LPTSTR p_sEncodedText, long nBufferLen)
{
CMD5 m_md5;
// Here get the user name always in uppercase,
// and if we've got a NULL pointer then we fill it with an empty string
// We've done this way because of Visual Basic null strings

if(p_sPlainText!=NULL)
m_md5.setPlainText( _strupr((LPTSTR)p_sPlainText) );
else
m_md5.setPlainText("");


if (nBufferLen>32)
// and return the encoded string also un uppercase
strcpy(p_sEncodedText,_strupr((LPTSTR)m_md5.getMD5Digest()));

return 33;
}

// This is the constructor of a class that has been exported.
// see BabMD5.h for the class definition
CBabMD5::CBabMD5()
{
return;
}

I need call the function "EncodeText" from C# to do it I typed the next code:
[DllImport("BabMD5.dll")] static extern long EncodeText(
string p_password,
[MarshalAs(UnmanagedType.LPTStr)]string p_encText,
long p_size);
...
try {
string sText = "";
EncodeText("testestest",sText,33);
} catch(DllNotFoundException exc) {
Console.WriteLine(exc.ToString());
} catch(EntryPointNotFoundException exc) {
Console.WriteLine(exc.ToString());
}

But I doesn't return nothing. Anybody know what's happen?
Thank you.
GeneralRe: Calling a C++ DLL from C# Pin
aner_glx15-Nov-01 22:24
aner_glx15-Nov-01 22:24 
GeneralRe: Calling a C++ DLL from C# Pin
Jose Fco Bonnin16-Nov-01 4:37
Jose Fco Bonnin16-Nov-01 4:37 
GeneralRe: Calling a C++ DLL from C# Pin
aner_glx16-Nov-01 21:39
aner_glx16-Nov-01 21:39 
GeneralWM_COPYDATA Pin
rose33712-Nov-01 19:53
rose33712-Nov-01 19:53 
GeneralC# and COM (Connection Points) Pin
Anders Molin9-Nov-01 5:35
professionalAnders Molin9-Nov-01 5:35 
Generalproblem registering class Pin
dsdsds9-Nov-01 4:13
dsdsds9-Nov-01 4:13 
GeneralRe: problem registering class Pin
rchiav9-Nov-01 5:28
rchiav9-Nov-01 5:28 
Generalwho can give me an example Pin
7-Nov-01 14:54
suss7-Nov-01 14:54 
GeneralChanging data on a different form Pin
5-Nov-01 8:35
suss5-Nov-01 8:35 
GeneralRe: Changing data on a different form Pin
AndyG5-Nov-01 11:43
AndyG5-Nov-01 11:43 
GeneralRe: Changing data on a different form Pin
6-Nov-01 3:50
suss6-Nov-01 3:50 
GeneralClass.forName() Pin
Jamie Hale4-Nov-01 16:54
Jamie Hale4-Nov-01 16:54 
GeneralRe: Class.forName() Pin
Chris Maunder15-Nov-01 14:04
cofounderChris Maunder15-Nov-01 14:04 
GeneralSearch files Pin
Makyana4-Nov-01 3:08
Makyana4-Nov-01 3:08 
GeneralRe: Search files Pin
Andreas Philipson4-Nov-01 14:47
Andreas Philipson4-Nov-01 14:47 
GeneralOutput to MS Word using C# Pin
1-Nov-01 8:41
suss1-Nov-01 8:41 
GeneralRe: Output to MS Word using C# Pin
Eric Gunnerson (msft)2-Nov-01 6:15
Eric Gunnerson (msft)2-Nov-01 6:15 

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.