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

C#

 
GeneralFile I/O fun with binary files Pin
BrewCrew2-Jul-03 5:27
BrewCrew2-Jul-03 5:27 
GeneralRe: File I/O fun with binary files Pin
BrewCrew7-Jul-03 4:02
BrewCrew7-Jul-03 4:02 
GeneralAccessing an inbox in the SMTP service Pin
Johan Danforth2-Jul-03 5:11
Johan Danforth2-Jul-03 5:11 
GeneralRe: Accessing an inbox in the SMTP service Pin
lykac2-Jul-03 12:37
lykac2-Jul-03 12:37 
GeneralRe: Accessing an inbox in the SMTP service Pin
Johan Danforth2-Jul-03 20:33
Johan Danforth2-Jul-03 20:33 
QuestionHow to tell which row of DataGrid has been selected? Pin
Khang Nguyen2-Jul-03 4:38
Khang Nguyen2-Jul-03 4:38 
QuestionHOW to set html element's VALUE. Pin
Asim N.2-Jul-03 0:47
Asim N.2-Jul-03 0:47 
AnswerRe: HOW to set html element's VALUE. Pin
dynamic2-Jul-03 1:46
dynamic2-Jul-03 1:46 
GeneralProblem with DllImport Pin
jtmtv181-Jul-03 19:52
jtmtv181-Jul-03 19:52 
GeneralRe: Problem with DllImport Pin
Nathan Blomquist2-Jul-03 5:01
Nathan Blomquist2-Jul-03 5:01 
GeneralACCESSING IIS Pin
Asim N.1-Jul-03 19:39
Asim N.1-Jul-03 19:39 
GeneralRe: ACCESSING IIS Pin
Matt Newman2-Jul-03 5:55
Matt Newman2-Jul-03 5:55 
Generaladding image in SubItems of ListView Pin
azusakt1-Jul-03 16:49
azusakt1-Jul-03 16:49 
QuestionC# equivalent of CMap? Pin
mcgahanfl1-Jul-03 13:36
mcgahanfl1-Jul-03 13:36 
AnswerRe: C# equivalent of CMap? Pin
Wesner Moise1-Jul-03 14:00
Wesner Moise1-Jul-03 14:00 
QuestionHow to set column widths of DataGrid, Anyone? Pin
Khang Nguyen1-Jul-03 13:28
Khang Nguyen1-Jul-03 13:28 
AnswerRe: How to set column widths of DataGrid, Anyone? Pin
Anonymous2-Jul-03 9:09
Anonymous2-Jul-03 9:09 
GeneralRe: How to set column widths of DataGrid, Anyone? Pin
Khang Nguyen2-Jul-03 12:24
Khang Nguyen2-Jul-03 12:24 
GeneralDesignerSerializationAttribute Pin
Kastro1-Jul-03 9:21
Kastro1-Jul-03 9:21 
GeneralRe: DesignerSerializationAttribute Pin
leppie1-Jul-03 13:05
leppie1-Jul-03 13:05 
GeneralRe: DesignerSerializationAttribute Pin
Kastro2-Jul-03 8:58
Kastro2-Jul-03 8:58 
GeneralSome C++ conversions over C#? Need help! Pin
Member 160351-Jul-03 7:54
Member 160351-Jul-03 7:54 
Hello everyone.

I planned to migrate some C++ codes into C#. I know some basic syntax of c++, but recently i had huge problems on understanding it and how to convert it in c#?

All together 7 questions. I don't plan to pick up c++ at the moment! Hope you all don't mind helping me. Thanks.

1) Basically there will a header file called: haha.h

haha.h
=======
#ifdef HAHA_EXPORTS
#define HAHA __declspec(dllexport)
#else
#define HAHA __declspec(dllimport)
#endif

extern "C"
{
//some functions
// E.g.
extern HAHA int Unhook();
}

How do you convert such thing into c#? Any idea? Yeah i know that c# don't have header files.

2)

LRESULT CALLBACK MouseProc(int iCode, WPARAM wParam, LPARAM lParam)
{
//...
//...
return CallNextHookEx(hHook, iCode, wParam, lParam);
}

Basically in C#, how do we do callback like in c++? Delegates.. this is what i found from google. Any idea how to convert that callback functions in delegates?

I tried to seach CallNextHookEx(,,,) code in the C++ source code, can't find! There is no such function?

3) Hook and Unhook --> How do we hook and unhook in c#?

Just say, if i am using DirectInput, do i need to hook anymore or Directx can handle everything for me! If i use directx, do i need to store the keyboard or mouse into buffer or something!

4)

BOOL WINAPI DllMain(HINSTANCE hInst, DWORD dwReason, PVOID pvReserved)
{
if (dwReason == DLL_PROCESS_ATTACH)
hInstance = hInst;
return true;
}

Hmm.. is all these being done in c# automatically when i create a new project in vs.net?

5)

#define MAX_NUMBER 100

in C#, we replace const for #define? Can we use other better ways? I heard in C++, they had #define and const too!

6) int (*callback)(char*, char*) = NULL;

How to convert this in c#? I only manage to figure this out,

int (callback - not sure what to place here)(ref char, ref char) = null;

7) In C++, they had these few functions, not sure what is it in c#?

a. MapVirtualKey(key, 0)

b. KBDLLHOOKSTRUCT *keyinfo = (KBDLLHOOKSTRUCT *) lParam; // sounds related to keyboard

c. HC_ACTION

d. LLKHF_INJECTED

e. MSLLHOOKSTRUCT *mouseinfo = (MSLLHOOKSTRUCT *) lParam; // sounds related to mouse

Please help!

Thank you.

Regards,
Chua Wen Ching :p
GeneralRe: Some C++ conversions over C#? Need help! Pin
jspano2-Jul-03 14:54
jspano2-Jul-03 14:54 
GeneralRe: Some C++ conversions over C#? Need help! Pin
Nick Seng2-Jul-03 15:45
Nick Seng2-Jul-03 15:45 
GeneralEffective Localization & Management of String Resources Pin
Sin Jeong-hun1-Jul-03 7:46
Sin Jeong-hun1-Jul-03 7:46 

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.