|
They show two small snippets which I've tried using the same types but still it won't really do anything. For example, I set their values to totally useless settings but the OCX reported the connection was successful but the connection status method said it wasn't connected. I believe the latter because asking the device for some information returns false. That's why I was wondering about the legality of the data types I've tried using. I'd like to think that because they show some sample code that it must have worked sometime when they were testing and documenting it. Then again, they might have dropped in something that looks like it might have worked but possibly never did. Yes, the data types do look like standard VB6 vanilla types.
My other approach is to go back to VS and write the protocol (try to) using pure protocol as it were in a TCP/IP socket. As I mentioned though, they don't tell you what to do with the encryption which is something I believe the OCX implements under-the-hood. I'm home now and I've managed to configure my Win7 on my iMac so I can at least ping the device. I don't know enough about Wireshark to see if it's possible to capture just the IP address I'm using instead of everything else under the sun!
I'm sure I'll get there eventually but without access to a Siemens contact or a support group specialising in this device it's going to be a long weekend!
If there is one thing more dangerous than getting between a bear and her cubs it's getting between my wife and her chocolate.
|
|
|
|
|
As Dave said, the Interop is easier from .NET; I'll agree on that with him.
Give http://www.pinvoker.com/[^] a test-run, together with VB.NET.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
LPCTSTR is only relevant in the source code of a C/C++ program. It equates to either LPCWSTR or LPCSTR depending on whether UNICODE is defined or not (set in the General tab of project properties). So you need to contact the originators of the code to find out whether they built it for Unicode or not.
Use the best guess
|
|
|
|
|
Richard, I spent a long time on the phone to Siemens in the UK. After many attempts I managed to home in on a building that knows what I want to do but not being involved in SDKs the best they could say is they'll pass my details to an SDK group in Germany. So, you can see the problem dealing with a huge company where people have heard but don't know who from or where to go. The SDK provides a DLL which they say can only be used in C++. The OCX is intended for everything else. Unfortunately, it's a poorly documented manual. I mean it's good that they describe the protocol but there are too many loose ends of which the method declarations is but one.
Another thing I don't know is do I need to append a \0 to the strings or does VB6 do that automatically? To make it even more frustrating, I've looked at just about every online reference to BAPSI (Siemens' protocol) and I can't find a single documented sample program which might help. So, I might be guilty of passing in parameters which are not compatible and which the device can only throw away as unusable/unrecognisable.
If there is one thing more dangerous than getting between a bear and her cubs it's getting between my wife and her chocolate.
|
|
|
|
|
That really is very poor from their side. The only other suggestions I can offer are to look at Dependency Walker[^], a tool for showing all the public elements of a DLL, and this MSDN page[^] on decorated names. These two together may be able to help you figure out what the actual SDK calls should be.
Use the best guess
|
|
|
|
|
Internally, VB6 uses BSTR to represent a string. This is a structure consisting of:
1) an integer denoting string length without the terminating character,
2) the Unicode string data (usually 2 bytes per character),
3) a termination code, which is 2 bytes of 00.
As far as what a LPCTSTR is, well, it depends on how the original C code was compiled. If the compile-time constant UNICODE was defined, LPCTSTR maps to the LPCWSTR type, otherwide, it maps to LPCSTR.
LPCTSTR means a Long Pointer to a Constant TCHAR String.
TCHAR is another stringe little bugger that maps to either wchar_t (UNICODE) or char (ANSI) depending on if UNICODE is defined or not.
Oh screw it. It's a huge pile of crap to understand. Just read this[^].
By the way, it's actually EASIER to do Interop from C#/VB.NET than it is from VB6 because you have FAR greater control over how things get marshaled back and forth.
|
|
|
|
|
Thanks Dave. I'll read the link you provided.
If there is one thing more dangerous than getting between a bear and her cubs it's getting between my wife and her chocolate.
|
|
|
|
|
I am trying to write into registry using the command
RegKey = Registry.CurrentUser.CreateSubKey("Software\\macson")
Now when I run the program only then it correctly writes into the HKEY_CURRENT_USER\\MICROSOFT\\SOFTWARE. But when I include this program as an assembly in the setup it writes into the HKEY_USERS with no entry in HKEY_CURRENT_USER. Now my problem is that the program which is supposed to access the registry data is programmed to read from HKEY_CURRENT_USER using the command
MyRegKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\macson", True)
Though I have idea that HKEY_CURRENT_USER is a limited copy of HKEY_USERS but since the data is not available in current user my program is failing.
Can anybody help me out on how to solve this issue?
|
|
|
|
|
SPSandy wrote: But when I include this program as an assembly in the setup it writes into the HKEY_USERS with no entry in HKEY_CURRENT_USER.
A regular executable, or a Windows Service? What's the name of the user that the code is running under?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
A regular Executable. The user is the same as is logged in to windows. To be honest could not understand the second part. So sorry if the answer is not to the mark.
|
|
|
|
|
SPSandy wrote: To be honest could not understand the second part.
My bad, I wanted to know whose credentials/useraccount the application was running under; there's a Username[^] in the environment-class that you can use to log it when the application starts.
Did the setup run as a user or as an administrator?
SPSandy wrote: But when I include this program as an assembly in the setup it writes
Are you executing it from the installer (during installation)? Or is the regkey written when the app launches the first time?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Thanks a lot for your response. I have got the reason. Thanks for the tips. It is because though the user has administrative Privileges but still I think the Setup needs to be run as Administrator. Once I did this, it has now written inot HKEY_Current_User.
Thanks for the hint.
|
|
|
|
|
You're welcome
|
|
|
|
|
is there any body that have code of this algorithm in vb.net
it's be very good.
|
|
|
|
|
d3ad-d3vil wrote: is there any body that have code of this algorithm in vb.net If someone has that specialized algo, then there's little chance that they'll simply dump the code here. I suggest you go to wikipedia and try to implement it on your own.
FWIW, the only string-search algo that I translated was "Boyer Moore". It has some example-implementations that you can Google for, might be an alternative to your problem.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
|
I need to receive message WM_COPYDATA in VB application for Windows CE. How to do it in System.Windows.Forms.Form?
|
|
|
|
|
Hi,
Try to override the WndProc method:
Protected Overrides Sub WndProc(ByRef m As Message)
If m.Msg = &H4a Then
Else
MyBase.WndProc(m)
End If
End Sub
Hope this helps.
The quick red ProgramFOX jumps right over the Lazy<Dog> .
|
|
|
|
|
Yes, when I try something like this I get an error:
Error 2 'WndProc' is not a member of 'System.Windows.Forms.Form'. C:\Program Files\Measurement Computing\DAQFlex for Windows CE\Examples\VB\AOut\AOutForm.Common.vb 18 13 AOut
What to do?
|
|
|
|
|
I think you get the error because you use Windows CE. Have a look at this WndProc method for Windows CE:
MessageWindow.WndProc Method[^]
Hope this helps.
The quick red ProgramFOX jumps right over the Lazy<Dog> .
|
|
|
|
|
It does not work, because my class is inherited form System.Windows.Forms.Form. The class cannot recognize WndProc.
|
|
|
|
|
|
I am doing a project, the VB program running in PC, reading data from a device, I use a timer control to read the data, in 200 ms interval.
Then I need to store the data to a text file, each set of data with a timestamp, which be used to check when the data be acuqired.
Now I use DateTime.Now property as timestamp, but I found the interval between two timestamp is not equal to 200ms, it's much bigger than 200ms, about 500-700ms.
I wonder if the Now property is not precise, or the VB program consume some time to do other things, then the VB program is not able to handle the reading task on time requirement.
modified 11-Apr-13 16:05pm.
|
|
|
|
|
Your program isnt the only one running, so you cant know when exactly youll get the thread proccessed. And the time could vary from comuter to computer, however you can give it a higher priority, but than you'll get other problems...
The easiest thing is to get the time stamp from the physical device, if it is that important.
modified 11-Apr-13 15:46pm.
|
|
|
|