|
You still can process the output of webrequest or httpwebrequest with webbrowser control using WebBrowser.DocumentStream property ... so for test purposes make the request with a webrequest and redirect the incoming stream to documentstream property.
Additionally ServicePointManager serves for managed code usage, while webbrowser is a wrapper around the shdocwhatever.
|
|
|
|
|
The answer from sph3rex is an entirely valid one, however if you still want to do it using your hidden window I have a solution that will assist you. It is part of an article detailing various WebBrowser/Security 'tricks' that I have employed that I am currently writing up. It should be published here on Code Project shortly (i.e. in the next week) and I will notify you when it is ready.
BimJeam
|
|
|
|
|
I look forward to it. I'm sure it will help others. I'm experimenting with the DocumentStream property. So far it's been ok. Not getting what I wanted but still tweaking about. Thanks.
|
|
|
|
|
|
I'm trying to do the checksum calculations on data received via RS232, but the specification for the data doesn't explain the calculation algorith very in-depth. I tried researching the algorithm but my results always differ from the expected checksum.
Here is the spec's decription of the checksum calculation:
Sum modulo $FFFF of all characters from position two of the data and up to the last
character prior to the checksum identifier character. Value is a 4-byte hexadecimal number
preceded by space. Hex number is represented as a lowercase ASCII hex.
The reason it only starts at byte 2 is because byte 1 is the STX character.
This text file's[^] contents should easily calculate to the checksum (which is the last 4 bytes of the text). This text doesn't include the first byte (the STX) as it as already been stripped off by the handshaking.
(Sorry for using that crappy site for the file upload, my normal filesharing site is down today)
I'm using vb6 and would appreciate any help or pointer that could steer me in the right direction.
|
|
|
|
|
Let's see the checksum implementation you've got. It's really hard to come up with their implementation is they don't describe exactly how THEY interpreted "checksum".
|
|
|
|
|
This is what I have so far, still not getting the correct checksum:
Dim MsgToCalc As String
Dim DataBytes() As Byte
MsgToCalc = Left(msg, Len(msg) - 6) '6 Because the space and y character befor the checksum is also excluded
CheckSum = Right(msg, 4) '4 Because the checksum is 4 bytes long
'Create an array of DATABYTES for MsgToCalc
ReDim DataBytes(0 To Len(MsgToCalc) - 1)
DataBytes = StrConv(MsgToCalc, vbFromUnicode)
Dim Str16 As String
Dim Total As Long
Dim MyChecksum As Long
Dim SubTotal As Integer
Dim i As Integer
i = 0
' The following is an attempt to do the calculations at this link:
' http://www.cs.tut.fi/~dunaytse/wireshark-2306/lab2.pdf
' Still not sure why they get a negative checksum from 1's compliment
For i = 0 To (Len(MsgToCalc) - 1)
If i Mod 2 = 0 Then
Str16 = CStr(Hex$(DataBytes(i))) & CStr(Hex$(DataBytes(i + 1)))
SubTotal = Val("&H" & Right(Str16, 4))
Total = Total + SubTotal
Total = Val("&H" & Right(Hex$(Total), 4))
MyChecksum = 65535 - Total
End If
Next i
My calculated checksum is D3E8 and it's supposed to be 6676
I'm following THIS PAGE[^] for my calculations but I must be doing something wrong!
Regards
|
|
|
|
|
OK, this implementation, ummm, well, all the string handling makes this, probably, the most inefficient algorithm I've seen. Hex$() returns a string, so all the CStr's around them are redundant. On top of that, you're using the most convoluted method of string manipulation to do simple math with two bytes. All your string code is really doing this: SubTotal = Byte(0) * 256 + Byte(1) .
Now, the last line is removing a compounded total from 65535. Well, in most cases, that's going to be a negative number. That's something that doesn't exist in a checksum.
You REALLY have to know the implementation being used. If the manufacturer hasn't told you, you're just guessing. Since you don't know which algorithm to use, nor do you know how to implement one, I'd suggest using a library that supports a bunch of different algorithms and try each until you either find one that works, or find out which algorithm they're using. Try this library...[^]
|
|
|
|
|
Dave Kreskowiak wrote: the most inefficient algorithm I've seen
I don't really have any good excuses to cover for me here, I never really work with binary maths in VB6 so I guess I was just lazy.
But to find the algorithm I tried probably a 100 different combinations of which none of them is an exact hit. That little bit of text in the OP is the only info from the manufacturer and I'm guessing getting hold of them could be hard since the programnmers are probably in the USA and I'm in South Africa and this is a very old model of the instrument.
Dave Kreskowiak wrote: Now, the last line is removing a compounded total from 65535. Well, in most cases, that's going to be a negative number. That's something that doesn't exist in a checksum.
This was "my way" of doing a MOD FFFF on the total. I wanted to do it with Total MOD Val("&H" & "FFFF") method, but since VB6 assumes I'm using 1's compliment, it returns a negative number. Is there a better way to do that?
Thanks for the library, I'll give it a shot!
|
|
|
|
|
Chksum calculation depends on the data which is received from your rs232 port. first u have to know which type of checksum calculation id doing in the source(unit/hardware).
some standard hardwares/units follow the standard checksum calculation. line crc-8bit,16-bit..etc... (U will get more info. from GOOGLE.).
am sending a code from my project code , how to calc the crc-16bit checksum.
Public Function crcbits16(ByVal str As String)
Dim crc As UShort = &HFFFF
Dim ser_data
crc = &HFFFF
Dim i As Long, p As Long
i = str.Length
For p = 0 To i - 1
ser_data = str.Substring(p, 1)
crc = (crc >> 8) Or (crc << 8)
crc = crc Xor Asc(ser_data)
crc = crc Xor (crc And &HFF) >> 4
crc = crc Xor (crc << 8) << 4
crc = crc Xor ((crc And &HFF) << 4) << 1
Next
Return CRCFormat(Hex(crc))
End Function
--------------------------------
Public Function CRCFormat(ByVal mycrc As String)
If Len(mycrc) < 4 Then
mycrc = Replace(Space(4 - Len(mycrc)) & mycrc, " ", "0") '"0" & mycrc
End If
End Function
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
Thank you for responding.
Fatal Error wrote: crc = (crc >> 8) Or (crc << 8)
What does this code do? (I get the shift but not the "OR", Var = x or y )
How should I rewrite it to work in VB6?
|
|
|
|
|
This code for calculate the CRC-16bit CCIT checksum of the given data.
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
I want to open a programme (I created) from an email (sent with the programme)
Sending the email is no problem
Putting a link in it that starts the programme (and passes a few parameters) works but only if I select the programme the first time (after that it works without a problem)
The programme in question will be installed in the same directory on every pc.
At the moment I'm simply passing a link to the body of the mail (html mail)
Link:
'path to programme' ID=Search
(ID=search is the parameter passed)
Is there anyway to do this so that I don't have to select the programme the first time?
Google and a search here didn't turn up anything regarding this.
|
|
|
|
|
If I'm understanding you correctly, you could create a windows service which process incoming email.
You would then have the service fire off a couple different apps/processes depending on the content of the email.
Not that bad to do really.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Yes and no
The user (reciever) has to click the link
Basicly the mail is to notify the receiver that there is a new entry in the DB and the link tells my programme to do a search in the DB and display the results.
So I can't use an automatic handling of the mail
|
|
|
|
|
Tom deketelaere wrote: Is there anyway to do this so that I don't have to select the programme the first time
What do you mean by "select the program the first time"??
|
|
|
|
|
The very first mail that the user gets doesn't work.
After clicking on the link the user gets an openfiledialog where he then can select the exe (from my programme).
After he has done this once everything works and keeps working.
|
|
|
|
|
OpenFileDialog?? What does the HTML link look like??
|
|
|
|
|
its a hyperlink to an exe
link:
'c:\prog\progname\progname.exe' ID=Searchterm
(with the ' s)
So basiscly it has to start progname.exe and pass the parameter ID=searchterm
|
|
|
|
|
I was looking for the entire <A HREF><A> tag. Just remember to click the "Ignore HTML tags in this message" box before you click Post Message.
|
|
|
|
|
don't have it here at the moment (I'm home) I'll post it first thing tommorow morning
|
|
|
|
|
the entire link:
<a href="'c:\prog\JORODOCBEHEER\documentbeheer.exe' ID=eID Arena">Klik hier om het document te zien</a>
|
|
|
|
|
OK, at the very least, you have to change the command line string. I think you'll have to replace the double-quote marks in this string with that HTML-friendly counterparts. But, the command line (inside the HREF quotes) should look more like (no single quote marks):
"c:\prog\JORODOCBEHEER\documentbeheer.exe" "ID=eID Arena"
Unless your intent is to pass 2 parameters to the .exe instead of one. The double quotes marks tell the shell to treat everything inside them as a single entity. This is because spaces are treated as a delimiter. So, in your original code, you are passing two parameters to the .exe.
|
|
|
|
|
I'm a bit further (after alot of trial and error)
I'm able to start the programme (there still is a warning box but that's not important)
However I'm not able to pass any parameters
The code that writes the html tag (its vba integrated into outlook):
<pre>
url = "file:///" & progpath
body = "Klant: " & Niv1Keuze.Text & "<br/>"
If Len(Niv2Keuze.Text & "") <> 0 Then body = body & "Niveau 2: " & Niv2Keuze.Text & "<br/>"
If Len(Niv3Keuze.Text & "") <> 0 Then body = body & "Niveau 3: " & Niv3Keuze.Text & "<br/>"
If Len(Niv4Keuze.Text & "") <> 0 Then body = body & "Niveau 4: " & Niv4Keuze.Text & "<br/>"
If Len(Niv5Keuze.Text & "") <> 0 Then body = body & "Niveau 5: " & Niv5Keuze.Text & "<br/>"
body = body & "<a href=""" & url & """>Klik hier om het document te zien</a>"
</pre>
this gives the html tag:
<a href="file:///c:\prog\JORODOCBEHEER\documentbeheer.exe">Klik hier om het document te zien</a>
This works but when I put a parameter after it I have the same problem as before.
I tryed to put the parameter between quote's, double quote's.
I tryed to put both the url and parameter between quote's, double quote's
I tryed using " (html code for ") and “ (html for left ")
Nothing worked
when I try to run the command (start - run)
I have to give in the following:
"file:///c:\prog\JORODOCBEHEER\documentbeheer.exe" "ID=Nieuw document - Klanten"
This works from start-run but when I put it in the html tag I get the openfiledialog box again
Any idea's would be very much apriciated (and thank you for your time and help so far)
|
|
|
|
|
Hii. I am currently trying to integrate a asp.net(VB) website with quickbooks. Below is the code.
Dim sessionManager As New QBSessionManager()
Dim requestMsgSet As IMsgSetRequest
Dim x As Integer
Try
sessionManager.OpenConnection2("", "QB Integration", ENConnectionType.ctLocalQBD)
sessionManager.BeginSession("C:\Program Files\Intuit\QuickBooks Accountant 2005\SA Outsourcing.QBW", ENOpenMode.omDontCare)
requestMsgSet = getLatestMsgSetRequest(sessionManager)
on the line
sessionManager.BeginSession("C:\Program Files\Intuit\QuickBooks Accountant 2005\SA Outsourcing.QBW", ENOpenMode.omDontCare)
it fails with "Could not start quickbooks"
Can someone please give me a reason for this. I've tried evrything I could think of user rights ect. and I have run the reboot.bat file as well nothing works
Stephen Lintott Bsc IT (RAU)
|
|
|
|