davideciarm
New member
- Joined
- Dec 13, 2009
- Messages
- 1
- Programming Experience
- 5-10
Hi at all! I have an project in C# that i'm converting to VB net....but i dont know how i can convert thas part of code!
who can help me? i don't know how can convert the part "fixed" (fixed ( TBBUTTON* pTBButton = & tbButton )) and the puntator (new IntPtr( & dwBytesRead )
. TBBUTTON is an structure.
thanks very much!
thanks very much!
VB.NET:
// TBButton
fixed ( TBBUTTON* pTBButton = & tbButton )
{
IntPtr ipTBButton = new IntPtr( pTBButton );
int b = ( int ) User32.SendMessage( hToolbar, TB.GETBUTTON, ( IntPtr ) i, ipRemoteBuffer );
if ( b == 0 ) { Debug.Assert( false ); return false; }
// this is fixed
Int32 dwBytesRead = 0;
IntPtr ipBytesRead = new IntPtr( & dwBytesRead );
bool b2 = Kernel32.ReadProcessMemory(
hProcess,
ipRemoteBuffer,
ipTBButton,
new UIntPtr( ( uint ) sizeof( TBBUTTON ) ),
ipBytesRead );
if ( ! b2 ) { Debug.Assert( false ); return false; }
}
VB.NET:
[ StructLayout( LayoutKind.Sequential ) ]
internal struct TBBUTTON
{
public Int32 iBitmap;
public Int32 idCommand;
public byte fsState;
public byte fsStyle;
public byte bReserved1;
public byte bReserved2;
public UInt32 dwData;
public IntPtr iString;
};