Jump to content
Xtreme .Net Talk

Question about converting int from C#


Recommended Posts

Guest Deleted member 22320
Posted

i am trying to convert a snippet of code i found but it has a ton of errors after converting. I thing i can probably go thru and fxi most of them just by comparison but theres one but i dont understand.

 

When I convert this C# line:

private const int WM_GRAPHNOTIFY	= 0x00008001;
private const int WS_CHILD		= 0x40000000;
private const int WS_CLIPCHILDREN	= 0x02000000;
private const int WS_CLIPSIBLINGS	= 0x04000000;

 

I get this and it doesnt like it:

 Private const  WM_GRAPHNOTIFY as Integer = 0x00008001  
 Private const  WS_CHILD as Integer = 0x40000000 
 Private const  WS_CLIPCHILDREN as Integer = 0x02000000
 Private const  WS_CLIPSIBLINGS as Integer = 0x04000000

 

I know really next to nothing about C, so some of this confuses me.

Guest Deleted member 22320
Posted

Ok i think i got this sorted. But I'm still curious for anyone who knows....

 

The converter i used had a hard time converting some of the IF statments.. i'm guessing because the person used operators such as |, ||, and &&

 

I have no idea what these mean, but looking at the context they were in and at the same time just trying to make the errors go away i converted them to this

 

| into AND

|| into OR

and && also into AND

 

Am i anywhere near correct?

 

 

 

Oh, and as for the aforementioned question, heres what I tried(and I guess it works, havent seen any real bugs yet)

 

I can the C# project that had all the HEX crap, like the 0x04whatever, and then broke into debugging and hovered the mouse over it and it gave me a (large) integer value. I then loaded up trusty CALC and converted it to HEX.

 

then I set the number = &H(result)

 

again, is this correct?

 

After all this mucking in c# (and not knowing my from a hole in the ground) by brain's about to reboot.

  • *Gurus*
Posted

Yes, constants defined as 0xvalue in C are equivalent to &Hvalue in VB.

 

| is a bitwise OR operator in C, used to combine values. The VB equivalent is Or.

|| is a logical operator, the VB equivalent is also Or (behaviour depends on context)

&& is logical And in both.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Guest Deleted member 22320
Posted
Cool, thanx divil. I'm slowly learning. found this nice converter and since this one actually converts stuff (hehe) i can figure it out for the most part.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...