|
Your question was actually a good one. It's just that first answer you got what a " " moment.
If the question is good and the poster has added enough detail to prove some research effort, I don't have a problem with answering those "basic" questions at all. It's the ones who don't know how to, or don't want to, do any research that really irks me. Then to have someone follow up with a wild, off-the-wall, totally stupid and unresearched answer like that ... wow. It doesn't do anyone any good if the answer is just a wild guess.
|
|
|
|
|
The question -
"Is it possible to create and instantiate a VB6 .dll in VB .Net without having a reference to the VB6 .dll? I tried to use the Assembly.LoadFrom method, which doesn't seem to work (and probably isn't intended for ActiveX .dlls). "
My answer -
"Can you just create an assembly with the name VB6.dll?"
Perhaps I should have said...
"Yes. Create a .NET assembly called VB6.dll and use that if you need an instance of the assembly by that name."
He never said he needed the functionality of the VB6.dll (why would he even want it?), and the question was so odd that I could not help myself with a minimalist effort and a bit of infamous NJ sarcasm.
So... now you can get the hell off me. Just because I don't have the MicrosoftsValuablePenis award in my sig doesn't mean I am any less capable or competent than any of you.
|
|
|
|
|
astanton1978 wrote: He never said he needed the functionality of the VB6.dll (why would he even want it?), and the question was so odd that I could not help myself with a minimalist effort and a bit of infamous NJ sarcasm.
Not sure I am following you.......why wouldn't you want to use custom working .dlls (even if they were not created solely in .Net)? We have several large custom .dlls and others that we rely on which control manufacturing devices; so converting everything at once is not viable. Normally, we would add a reference and use it like normal.
We have a 'object checker' utility (created in vb6) which basically just uses CreateObject and attempts to instantiate an object for each .dll used by any one of our apps (helps figure out possible registration or missing files on the clients). Since there is interop going on, I modified this app to test all .Net and VB6 interop .dlls.... so I just need to be able to create an obj variable for each type of .dll without having any actual references.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
astanton1978 wrote: He never said he needed the functionality of the VB6.dll (why would he even want it?), and the question was so odd
His question was perfectly understandable. It's your answer that threw me for loop. And you still persist with the "VB6.dll" name, when that wasn't even part of the question. The name of the assembly doesn't matter.
astanton1978 wrote: So... now you can get the hell off me. Just because I don't have the MicrosoftsValuablePenis award in my sig doesn't mean I am any less capable or competent than any of you.
All you had to do was ask for clarification of what his intent was. Now, this remark, ... really??
|
|
|
|
|
Look at the question. "How to create a VB6 .dll object without having the .dll added as a reference?"
That remark was just for you , since you decided to rip on me for reading his question differently.
|
|
|
|
|
Note the space between VB6 and .DLL. Allow me to rephrase:
How to [instantiate] an object [from a class] in a .DLL created with VB6.
|
|
|
|
|
Howabout that. See, now that makes perfect sense.
You are hereby nominated as official question translator for literal readers.
|
|
|
|
|
It's possible using Reflection, but I highly recommend against it. Since you'll have no early binding, just writing the code will consists of constantly using Reflection to discover and call all the methods in the thing. You also lose all type checking at compile and runtime, and no Intellisense while in the IDE. A nightmare to say the least.
As for actually instantiating a COM-based object, you can do something like this:
Dim comType As Type = Type.GetTypeFromProgID("Scripting.FileSystemObject")
Dim comObject As Object = Activator.CreateInstance(comType)
This does not work unless the .DLL is regsitered properly. You cannot load it directly from the .DLL.
|
|
|
|
|
That's exactly what I was looking for Dave and your warning is duly noted.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
I have been trying unsuccessfully to get serialization to work over a network stream. I can get serialization to work when using a Filestream, so I think this means I am doing the serialization/deserialization part correct. I have gone so far as to just serialize a 16 bit integer, and still I get the IO Exception on deserialization:
End of Stream encountered before parsing was completed.
I have checked the lengths of the Filestream and the Networkstream and they both are identical. I have printed byte by byte the data sent through the Networkstream, and the data Recieved from the client Networkstream. Here are examples of how I serialize then send, and read data and then deserialize.
**************************Send Code*************************************************
Dim Test As Int16 = 88
'This Is Just A Compare For The FileStream To The Networkstream, and servers no other puprose
Dim DataFile As New System.IO.FileStream("c:\del1.bin", System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.None)
Serializer.Serialize(DataFile, Test)
DataFile.Close()
'Note The Length Of The DataFile Stream Is 52
Dim memStream As New System.IO.MemoryStream()
Serializer.Serialize(memStream, Test)
Dim buffer As Byte() = memStream.GetBuffer()
Debug.Print("Send Length = " + memStream.Length.ToString)
'Displays: Send Length = 52
Dim tt As String = ""
For i As Int16 = 0 To memStream.Length - 1
tt = tt + buffer(i).ToString + ","
Next
Debug.Print(tt)
'Displays: 0,1,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,4,1,0,0,0,12,83,121,115,116,101,109,46,73,110,116,49,54,1,0,0,0,7,109,95,118,97,108,117,101,0,7,88,0,11,
********************************************END SEND CODE**********************************************************************
********************************************Begin Receive Code*****************************************************************
Dim TCPClientsBytes(aryClients(intIndex).ReceiveBufferSize) As Byte
If aryClients(intIndex).GetStream.CanRead = True Then
intBytesRead = aryClients(intIndex).GetStream.Read(TCPClientsBytes, 0, CInt(aryClients(intIndex).ReceiveBufferSize))
End If
Dim Data As Int16 = 0
Dim Deserializer As New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
Dim mem As New System.IO.MemoryStream
mem.Write(TCPClientsBytes, 0, returndata.Length.ToString)
Debug.Print("Receive Length = " + mem.Length.ToString)
'Displays: Receive Length = 52
Dim tt As String = ""
For i As Int16 = 0 To mem.Length - 1
tt = tt + TCPClientsBytes(i).ToString + ","
Next
Debug.Print(tt)
'Displays: 0,1,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,4,1,0,0,0,12,83,121,115,116,101,109,46,73,110,116,49,54,1,0,0,0,7,109,95,118,97,108,117,101,0,7,88,0,11,
Try
'The statement below will throw an exception.....
Data = CType(Deserializer.Deserialize(mem), Int16)
Catch ex As Exception
Debug.Print(ex.Message)
'The exception text is below......
'A first chance exception of type 'System.Runtime.Serialization.SerializationException' occurred in mscorlib.dll
'End of Stream encountered before parsing was completed.
End Try
********************************************EndReceive Code*****************************************************************
Any help would be greatly appreciated!!!!!
|
|
|
|
|
|
Hello all
I need help to count node and their respective id.
<People>
<Person ID="001"> 1 </Person>
<Person ID="002"> 2 </Person>
</People>
how can i count person node..?? and Person Id = 001 & 002
Thanx in advance..
Shazz here to help you...
|
|
|
|
|
Assuming that People is the root of the document, you can iterate the nodes like this.
- Assumes the ID's are integers, you can change it to String if you want.
- written without syntax checking. Sorry if its a bit off, but you can get the idea.
Imports System.Xml
Private Sub CountNodes(xmlDoc as XmlDocument)
Dim xNode as XmlNode
Dim nodeName as String
Dim nodeCount as Integer
Dim listOfIDs as New List(Of Integer)
For Each xNode in xmlDoc.DocumentElement.ChildNodes
If String.IsNullOrEmpty(xNode.Name) = False Then
nodeName = xNode.Name.Trim().ToLower()
If nodeName = "person" Then
nodeCount++
If node.Attributes("ID") IsNot Nothing Then
listOfIDs.Add(Convert.ToInt32(node.GetAttributeValue("ID")))
End If 'node attr
End If 'node name
End If 'node has name
Next 'xNode
End Sub
You can also use Xpath Query to do the same, or if the nodes can be nested you will need a recursive function.
|
|
|
|
|
Thanx for your refernce code.
Partially its working fine though I am using VB6.0 application and your mention code belong to vb.net.
I am slight confuse for declaration of `Node` because non of IXMLDom related datatype have properties of GetAtttributeValues("ID").
Please guide me how can I proceed. I had search and i tried many things help.
Refernece as I had used "Microsoft XML v6.0"
Thanx in advance. Awaiting for your reply.
Shazz here to help you...
|
|
|
|
|
Sorry, I no longer have VB6 available to help you with this exactly.
The GetAttributeValues() method will get the value of an XMLNode (element)'s attribute. I cant find any IXMLDom documentation to look for a similar function, but if you can post a link I can try to find it.
|
|
|
|
|
Hello guys!!!!
I want more information about API call any articles and notes is there plzz send that link.
Ananda
|
|
|
|
|
This is a non question. Did you just read the term 'API' on the toilet ? WPF has an API, ADO.NET has an API, GDI+ has an API. What the hell are you trying to ask ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
no actual i want create an API for chart. but I don't know to do so I want API. Already one chart control in vb.net but it is not suitable for my application and i tried some 3rd party chart tool but i can't get suitable control i want to know abt API control. and some of other customize control also need so i need some article or note etc... plzzz send the link..
|
|
|
|
|
non-bugging Errors wrote: i want create an API for chart
Wow - one has wonder how you think your question to do this would be helped by answers to the question you asked.
non-bugging Errors wrote: i want to know abt API control. and some of other customize control also need so i need some article or note etc... plzzz send the link..
I'll be honest. None of this makes any sort of sense. Certainly your first question was useless. There's tons of charting controls out there, there's nothing built in, although I think MS are giving away a charting library nowadays, you'll need to search to find out if this is so.
I recommend you read one of the many articles on how to ask reasonable questions because I guarentee you, no-one stood any chance of knowing what you wanted from your first question.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Christian Graus wrote: Wow - one has wonder how you think your question to do this would be helped by answers to the question you asked.
C isn't that hard: void (*(*f[])())() defines f as an array of unspecified size, of pointers to functions that return pointers to functions that return void
"Always program as if the person who will be maintaining your program is a violent psychopath that knows where you live." - Martin Golding
|
|
|
|
|
I'm saying that he asked his first question, and his first question didn't contain ANY info that related to what he actually wanted to do, as shown in his response. So, if people had just answered his OP, no way he'd have got any help, b/c he didn't actually ask about what he wanted to know.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Don't know why you got voted down. Your response was reasonable considering the vagueness of the OP's request.
|
|
|
|
|
I guess because I didn't provide code to copy and paste ? :P
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi,
this link[^] explains API and provides some examples.
|
|
|
|
|
Hello,
I am struggling with API calls from VB.net. Basically, it is fine but a problem occurs when I try to call API which needs arrays to be passed.
API specification:
Public Declare Function spssGetVarNValueLabels Lib "spssio32.dll" Alias "spssGetVarNValueLabels@20" (ByVal handle As Integer, ByVal varName As String, ByRef values() As Double, ByVal labels() As String, ByRef numofLabels As Integer) As Integer
VB.NET call:
Dim handle As Integer = 0
Dim varname As String = "subject"
Dim numvallabs As Integer
Dim values(10) As Double
Dim labels(10) As String
erro = spssGetVarNValueLabels(handle, varname, values, labels, numvallabs)
No problems: handle, varname, numvallabs. In addition, I get correct value via "numvallabs".
But routine should return two arrays via values (double) and labels (string) and this is the problem. I have tried other similar API calls (integers or strings only) and everything was fine. But arrays are pain.
Since I read some topics how bridge the differences between C and VB, I have also tried to replace string variable for byte() or pass only the first element of array - but nothing helped. Current version return first element of doubled-array and nothing for string-array.
Full working code is enclosed: http://dev.zizkovi.name/anxiety.zip
Many thanks for any help in advance.
Petr
P.S. Background info: sav file is binary file used by SPSS Application. This DLL library is designated to read those files, etc.
Here is the sample code of mentioned call in C++ - published by vendor of used API:
#include <stdio.h>
#include "spssdio.h"
void func()
{
int fH;
int error;
int numL;
double *nValuesL;
char **labelsL;
...
error = spssOpenRead("bank.sav", &fH);
...
error = spssGetVarNValueLabels(fH, "SEX",
&nValuesL, &labelsL, &numL);
if (error == SPSS_OK)
{
int i;
printf("Value labels for SEX\n");
for (i = 0; i < numL; ++i)
{
printf("Value: %g, Label: %s\n", valuesL[i], labelsL[i]);
}
spssFreeVarNValueLabels(nValuesL, labelsL, numL);
}
}</stdio.h>
|
|
|
|
|