PC Review


Reply
Thread Tools Rate Thread

can vb.net support WINAPI(_stadcall)?

 
 
jg
Guest
Posts: n/a
 
      30th Nov 2005
or would I have to use C# or C++?


 
Reply With Quote
 
 
 
 
Patrice
Guest
Posts: n/a
 
      30th Nov 2005
What have you tried ? See the Declare statement or the DllImport
attribute...

Patrice

--

"jg" <(E-Mail Removed)> a écrit dans le message de
news:(E-Mail Removed)...
> or would I have to use C# or C++?
>
>



 
Reply With Quote
 
jg
Guest
Posts: n/a
 
      30th Nov 2005
thank you for your prompt reply.


I should have mentioned that I want the .net dll to support WINAPI(stdcall)
by non managed client.

I did not think of dllimport. Nonetheless I will Google on ddlimport

I was running into a brick wall when it comes to exposing methods and
function with string and /or integer array to the unmanaged client when I
was using the COM interface. I tried a myriad of marshalas, pin, intptr,
varptr. Either I goofed big time or, I just did not get it.

I just found out the unmanaged client supports WINAPI(_stadcall) as well as
COM, OCX.

So I am looking at the possibility of using WINAPI(_stadcall) on my .net
class dll.

"Patrice" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> What have you tried ? See the Declare statement or the DllImport
> attribute...
>
> Patrice
>
> --
>
> "jg" <(E-Mail Removed)> a écrit dans le message de
> news:(E-Mail Removed)...
>> or would I have to use C# or C++?
>>
>>

>
>



 
Reply With Quote
 
Patrice
Guest
Posts: n/a
 
      30th Nov 2005
AFAIK both VB.NET and C# are unabled to "export" DLL functions as done by
the Windows API (they are able to use existing functions).
If you want to expose functions to COM I would still try to solve the
original problem. AFAIK .NET should likely default to exposing this as safe
arrays. You could post your original problme with the effects you have to
the interop group...

I thought first you wanted to consume Windows API functions (my
understanding is now that you want actually to expose functions to the
unmanaged world).

--
Patrice

"jg" <(E-Mail Removed)> a écrit dans le message de
news:%23z$(E-Mail Removed)...
> thank you for your prompt reply.
>
>
> I should have mentioned that I want the .net dll to support

WINAPI(stdcall)
> by non managed client.
>
> I did not think of dllimport. Nonetheless I will Google on ddlimport
>
> I was running into a brick wall when it comes to exposing methods and
> function with string and /or integer array to the unmanaged client when I
> was using the COM interface. I tried a myriad of marshalas, pin, intptr,
> varptr. Either I goofed big time or, I just did not get it.
>
> I just found out the unmanaged client supports WINAPI(_stadcall) as well

as
> COM, OCX.
>
> So I am looking at the possibility of using WINAPI(_stadcall) on my .net
> class dll.
>
> "Patrice" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > What have you tried ? See the Declare statement or the DllImport
> > attribute...
> >
> > Patrice
> >
> > --
> >
> > "jg" <(E-Mail Removed)> a écrit dans le message de
> > news:(E-Mail Removed)...
> >> or would I have to use C# or C++?
> >>
> >>

> >
> >

>
>



 
Reply With Quote
 
m.posseth
Guest
Posts: n/a
 
      30th Nov 2005

COM is the way to go if you want to expose a .Net assembly`s methods to the
unmanaged world


regards

Michel


"jg" <(E-Mail Removed)> wrote in message
news:%23z$(E-Mail Removed)...
> thank you for your prompt reply.
>
>
> I should have mentioned that I want the .net dll to support
> WINAPI(stdcall) by non managed client.
>
> I did not think of dllimport. Nonetheless I will Google on ddlimport
>
> I was running into a brick wall when it comes to exposing methods and
> function with string and /or integer array to the unmanaged client when I
> was using the COM interface. I tried a myriad of marshalas, pin, intptr,
> varptr. Either I goofed big time or, I just did not get it.
>
> I just found out the unmanaged client supports WINAPI(_stadcall) as well
> as COM, OCX.
>
> So I am looking at the possibility of using WINAPI(_stadcall) on my .net
> class dll.
>
> "Patrice" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> What have you tried ? See the Declare statement or the DllImport
>> attribute...
>>
>> Patrice
>>
>> --
>>
>> "jg" <(E-Mail Removed)> a écrit dans le message de
>> news:(E-Mail Removed)...
>>> or would I have to use C# or C++?
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
jg
Guest
Posts: n/a
 
      30th Nov 2005
There seem to be a lot more documentation and sample of .net consuming
WINAPI(_stadcall) than the other way. I look more so for arrays

That is why I am tempted to look into WINAPI(_stadcall) when I do have some
control over the unmanaged application. I could get the developer to
partition the unmanaged application into two DLLs: data processing and
analytical presentation, let the .net not handle menu, the internet explorer
navigation, parsing.


"m.posseth" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> COM is the way to go if you want to expose a .Net assembly`s methods to
> the unmanaged world
>
>
> regards
>
> Michel
>
>
> "jg" <(E-Mail Removed)> wrote in message
> news:%23z$(E-Mail Removed)...
>> thank you for your prompt reply.
>>
>>
>> I should have mentioned that I want the .net dll to support
>> WINAPI(stdcall) by non managed client.
>>
>> I did not think of dllimport. Nonetheless I will Google on ddlimport
>>
>> I was running into a brick wall when it comes to exposing methods and
>> function with string and /or integer array to the unmanaged client when I
>> was using the COM interface. I tried a myriad of marshalas, pin, intptr,
>> varptr. Either I goofed big time or, I just did not get it.
>>
>> I just found out the unmanaged client supports WINAPI(_stadcall) as well
>> as COM, OCX.
>>
>> So I am looking at the possibility of using WINAPI(_stadcall) on my .net
>> class dll.
>>
>> "Patrice" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> What have you tried ? See the Declare statement or the DllImport
>>> attribute...
>>>
>>> Patrice
>>>
>>> --
>>>
>>> "jg" <(E-Mail Removed)> a écrit dans le message de
>>> news:(E-Mail Removed)...
>>>> or would I have to use C# or C++?
>>>>
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
jg
Guest
Posts: n/a
 
      1st Dec 2005
