PC Review


Reply
Thread Tools Rate Thread

How can translate this in vb.net?

 
 
Antonio C
Guest
Posts: n/a
 
      27th Nov 2003
BOOL SipGetInfo(SIPINFO* pSipInfo);

typedef struct{
DWORD cbSize;
DWORD fdwFlags;
RECT rcVisibleDesktop;
RECT rcSipRect;
DWORD dwImDataSize;
VOID* pvImData;
} SIPINFO;

I've tried int this way but don't work:

<System.Runtime.InteropServices.DllImport("coredll.dll")>
Private Shared Function SipGetInfo(ByVal si As SIPINFO) As
Boolean
End Function

Private Structure SIPINFO
Public cbSize As Int32
Public fdwFlags As Int32
Public rcVisibleDesktop As RECT
Public rcSipRect As RECT
Public dwImDataSize As Int32
Public pvImData As Int32
End Structure

Private Structure RECT
Public left As Int32
Public top As Int32
Public right As Int32
Public Bottom As Int32
End Structure

Can anyone help me?
 
Reply With Quote
 
 
 
 
Alex Feinman [MVP]
Guest
Posts: n/a
 
      27th Nov 2003
It should work if you change the function definition to use SIPINFO byRef or
make it a class instead of a structure

"Antonio C" <(E-Mail Removed)> wrote in message
news:098e01c3b4f4$f067f2f0$(E-Mail Removed)...
> BOOL SipGetInfo(SIPINFO* pSipInfo);
>
> typedef struct{
> DWORD cbSize;
> DWORD fdwFlags;
> RECT rcVisibleDesktop;
> RECT rcSipRect;
> DWORD dwImDataSize;
> VOID* pvImData;
> } SIPINFO;
>
> I've tried int this way but don't work:
>
> <System.Runtime.InteropServices.DllImport("coredll.dll")>
> Private Shared Function SipGetInfo(ByVal si As SIPINFO) As
> Boolean
> End Function
>
> Private Structure SIPINFO
> Public cbSize As Int32
> Public fdwFlags As Int32
> Public rcVisibleDesktop As RECT
> Public rcSipRect As RECT
> Public dwImDataSize As Int32
> Public pvImData As Int32
> End Structure
>
> Private Structure RECT
> Public left As Int32
> Public top As Int32
> Public right As Int32
> Public Bottom As Int32
> End Structure
>
> Can anyone help me?



 
Reply With Quote
 
Antonio C
Guest
Posts: n/a
 
      28th Nov 2003
Thank you Alex,
using byref now it doesn't give me error but the
structure after the execution of the function remain
empty, the full code is this:
==================================================
Public Class Sip
<System.Runtime.InteropServices.DllImport
("coredll.dll")> Private Shared Function SipShowIM(ByVal i
As SIPStatus) As Integer
End Function
<System.Runtime.InteropServices.DllImport
("coredll.dll")> Private Shared Function SipSetInfo(ByRef
si As SIPINFO) As Boolean
End Function
<System.Runtime.InteropServices.DllImport
("coredll.dll")> Private Shared Function SipGetInfo(ByRef
si As SIPINFO) As Boolean
End Function

Private Enum SIPStatus
SIPF_OFF = 0
SIPF_ON
End Enum
Private Structure SIPINFO
Public cbSize As Int32
Public fdwFlags As Int32
Public rcVisibleDesktop As RECT
Public rcSipRect As RECT
Public dwImDataSize As Int32
Public pvImData As Int32
End Structure

Private Structure RECT
Public left As Int32
Public top As Int32
Public right As Int32
Public bottom As Int32
End Structure


' Mostrar el SIP
Public Shared Sub Show()
SipShowIM(SIPStatus.SIPF_ON)
End Sub

' Ocultar el SIP
Public Shared Sub Hide()
SipShowIM(SIPStatus.SIPF_OFF)
End Sub

Public Shared Sub SetPosition(ByVal x as int32,ByVal y
as int32)
Dim mySi As New SIPINFO
SipGetInfo(mySi)
mySi.rcSipRect.left = 0
mySi.rcSipRect.top = 60
SipSetInfo(mySi)
End Sub

End Class
==================================================
I want to set the position of SIP through the SipGetInfo
(to get the current position) and SipSetInfo (to set the
new position) but, how I've told above the structure
SIPINFO remain empty after the SipGetInfo and if i set
manually the SIPINFO structure the SIP doesn't change
position.

Thank you all for attention.
Antonio.
 
Reply With Quote
 
Alex Feinman [MVP]
Guest
Posts: n/a
 
      1st Dec 2003
Perhaps you are forgetting to set cbSize to Marshal.SizeOf(GetType(SIPINFO))

