See Related Forum Messages: Follow the Links Below to View Complete Thread
Want To Change The Javascript Code To Vbscript Code
Hi, I got the dropdown working in my xslt file.
But now i need to change it via application where i set it enable or disable
How do i do this in vbscript: Please Assist!
<script TYPE="text/javascript" src="./codebase/dhtmlxcommon.js"></script>
<script TYPE="text/javascript" src="./codebase/dhtmlxcombo.js"></script
Convert Html Source Code To Vb Code
I would like to be able to enter html source code into a text box and then when I push a button I want that code to be modified to vb code.
An example would be:
HTML code:
<html>
<body>
Hello World<br>
<a href="http://www.nba.com">NBA</a><br>
</body>
</html>
VB code:
strHTML = "<html>" _
& vbCrLf & "<body>" _
& vbCrLf & "Hello World<br>" _
& vbCrLf & "<a href="& Chr(34) & "http://www.nba.com" & Chr(34) & ">NBA</a><br>" _
& vbCrLf & "</body>" _
& vbCrLf & "</html>"
I think I can use the replace function to replace all " with Chr(34) but my main issue is getting & vbCrLf & " at the beginning of each line. Does anyone know a way to cycle through each line of a text file and append data at the front of the line? How about append to the rear (end of line)?
Thanks for any advice/help in advance.
Vb 6 Vs Vb 2005 Code
i know that the form & modules from vb6 will not run in vb 2005, but will code work or is it totally different???? in other words could i import code(copy & paste) from vb6 and would it work?
do you create the forms the same way?
i have a lot of modules & routines that i would like to be able to use if i switch to vb 2005.
are there very many jumping on vb 2005???
i am sure i read somewhere that you can use vb6 and vb 2005 together in some way.
any info would be appreciated.
Convert Foxpro Code To VB Code - Help
Dear members,
I have a code in Visual Foxpro as follows;
PUBLIC FLAGPATROL
FLAGPATROL = 0
PUBLIC COUNTER
COUNTER = 0
PUBLIC NPORTNO
NPORTNO = THISFORM.COMBO1.VALUE
PUBLIC DWMAXCOUNT
DWMAXCOUNT = 5000
PUBLIC READVIDEXDATA
READVIDEXDATA = .F.
PUBLIC WNUM
WNUM = 0
PUBLIC BEGINNUM
SELECT MAIN
BEGINNUM = RECCOUNT()
DIMENSION PDWIBUTTONNUMBER(DWMAXCOUNT)
PDWIBUTTONNUMBER = SPACE(4*DWMAXCOUNT)
DIMENSION PDWTIME(DWMAXCOUNT)
PDWTIME = SPACE(4*DWMAXCOUNT)
DECLARE INTEGER GetAllInfo IN SomeDll.dll INTEGER @, STRING @, STRING @, INTEGER, INTEGER
FLAGPORT = GETALLINFO(@WNUM, @PDWIBUTTONNUMBER, @PDWTIME, DWMAXCOUNT, NPORTNO)
----------
How to convert it in Visual Basic? I tried to create a function in a module like this:
Declare function GetAllInfo Lib "SomeDll.dll" (ByVal Wnum as Integer,ByVal PdwIButtonNumber as String,ByVal PdwTime as String,ByVal MaxData As Integer, nPort as Integer) as Integer
When I call that function from the program :
data = GetAllInfo( num,button,time,200,1)
The VB alert An Illegal Operation, and then closed.
Note: I used that function to retrieve data from device via RS-232, original software used Visual Foxpro and SomeDll.dll
Thanks for help...
Nal
Zip Archiving Using Vb 6.0/2005 Code
Hello Readers,
I would like to find out whether it is possible to create .ZIP archives using Vb code. If it is possible please do humbly shed some knowledge on the details of creating the archives.
Khumbulau
Shared Code In .net 2005
I am creating my first web application in 2005 (beta2). In the past I have incuded a vb module for subs and functions that I want accessable from all pages in my application, i.e. connections strings, custom formatts... Adding a MyClass file to the App_Code folder looks like it should work with the new layout but when I try to call my functions I receive the following warning, "Reference to a non-shared member requires an object reference." Browsing for my class file in the site references dialog box didnt help because I could not choose a file with a .vb extension. How do I share my class files? Should I be doing something else entirely?
VB6+SQL Server 2005: Code Or DB Optimization
is there anyway you can help me optimize this code. the slow movement of rs is so visible that it take time to display the other row.
Code:
Call opencon
Set rsbookmark = New ADODB.Recordset
If CLng(txtIDRef) > 0 Then
rsbookmark.Open "tblsuppliers", conPC, adOpenKeyset, adLockReadOnly
rsbookmark.Find "pk_supplierid =" & txtIDRef & "" 'find previous bookmark
rsbookmark.MovePrevious
'chk if the next record= BOF
If rsbookmark.BOF Then
MsgBox strBOF, vbInformation, strprogname
GoTo rs_skip
End If
txtrecpos = "Record " & rsbookmark.AbsolutePosition & " OF " & rsbookmark.RecordCount
Call search_SC(rsbookmark!pk_supplierid) 'SP Call where pk_supplierid is clustered index
End If
rs_skip:
If rsbookmark.State = adStateOpen Then rsbookmark.Close
Set rsbookmark = Nothing
Call closecon
Looking For VB 2005 File Menu Code
Hey everyone. Doing a school assignment and i need to know the code for a basic file menu >> that is how to perform the tasks that each button does. Need code for>> new, file, save as, print, print preview, exit, undo, redo, cut, copy, paste, select all, customize, options, contents, index search.
Thanks all
VB 2005 Express Print Code
Iam creating a order form using vb 2005 express beta, Iam having trouble writing correct code to print button that will print form contents.
Iam only able to print a blank page.
Please any help would br great
thanks, Bruni
VB 6 Code In Visual Studio 2005
I have some VB6 code, but i dont have the VB6 IDE/liscense. However, I do have Visual Studio 2005 (.NET). Can I use VS 2005 to compile and run the VB6 code?
Creating An SQL 2005 Express Database Via Code
Hi All
Sorry if im being dumb here but this is my first attempt using SQL as im trying to get away from access
what I want to try and do first is create a blank sql 2005 database
Im trying the following (Based on what i did with access) and clearly im getting this wrong
Code:
Dim cn As ADODB.Connection
Dim xCat As Object
Dim stDB As String
Dim stCon As String
'Set cn = New Connection
stDB = App.Path & "" & "Test.mdf"
stCon = "Provider=SQLNCLI.1;Integrated Security=SSPI;" & _
"Persist Security Info=False;" & _
"AttachDBFileName=" & stDB & ";Data Source=PAULSDESKTOPSQLEXPRESS"
Set xCat = CreateObject("ADOX.Catalog")
xCat.Create (stCon)
Set xCat = Nothing
Can anyone help me figure this out please, it wil be very appreciated as I really am stuck and dont really want to just go back to what i know
thanks
Gibbo
VB 2005 Express Need Urgently Help With A Code Strip
Hi everybody
I am writing a program in microsoft's Visual Basic 2005 Express as a school project. The program is supposed to measure peoples reaction time. For example a big red dot occures on the screen and you have
to push a keyboard key as fast as you can. I have done most of the design and programming on my own, but recently i got stuck and can't go any further.
Right now I need help with writing a simple line of a code. (well simple for you but not for me duh). The deal is that the program is divided into 10 different test. In every one of them i want a
thing to happen in a random period of time.
For example : after I click on the "start" button i want the square to change colour randomly between 1 and 7 seconds.
so it looks like this:
Push the button > counter goes of and randomly stops between 1 and 7 seconds > after the timer stops the bloody square changes colour > new timer goes of that measures time that took you to press the button for example "x" > Time is shown on the screen.
This is the process i need the code for. I am not very good with computer s and this project is done for biology lesson and the main idea of the project is to measure the reacion times.
Well thats it... if you can help me with this I'll promise to make it up for you all. I'll steal a whole load of cash if its needed to pay you of
With love
Paul
[2005] Access Parts Of A File By Hex Code??
I am writing a program that I want to show information that is contained inside the program. They say that the internal name would be at 0x83 or something to that effect. How would I have VB 2005 Express view this code and show it in a label? Sometimes the code is from 0x83 to 0x84 or something, so would that be different? Thanks.
How To View VB Code In Visual Studio 2005
I am an Access programmer who is very proficient in VBA. I am trying to help someone out with a VB application they have and I am very confused. I hope someone can just point me in the right direction. I have reviewed many forums here at Tek-tips and on the internet and there is so much information that I don't know where to start.
This application has an Access backend but the screens are all VB. I am not sure but I think VB6 was used. I have the source code and the database.
How can I view this code? I ordered a trial version of Visual Studio 2005. When I open the project, which is an .exe file, I see the database tables. But when I open the source code .frm files, I see the VB code in a top-down screen, as I would in the VBA modules in Access. I expected to see a GUI interface with buttons, etc. like I do in Access. I used VB6 many years ago and I know it didn’t look like this top-down code.
I would appreciate any info as to where to look to see the source code and be able to run the screens against the database.
Thanks so much.
Alexis
VBScript Code
Hi Everyone,
I have the following VBScript code that I am trying to run. Basically, what I want to have happen is this. When the user enters some information into the text box "Text" then moves to the next next box, or loses focus on the first one I want the script to run the "Text_LostFocus script". Make sense? The code I have written does not work correctly and I am not sure what to do. Thanks for any help.
Code:
<html>
<head>
<SCRIPT LANGUAGE="VBScript">
Sub Text_LostFocus()
MsgBox "Script ran Okay."
End Sub
</SCRIPT>
</head>
<body>
<form>
<p><input type="text" name="T1" size="20" action="Text_LostFocus"><br>
<input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>
</body>
</html>
VBScript Code
Hii Theree
I have been trying for so long but this simple code does not seems to work. I would really be grateful if you can plss help me out with this code.The button in the code is not working. It does not get activated on clicking and there isno error message that that I am getting. I am at my wit's end.plss help me.
<html>
<head> </head>
<body>
<form method="POST" action="--WEBBOT-SELF--">
<input type="button" value="load data" OnClick="loaData();">
</form>
<script language="VBScript">
sub loadData()
dim conn
dim rs
dim qry
msgbox "hi"
Set conn = CreateObject("ADODB.Connection")
conn.CursorLocation = 3
Set rs = CreateObject("ADODB.Recordset")
conn.Open "TestDB"
': Queries
qry = "Select * from q4
rs.Open qry, conn, adOpenStatic
if not rs.eof then
rs.movelast
total = rs.recordcount
rs.movefirst
msgbox total & " records from Queries were loaded",,""
end if
conn.close
set rs = nothing
set conn = nothing
end sub
</script>
</body>
</html>
Thanks so much
Ravi
Vbscript Code & ASP
I'm trying to incorporate this piece of code in an ASP file to display some information but it keeps crashing with msg"
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'FolderExists'
This is the code:
<SCRIPT LANGUAGE="VbScript">
Function FolderExists(ByVal strPath As String) As Boolean
Dim s As String
If Right(strPath, 1) = "" Then strPath = Left(strPath, Len(strPath) - 1)
s = Dir(strPath, vbDirectory)
If s <> "" Then FolderExists = True
End Function
</SCRIPT>
Then calling the function...
If FolderExists(FolderContent) then
response.write "test folder exist"
end if
Any assistance will be appreciated.
VBScript Encryption, Need Some Code
I have this VBScript encryption function. This should work
on Internet Explorer 5.0 and 5.5 built-in "VBScript engine"
Private Function EncryptString(strString)
I need a VBScript function "cryptfile" that will do this:
I have a text file "xfile.txt" 900KB and the "cryptfile"
function will encrypt every line (every string) on that
file using function "EncryptString", and encrypted text
will be stored on file "xfile.xxx"
I need that function "cryptfile", I'm sure it's easy,
just 10 or 15 lines.
set aaa = top.hid.filesys.OpenTextFile( ...
Thanks
Dynamic Code.. Possible With Vbscript Maybe?
Hey, this is a far fetched idea I have but wanted to see if it was possible just the same.
Is there anyway to load some dynamic code into a program (at run time) that could access the various functions in the program as if it was built in?
I'm looking for an easy way to perform some database maintenance during an update without having to recode the updater program everytime and without having to rely on a vbscript with every function I need to do it. It would be nice if I could keep the common functions in the updater program and somehow allow a vbscript to access them...
Is this doable in anyway maybe even in another way besides vbscript?
Thanks, Steven
How Do I Debug VBScript Code
I'm trying to develop a spellchecker to be used with the VBWTool utility. It is VBScript in an htm file. I've never done anything before with VBScript. How do I debug my code?
Will My Code Here Work In VBScript?
I have just finished a program in VB6 and now I wish to transfer all of that to eVB which runs VB Script. I want to do that because I want to run the software on my Pocket PC.
However, when I run the code, it works fine in VB6 but doesnt work in eVB. What can I do to fix it. Here is the initial code with which I'm haveing a problem. Apparantly, the last statement is returning false on both counts. My syntax must be wrong somewhere.
Private R10F5Array(12, 8) As Integer
Dim strRwy As String
Dim strFlap As String
Dim intTemp As Integer
Dim intWind As Integer
Dim intQnh As Integer
Dim RowFound As Boolean
Dim ColFound As Boolean
Dim TempInput As Double
Dim WindInput As Double
Private Sub cmdRTOW_Click()
'Assign the Combo Box values to variables
strRwy = cboRwy.Text
strFlap = cboFlap.Text
intTemp = cboTemp.List(cboTemp.ListIndex)
intWind = cboWind.List(cboWind.ListIndex)
intQnh = cboQnh.List(cboQnh.ListIndex)
boolEAI = cboEAI.List(cboEAI.ListIndex)
'_______________________1______________________
'Loop to find the correct column
'for Rwy 10, Flap 5
If strRwy = "Runway 10" And strFlap = "Flap 5" Then
RowFound = False
ColFound = False
If intWind = -10 Then
ColFound = True
col = 1
Else
For i = 1 To 7
If intWind <= R10F5Array(0, i) And _
intWind > R10F5Array(0, i - 1) Then
ColFound = True
col = i
Exit For
End If
Next
End If
'Loop to find the correct row
'for Rwy 10, Flap 5
If intTemp = -10 Then
RowFound = True
row = 1
Else
For i = 1 To 11
If intTemp <= R10F5Array(i, 0) And intTemp _
> R10F5Array(i - 1, 0) Then
RowFound = True
row = i
Exit For
End If
Next
End If
lblRTOW.Caption = vbNullString
If ColFound = True And RowFound = True Then
lblRTOW.Caption = RTOW(row, col, intWind, intTemp)
End If
End If
End Sub
RTOW is a function which is defined later but these 2 conditions return false in the first place. Why is that?
WSH VBScript Automation Code Help
I'm trying to make a VBScript that will automate the deleting of old log files from a particular server. But I only want it to delete a particular file type and I can’t figure out how to do that.
Here's my code:
Code:
Option Explicit
Dim filesys, createdate, theFiles, FolderPath
Dim fil, filist
'sets "filesys" as the File System Object
Set filesys = CreateObject("Scripting.FileSystemObject")
Set FolderPath = filesys.GetFolder("C:
ew folder") 'Test Path
Set theFiles = FolderPath.Files
For Each fil In theFiles
createdate = fil.datecreated
If createdate <= DateAdd("D", -30, Now) Then
if fil.type = ".txt" then ' <--- this part doesnt work
filist = filist & fil.Name & " " & fil.datecreated & " - Was Deleted"
filist = filist & vbCrLf
fil.Delete
end if
End If
Next
MsgBox filist
I'm planning on changing the msgbox to a txt file that logs the files that were deleted. but I’m not sure how to do that either.
If you can help, you’re AWESOME!!!!
Thanks dudes and dudets
Is There A Way To Embed JSP Code In VBScript?
I am launching MS Excel using VBScript in the JSP Page. I want to populate the spread sheet with the values coming from a Java Bean. I am not sure how I can embed JSP code in the VBScript.
Thanks
How To Convert C Code To Vb Code
Hi,
May i know how to convert C code below to VB code:
byte addr, int npoints, long *path, int freq
Actually what is the meaning of *path in c code?
Can Anyone Convert This C Code To Vb6 Code
void decryptPassword(const char *encrypt_pass, char *s)
{
char str[128], ch;
char hs[] = { 0, 0, 0 };
int v1, v2, i, l;
int begin_found = 0;
*s = 0;
for(i = 0; encrypt_pass[i*2]; i++)
{
hs[0] = encrypt_pass[i*2]; hs[1] = encrypt_pass[i*2+1];
v1 = strtol(hs, 0, 16);
hs[0] = encrypt_pass[i*2+4]; hs[1] = encrypt_pass[i*2+5];
v2 = strtol(hs, 0, 16);
if(!begin_found)
{
if(v1 == v2) begin_found = 1;
}
else
{
if(v1 != v2)
begin_found = 0;
else
{
i += 3;
break;
}
}
}
if(!begin_found) return;
for(ch = 0, l = 0; encrypt_pass[i*2+2]; i++, l++)
{
hs[0] = encrypt_pass[(i-2)*2]; hs[1] = encrypt_pass[(i-2)*2+1];
v1 = strtol(hs, 0, 16);
hs[0] = encrypt_pass[i*2]; hs[1] = encrypt_pass[i*2+1];
v2 = strtol(hs, 0, 16);
ch = (ch + (char)v1) ^ (char)v2;
str[l] = ch;
}
str[l] = 0;
CharToOem(str, s);
}
Convert Vbs Code To Vb Code
the following is a vbs code and want to convert it into a vb code so that i can create or made an .exe file. thanks in advance
Set ows = CreateObject("WScript.Shell")
Set oWmi = GetObject("winmgmts:")
sWmiq = "select * from Win32_Process where name='EXCEL.EXE'"
Set oQResult = oWmi.Execquery(sWmiq)
For Each oProcess In oQResult
iRet = oProcess.Terminate(1)
Next
set ows = nothing
set owmi = nothing
Question About 'compiled' Vbscript Code.
I have a game engine that I script with vbscript. Each of my vbscripts takes about a second to parse and compile (I have to parse them first before I can compile them).
Would it be possible to save the compiled version of my code to a binary file and then load the binary file at run-time after the scripts are compiled on the client's computer the first time?
Furthermore, could I simply compile the vbscript on my computer and then distribute the binary code to be loaded into the MSScriptControl.ScriptControl at runtime?
Thanks for your help.
Need VBscript Code To Check Ip Adres
i need a code to check if the ip adres is the match because i have a program and if i send it to some one he can use id because i have insert his ip adres but if he send it to another, then he can't use it is there something like that???
Help With Converting This Small Code From VB To ASP (VBScript)
I am converting some code to ASP (VBScript)
Code:
kPtr = 1
sPtr = 1
For n = 1 To KeySize
pArray(n) = pArray(n) Xor nKeys(n)
rtn = Abs(((nArray(n) Xor pArray(n)) Mod 512) - tOffset)
If rtn < 16 Then
Mid(gKey, kPtr, 2) = "0" & Hex(rtn)
Else
Mid(gKey, kPtr, 2) = Hex(rtn)
End If
If sPtr = 2 And kPtr < 18 Then
kPtr = kPtr + 1
Mid(gKey, kPtr + 1, 1) = "-"
End If
kPtr = kPtr + 2
sPtr = sPtr + 1
If sPtr = 3 Then sPtr = 1
Next
It errors on this line with Type Mismatch
Mid(gKey, kPtr, 2) = Hex(rtn)
I am not very good with VBS, so if someone can help me, I would be very gratefull.
Thanks.
How To Call VBScript Code Into My VB Application
Hello!
I am thinking to develope an application as follows:
The forms would be defined in some .xml files using this protocol:
<FORM Name = "MyForm">
<PROPERTY Name="Caption" Value="My application"/>
<PROPERTY Name="../>
...
<EVENT Name="Load">
MsgBox "Hello!"
</EVENT>
<CONTROL License="MSFlexGridLib.MSFlexGrid" ProgId = "MSFlexGridLib.MSFlexGrid" Name="grd1">
<PROPERTY Name="Cols" Value="3"/>
...
<EVENT Name="RowColChange">
...
</EVENT>
</CONTROL>
...
</FORM>
I have a component who reads the .xml file and builds the form using a Visual Basic form, changing the properties of the form using something like the "CallByName" function, and adding the controls defined in the .xml file, using the "Add" method. This component has a "CControl" class that use a VBControlExtender to contain each ActiveX controls of the form.
When an event is raised, the component "looks" if the control who raises the event has some "actions" to do. As you can see in the definition of the form, for each event of each "OBJECT", you can define "what to do" using VBScript code. But I have some questions about this design:
1) How can I parse this VBScript code? I think that it could be better if I write all the VBScript in an independent file, and all the services inside a class / some classes. So, how can I do it?
2) How can I catch the objects of my form from the VBScript code? For exemple, I would like to use the MSFlexGrid control to change then number of Rows when the "RowColChange" event is raised.
3) I make this desing because I want to automate the creation of the interface. My goal is not to compile any code when I change the interface. Does exist another better way to do it?
I hope somebody could help me. Thanks in advance!
Convert .xls To .mdb Thru Code
Hi,
I am just wondering if it's possible to convert an excel file. [.xls] to Access Database file [.mdb] using visual basic code.
thanks,
jenios.
Convert Code
Could anyone please help me in converting the coding found on point 7 of this support.microsoft.com webpage:
to work using Visual Basic (legacy) linked to an access database.
I have my database all prepared and linked through Visual Basic. I just need the code in section 7 to function.
At the moment, the code found on the above website is tailored to run through modules using just Microsoft Access.
Thank you
Convert Vbs To Vb Code
I've been trying to change my vbs to a vb so that I can make a little utility kit. I have the following vbs code that runs flawlessly and I'm trying to make a vb from it. I've got the inputbox and message box working, its the remainder that Ic annot figure out. I have no experience in programming so I'm a work in progress...
vbs:
Code:
'Set the server name
strComputer = InputBox("Enter Computer Name Here", "Server UpTime Query")
Set objShell = CreateObject("WScript.Shell")
'Run uptime to generate the data
Set objWshScriptExec = objShell.Exec("cmd /c uptime.exe " & " \" & strComputer)
Set objStdOut = objWshScriptExec.StdOut
'Get the details
strLine = objStdOut.ReadLine
'Display the result
msgbox strLine, vbokonly, "Server UpTime Results"
So far in VB:
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myServer As Object
Dim response As MsgBoxResult
Dim line As String
Dim ID As String
myServer = InputBox("Enter Computer Name Here", "Server UpTime Query")
ID = Shell("cmd /c C: empatchuptimeuptime.exe", , True, 100000)
line = Console.ReadLine()
response = MsgBox(line)
End
End Sub
Edit by moderator: You can use the [vb] tags to format your code, to make it easier to read. Click 'Edit' or 'Reply' on this post to see how they work, or read all about tags here.
It also helps if you post VB.NET questions in the right forum (= not in the VB6 section). Thanks.
Convert C++ Code
i have got some source code written in c++ that i want to convert into vb code - because i can't understand anything about c++ code. is there a way to convert this. b2c.exe converts vb into c++, is there a tool that works the other way?
thanks
adam
How To Convert This C Code To Vb
KPocket PCs come with a build in KernelIoControl() to return serial number of the handheld.
Code:
#include <WINIOCTL.H>
extern "C" __declspec(dllimport)
BOOL KernelIoControl(
DWORD dwIoControlCode, LPVOID lpInBuf, DWORD nInBufSize,
LPVOID lpOutBuf, DWORD nOutBufSize, LPDWORD lpBytesReturned
);
#define IOCTL_HAL_GET_DEVICEID CTL_CODE(FILE_DEVICE_HAL, 21, METHOD_BUFFERED, FILE_ANY_ACCESS)
CString GetSerialNumberFromKernelIoControl()
{
DWORD dwOutBytes;
const int nBuffSize = 4096;
byte arrOutBuff[nBuffSize];
BOOL bRes = ::KernelIoControl(IOCTL_HAL_GET_DEVICEID,
0, 0, arrOutBuff, nBuffSize, &dwOutBytes);
if (bRes) {
CString strDeviceInfo;
for (unsigned int i = 0; i<dwOutBytes; i++) {
CString strNextChar;
strNextChar.Format(TEXT("%02X"), arrOutBuff[i]);
strDeviceInfo += strNextChar;
}
CString strDeviceId =
strDeviceInfo.Mid(40,2) +
strDeviceInfo.Mid(45,9) +
strDeviceInfo.Mid(70,6);
return strDeviceId;
} else {
return _T("");
}
}
Guys, is it possible to convert this code into visual basic? Using what? Windows API calls or something?
How to convert this line to VB?
BOOL bRes = ::KernelIoControl(IOCTL_HAL_GET_DEVICEID,
0, 0, arrOutBuff, nBuffSize, &dwOutBytes);
Convert Code From Vb.net To Vb6
can somebody help me to convert code below to become code used in vb6.
Code:
Public Function distance(ByVal lat1 As Double, ByVal lon1 As Double, ByVal lat2 As Double, ByVal lon2 As Double, ByVal unit As Char) As Double
Dim theta As Double = lon1 - lon2
Dim dist As Double = Math.Sin(deg2rad(lat1)) * Math.Sin(deg2rad(lat2)) + Math.Cos(deg2rad(lat1)) * Math.Cos(deg2rad(lat2)) * Math.Cos(deg2rad(theta))
dist = Math.Acos(dist)
dist = rad2deg(dist)
dist = dist * 60 * 1.1515
If unit = "K" Then
dist = dist * 1.609344
ElseIf unit = "N" Then
dist = dist * 0.8684
End If
Return dist
End Function
Private Function deg2rad(ByVal deg As Double) As Double
Return (deg * Math.PI / 180.0)
End Function
Private Function rad2deg(ByVal rad As Double) As Double
Return rad / Math.PI * 180.0
End Function
Convert C Code To VB
Hi,
I'm having trouble converting the following code to VB. Is there anyone who can convert it to VB 6 for me?
Thanks in advance!
void Histogram8bpp( BYTE *pFrame, int FrameSize, DWORD *Mh ) {
int i;
memset( Mh, 0, 256 * sizeof( DWORD ) );
for ( i = 0; i < FrameSize; i++, pFrame++ ) {
Mh[ *pFrame ]++;
}
}
void Histogram24bpp( RGB24 *pFrame, int FrameSize, DWORD* Rh, DWORD *Gh, DWORD *Bh ) {
int i;
memset( Rh, 0, 256 * sizeof( DWORD ) );
memset( Gh, 0, 256 * sizeof( DWORD ) );
memset( Bh, 0, 256 * sizeof( DWORD ) );
for ( i = 0; i < FrameSize; i++, pFrame++ ) {
Rh[ pFrame->r ]++;
Gh[ pFrame->g ]++;
Bh[ pFrame->b ]++;
}
}
WhiteBalance( BYTE *pRawFrame, int W, int H, BOOL FlipH, BOOL FlipV, double *mR, double *mB ) {
int x, y;
DWORD R = 0, G = 0, B = 0;
if ( !FlipH && !FlipV ) {
// G R
// B G
for ( y = 0; y < H/2; y++ ) {
for ( x = 0; x < W/2; x++ ) {
G += *pRawFrame++;
R += *pRawFrame++;
}
for ( x = 0; x < W/2; x++ ) {
B += *pRawFrame++;
G += *pRawFrame++;
}
}
} else if ( !FlipH && FlipV ) {
// B G
// G R
for ( y = 0; y < H/2; y++ ) {
for ( x = 0; x < W/2; x++ ) {
B += *pRawFrame++;
G += *pRawFrame++;
}
for ( x = 0; x < W/2; x++ ) {
G += *pRawFrame++;
R += *pRawFrame++;
}
}
} else if ( FlipH && !FlipV ) {
// R G
// G B
for ( y = 0; y < H/2; y++ ) {
for ( x = 0; x < W/2; x++ ) {
R += *pRawFrame++;
G += *pRawFrame++;
}
for ( x = 0; x < W/2; x++ ) {
G += *pRawFrame++;
B += *pRawFrame++;
}
}
} else { // if ( FlipH && FlipV ) {
// G B
// R G
for ( y = 0; y < H/2; y++ ) {
for ( x = 0; x < W/2; x++ ) {
G += *pRawFrame++;
B += *pRawFrame++;
}
for ( x = 0; x < W/2; x++ ) {
R += *pRawFrame++;
G += *pRawFrame++;
}
}
}
G = G / 2;
*mR = -1.0;
*mB = -1.0;
if ( R > 0 ) *mR = (double)G / (double)R;
if ( B > 0 ) *mB = (double)G / (double)B;
}
Need To Convert This C Code Into Vb...
hi, anyone can help i need this code into vb for my project
this code is under c
VB Code:
//// Algoritmo códigos de liberación DCT3// Algorithm unlock codes DCT3//// indear// #include <stdio.h>#include <string.h> void ASCII2HEX (unsigned char *origen, unsigned char *destino, int caracteres);unsigned char convertir_byte_a_hex (unsigned char byte);unsigned char calculo4_a (char caracter);void calculo4 (unsigned char *cadena);void calculo3 (unsigned char *cadena);void calculo2_a (unsigned char *cadena, unsigned char byte, unsigned char byte2);void calculo2 (unsigned char *cadena, unsigned char byte, unsigned char byte2);void calculo1 (unsigned char byte, unsigned char *network_code_h, unsigned char *imei_h);void calculo1_a (unsigned char *cadena);void calcular_dct3 (unsigned char *imei, unsigned char *network_code, unsigned char *destino); void ASCII2HEX (unsigned char *origen, unsigned char *destino, int caracteres){ int i, j; unsigned char aux1, aux2; j=0; for(i=0; i<caracteres; i+=2) { aux1 = convertir_byte_a_hex(origen[i])<<4; if (i+1 < caracteres) aux2 = convertir_byte_a_hex(origen[i+1]); else aux2 = 0; destino[j] = aux1 | aux2; j++; }} unsigned char convertir_byte_a_hex (unsigned char byte){ if ((byte > 57) || (byte < 48)) // '0' a '9' return (byte-55); else return (byte-48); // 'A' a 'F' o otro caracter} unsigned char calculo4_a (char caracter){ unsigned char aux1, aux2, aux3, temp; int i; aux1=0; aux2=7; temp=0; for (i=0; i<8; i++) { aux3=caracter; aux3=aux3>>aux2; aux3&=1; aux3=aux3<<aux1; temp|=aux3; aux1++; aux2--; } return temp;} void calculo4 (unsigned char *cadena){ char temp[12]; int i; memcpy(temp, cadena, 12); for (i=0; i<12; i++) { cadena[11-i]=calculo4_a(temp[i]); } }void permu1(unsigned char *network_code_hex, unsigned char *tabla, unsigned char *imei_hex){ unsigned char *puntero; int i; puntero=tabla; for (i=0; i<11; i++) { calculo1(*puntero, network_code_hex, imei_hex); calculo2(network_code_hex, 0, 8); calculo3(network_code_hex); calculo2(network_code_hex, 8, 0); puntero++; } calculo1(tabla[11], network_code_hex, imei_hex); calculo4(network_code_hex);}void calculo3 (unsigned char *cadena){ unsigned char aux1, aux2, aux3, temp1, temp2; char temp[12]; int i; memcpy(temp, cadena, 12); temp2=12; temp1=7; aux1=3; for(i=0; i<12; i++) { aux2=temp1; aux3=aux1; aux2=temp[aux2]; aux2^=0xFF; aux2|=temp[aux3]; temp2--; if (temp1==0) temp1=12; temp1--; if (aux1==0) aux1+=12; aux3=temp2; cadena[aux3]^=aux2; aux1--; }} void calculo2_a (unsigned char *cadena, unsigned char byte, unsigned char byte2){ unsigned char aux1, aux2, aux3; unsigned char *puntero; int i,j; if (byte==0) return; for (i=0; i<byte; i++) { aux1=cadena[byte2+3]; aux1&=1; puntero=cadena+byte2; for (j=0; j<4; j++) { aux2=*puntero; aux3=aux2; aux2=aux2>>1; aux1=aux1<<7; aux2|=aux1; aux3&=1; *puntero=aux2; aux1=aux3; puntero++; } }} void calculo2 (unsigned char *cadena, unsigned char byte, unsigned char byte2){ calculo2_a(cadena, 10, byte); calculo2_a(cadena, 31, byte2);} void calculo1 (unsigned char byte, unsigned char *network_code_h, unsigned char *imei_h){ unsigned char aux1, aux2; int contador; unsigned char *puntero, *puntero2; puntero=network_code_h; puntero2=imei_h; contador=0; aux1=0; while (contador < 12) { aux2=aux1; aux2=(aux2>>1) % 3; aux2&=1; aux2*=byte; aux2^=(*puntero2); (*puntero)^=aux2; aux1++; puntero++; puntero2++; contador++; } calculo1_a(network_code_h);} void calculo1_a (unsigned char *cadena){ // 60 bytes char tabla1[] = {0x01,0x09,0x04,0x08,0x0B,0x05,0x09,0x08,0x06,0x0A, 0x01,0x03,0x0B,0x06,0x0A,0x00,0x08,0x07,0x0B,0x0A, 0x01,0x05,0x00,0x08,0x03,0x01,0x09,0x00,0x02,0x0A, 0x05,0x03,0x07,0x02,0x0A,0x00,0x04,0x03,0x0B,0x02, 0x05,0x09,0x00,0x04,0x07,0x01,0x05,0x04,0x02,0x06, 0x09,0x07,0x0B,0x02,0x06,0x04,0x08,0x03,0x07,0x06}; // 60 bytes char tabla2[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00, 0x01,0x00,0x01,0x01,0x01,0x00,0x01,0x00,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01}; unsigned char *puntero=cadena; unsigned char aux1, aux2; int contador1, contador2, contador3; char variable_8c[12]; contador1=0; aux1=0; aux2=0; while (contador1<12) { contador2=5; aux2^=*puntero; while (contador2>0) { if ((tabla2[aux1] == 0) && (contador1 <6)) { variable_8c[tabla1[aux1]]=*puntero; } else { variable_8c[tabla1[aux1]]^=*puntero; } aux1++; contador2--; } contador1++; puntero++; } for (contador3=0; contador3<12; contador3++) variable_8c[contador3]^=aux2; memcpy(cadena, variable_8c, 12); } void calcular_dct3 (unsigned char *imei, unsigned char *network_code, unsigned char *destino){ char tabla[] = {0xb1,0x73,0xe6,0x5a,0xab,0x47,0x8e,0x0d,0x1a,0x34,0x68,0x0b}; //12 bytes char network_code_h[12], imei_h[12]; int i, j; unsigned char aux1; memset(network_code_h, 0, sizeof(network_code_h)); memset(imei_h, 0, sizeof(imei_h)); ASCII2HEX(network_code, network_code_h, (int)strlen(network_code)); ASCII2HEX(imei, imei_h+2, 14); for (i=2; i<12; i++) imei_h[i]^=0xa5; permu1(network_code_h, tabla, imei_h); j=0; for (i=0; i<5; i++) { aux1=network_code_h[i]; if ((aux1&0x80) == 0x80) aux1+=0xa0; if ((aux1&0x08) == 0x08) aux1+=0xfa; destino[j]=(aux1 >> 4) + 0x30; j++; destino[j]=(aux1 & 0x0F) + 0x30; j++; } destino[j]=0;}void main() { // examples - ejemplos char destino[11]; calcular_dct3 ( "111111111111119", "22222", destino); // Code1 use network code printf("#pw+%s+1#
", destino); // Codigo1 usar el codigo de operador calcular_dct3 ( "111111111111119", "FFFF", destino); // Code2 use GID1 printf("#pw+%s+2#
", destino); // Codigo2 usar el GID1}
How To Convert This C++ Code To VB
What will be the equivalent of this enumeration in VB
Code:
typedef enum BrowserNavConstants {
navOpenInNewWindow = 0x1,
navNoHistory = 0x2,
navNoReadFromCache = 0x4,
navNoWriteToCache = 0x8,
navAllowAutosearch = 0x10,
navBrowserBar = 0x20,
navHyperlink = 0x40
} BrowserNavConstants;
Thanks in advance
Convert This C Code To VB
Hi,
I need to do something very similar to the code below, that is, declare an array of move counts (the # of possible moves for any piece at a given position), and fill it with data right away. Unfortunately, I don't know if VB allows for this, or what syntax to use if it does. Please help!
VB Code:
unsigned char num_moves[4][32] = { // Number of moves for a piece at a position {2,2,2,1, 1,2,2,2, 2,2,2,1, 1,2,2,2, 2,2,2,1, 1,2,2,2, 2,2,2,1, 0,0,0,0}, {2,2,2,1, 2,4,4,4, 4,4,4,2, 2,4,4,4, 4,4,4,2, 2,4,4,4, 4,4,4,2, 1,2,2,2}, {0,0,0,0, 1,2,2,2, 2,2,2,1, 1,2,2,2, 2,2,2,1, 1,2,2,2, 2,2,2,1, 1,2,2,2}, {2,2,2,1, 2,4,4,4, 4,4,4,2, 2,4,4,4, 4,4,4,2, 2,4,4,4, 4,4,4,2, 1,2,2,2}};
Convert Code
is there an easy way to convert existing code in qbasic into visual basic. im using visual basic 6
thanks in advance
Help Me Convert Code
http://www.pscode.com/vb/scripts/Sho...25753&lngWId=1
I want my program to register every 3 letter name on aol by editing the source of the program to register them but it need to also have random emails please help.
Thanx.
-Dan
Ps. I have a wordlist of every 3 letter combo thx to joacim
Ps.The author said i could do this.
Convert This C Code To VB?
Can anyone help to convert this C code to VB?
Code:
#include
#include
#include "guilib.h"
int putt (char *strControlName);
int LogOff (HANDLE hHandle);
void main()
{
char Hostname[50];
char SystemID[5];
char Client[5];
char User[20];
char Passwd[20];
char Language[5];
HANDLE hHandle;
PIT_EVENT pEvt = 0;
strcpy (Hostname,"hostname");
strcpy (SystemID,"00");
strcpy (Client,"100");
strcpy (User,"UNAME");
strcpy (Passwd,"PASSWD");
strcpy (Language,"E");
hHandle = It_NewConnection(Hostname, SystemID, SAPGUI_FRONT);
It_Login (hHandle, Client, User, Passwd, Language );
while ( It_GetEvent(hHandle, &pEvt) )
{}
}
|