just for those who have to deal with legacy application that supports COM,
OCX, and WINAPI(_stadcall),
I worked out the COM interface fro function out array parametns.


For example
' Caller proto:
' Int32 lSz, lsz2
' String lstrOut[]
' Int32 lPos[]
' lSz = objClass.Parse(sIn, ref lsz2, ref lstrOut, ref lPos)
' the result lsz2 and lSz are same of course due to adj made here

Public Function Parse(ByVal sIn As String, <Out()> ByRef iCnt As Integer, _

<Out()> <MarshalAs(UnmanagedType.LPArray, ArraySubType:=UnmanagedType.LPStr,
SizeParamIndex:=1)> ByRef sOut As String(), _

<Out()> <MarshalAs(UnmanagedType.LPArray, ArraySubType:=UnmanagedType.LPStr,
SizeParamIndex:=1)> ByRef lPos As Integer()) As Integer

sOut = Split(sIn, vbTab)

Dim sdebugMsg As String = "0, >>", s As String

Dim i As Integer = 0

iCnt = 0

iCnt = sOut.GetUpperBound(0)

Dim pos(iCnt) As Integer

If iCnt > 0 Then

pos(0) = 1

i = 1

For Each s In sOut

sdebugMsg &= s

If i < iCnt Then

pos(i) = s.Length + 1

sdebugMsg &= vbCrLf & pos(i) & vbTab

End If

Next

lPos = pos

iCnt += 1

Else

End If

' MsgBox("sOut.GetUpperBound()=" & sOut.GetUpperBound(0) & vbCrLf & "values
are" & vbCrLf & sdebugMsg, MsgBoxStyle.OKOnly, "IeStringClass.Parse")

'MsgBox(sOut)

Return iCnt

End Function




 
Reply With Quote
 
jg
Guest
Posts: n/a
 
      3rd Jan 2006
I just found the form handle event by itself in the class will let me
initialize but I still get object problem that I will post on another thread

"m.posseth" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> COM is the way to go if you want to expose a .Net assembly`s methods to
> the unmanaged world
>
>
> regards
>
> Michel
>
>
> "jg" <(E-Mail Removed)> wrote in message
> news:%23z$(E-Mail Removed)...
>> thank you for your prompt reply.
>>
>>
>> I should have mentioned that I want the .net dll to support
>> WINAPI(stdcall) by non managed client.
>>
>> I did not think of dllimport. Nonetheless I will Google on ddlimport
>>
>> I was running into a brick wall when it comes to exposing methods and
>> function with string and /or integer array to the unmanaged client when I
>> was using the COM interface. I tried a myriad of marshalas, pin, intptr,
>> varptr. Either I goofed big time or, I just did not get it.
>>
>> I just found out the unmanaged client supports WINAPI(_stadcall) as well
>> as COM, OCX.
>>
>> So I am looking at the possibility of using WINAPI(_stadcall) on my .net
>> class dll.
>>
>> "Patrice" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> What have you tried ? See the Declare statement or the DllImport
>>> attribute...
>>>
>>> Patrice
>>>
>>> --
>>>
>>> "jg" <(E-Mail Removed)> a écrit dans le message de
>>> news:(E-Mail Removed)...
>>>> or would I have to use C# or C++?
>>>>
>>>>
>>>
>>>

>>
>>

>
>



 
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
can vb.net support WINAPI(_stadcall)? jg Microsoft VB .NET 7 3rd Jan 2006 09:27 PM
FYI: marshAs Attribute etc for function to pass arrays by ref to COM caller that supports WINAPI(_stadcall) jg Microsoft VB .NET 0 1st Dec 2005 05:59 PM
WinAPI - LogonUser() =?Utf-8?B?RFZQLURC?= Microsoft Windows 2000 Developer 0 12th May 2005 03:22 PM
Need to call a C# DLL from WINAPI DLL John Hann Microsoft C# .NET 1 21st Aug 2004 04:18 PM
WINAPI CALL Qindong Zhang Microsoft C# .NET 1 7th Jan 2004 04:15 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:28 PM.