Click here to Skip to main content
15,887,965 members
Home / Discussions / C#
   

C#

 
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 
Generalmanaged compiler question Pin
LongRange.Shooter1-Jul-03 6:02
LongRange.Shooter1-Jul-03 6:02 
GeneralRe: managed compiler question Pin
leppie1-Jul-03 11:58
leppie1-Jul-03 11:58 
GeneralRe: managed compiler question Pin
LongRange.Shooter2-Jul-03 3:57
LongRange.Shooter2-Jul-03 3:57 
GeneralRe: managed compiler question Pin
leppie2-Jul-03 7:40
leppie2-Jul-03 7:40 
GeneralTemplatePrinte source code Pin
nahumtakum1-Jul-03 4:07
nahumtakum1-Jul-03 4:07 
GeneralNeed help with service depencies Pin
Stas1-Jul-03 3:50
Stas1-Jul-03 3:50 
GeneralRe: Need help with service depencies Pin
Valeria Bogdevich1-Jul-03 4:57
Valeria Bogdevich1-Jul-03 4:57 
GeneralLaunching script on build Pin
AJ1231-Jul-03 3:35
AJ1231-Jul-03 3:35 
GeneralRe: Launching script on build Pin
Nathan Blomquist1-Jul-03 5:56
Nathan Blomquist1-Jul-03 5:56 
GeneralRe: Launching script on build Pin
AJ1231-Jul-03 7:07
AJ1231-Jul-03 7:07 
GeneralRe: Launching script on build Pin
Nathan Blomquist2-Jul-03 1:51
Nathan Blomquist2-Jul-03 1:51 
GeneralStatic Question Pin
CyberKewl1-Jul-03 3:02
CyberKewl1-Jul-03 3:02 
GeneralRe: Static Question Pin
Roland Bär1-Jul-03 4:58
Roland Bär1-Jul-03 4:58 
Generalhelp!! Pin
jphuphilly1-Jul-03 2:41
jphuphilly1-Jul-03 2:41 

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.