"Antonio C" <(E-Mail Removed)> wrote in message
news:06a501c3b595$5e08b790$(E-Mail Removed)...
> Thank you Alex,
> using byref now it doesn't give me error but the
> structure after the execution of the function remain
> empty, the full code is this:
> ==================================================
> Public Class Sip
> <System.Runtime.InteropServices.DllImport
> ("coredll.dll")> Private Shared Function SipShowIM(ByVal i
> As SIPStatus) As Integer
> End Function
> <System.Runtime.InteropServices.DllImport
> ("coredll.dll")> Private Shared Function SipSetInfo(ByRef
> si As SIPINFO) As Boolean
> End Function
> <System.Runtime.InteropServices.DllImport
> ("coredll.dll")> Private Shared Function SipGetInfo(ByRef
> si As SIPINFO) As Boolean
> End Function
>
> Private Enum SIPStatus
> SIPF_OFF = 0
> SIPF_ON
> End Enum
> Private Structure SIPINFO
> Public cbSize As Int32
> Public fdwFlags As Int32
> Public rcVisibleDesktop As RECT
> Public rcSipRect As RECT
> Public dwImDataSize As Int32
> Public pvImData As Int32
> End Structure
>
> Private Structure RECT
> Public left As Int32
> Public top As Int32
> Public right As Int32
> Public bottom As Int32
> End Structure
>
>
> ' Mostrar el SIP
> Public Shared Sub Show()
> SipShowIM(SIPStatus.SIPF_ON)
> End Sub
>
> ' Ocultar el SIP
> Public Shared Sub Hide()
> SipShowIM(SIPStatus.SIPF_OFF)
> End Sub
>
> Public Shared Sub SetPosition(ByVal x as int32,ByVal y
> as int32)
> Dim mySi As New SIPINFO
> SipGetInfo(mySi)
> mySi.rcSipRect.left = 0
> mySi.rcSipRect.top = 60
> SipSetInfo(mySi)
> End Sub
>
> End Class
> ==================================================
> I want to set the position of SIP through the SipGetInfo
> (to get the current position) and SipSetInfo (to set the
> new position) but, how I've told above the structure
> SIPINFO remain empty after the SipGetInfo and if i set
> manually the SIPINFO structure the SIP doesn't change
> position.
>
> Thank you all for attention.
> Antonio.



 
Reply With Quote
 
Antonio C
Guest
Posts: n/a
 
      1st Dec 2003
I'm a noob in these kind of programming but you are GREAT
Alex!!!
Now all work very fine
So, because I've started to work on this class from a code
posted in this ng, I want to share with you this.
A SIP with a method to set the position.

Public Class Sip
<System.Runtime.InteropServices.DllImport
("coredll.dll")> Private Shared Function SipShowIM(ByVal i
As SIPStatus) As Integer
End Function
<System.Runtime.InteropServices.DllImport
("coredll.dll")> Private Shared Function SipSetInfo(ByRef
pSipInfo As SIPINFO) As Boolean
End Function
<System.Runtime.InteropServices.DllImport
("coredll.dll")> Private Shared Function SipGetInfo(ByRef
pSipInfo As SIPINFO) As Boolean
End Function

Private pvtVisible As Boolean = False
Private Enum SIPStatus
SIPF_OFF = 0
SIPF_ON
End Enum
Private Structure SIPINFO
Public cbSize As Int32
Public fdwFlags As Int32
Public rcVisibleDesktop As RECT
Public rcSipRect As RECT
Public dwImDataSize As Int32
Public pvImData As Int32
End Structure

Private Structure RECT
Public left As Int32
Public top As Int32
Public right As Int32
Public bottom As Int32
End Structure


' Mostrar el SIP
Public Shared Sub Show()
SipShowIM(SIPStatus.SIPF_ON)
End Sub

' Ocultar el SIP
Private Shared Sub Hide()
SipShowIM(SIPStatus.SIPF_OFF)
End Sub

Public Sub SetPosition(ByVal top As Int32)
Dim mySi As SIPINFO
Dim result As Boolean = True
mySi.cbSize =
System.Runtime.InteropServices.Marshal.SizeOf(GetType
(SIPINFO))
result = SipGetInfo(mySi)
mySi.rcSipRect.top = top
mySi.rcSipRect.bottom = top + 80
result = SipSetInfo(mySi)
End Sub

Public Property Visible() As Boolean
Get
Return pvtVisible
End Get
Set(ByVal Value As Boolean)
If Value = True Then
SipShowIM(SIPStatus.SIPF_ON)
Else
SipShowIM(SIPStatus.SIPF_OFF)
End If
pvtVisible = Value
End Set
End Property
End Class
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Please help translate the following =?Utf-8?B?QnJpYW4=?= Microsoft Excel Misc 4 17th Apr 2006 05:40 AM
Translate please =?Utf-8?B?RG91ZyBX?= Spyware Announcements 3 12th Nov 2005 08:15 PM
any one who can translate this vb.net to C# ? Kylin Microsoft ASP .NET 6 19th May 2005 04:10 PM
TRANSLATE from VB JoRo Microsoft C# .NET 2 9th Feb 2005 08:52 AM
translate this to VB? Luis E Valencia Microsoft ASP .NET 1 11th May 2004 09:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:15 AM.