Just Cant Understand BitBit!
Ok, ive tryed to understand this stuff for about 4 hours by now. And i just dont GET IT! I get NO ERRORS at all, but NOTHING HAPPENS either. So i wondered if anyone would post a newbie BitBit program for me.
thx
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Help With BitBit
Hello,
I am new to the gaming scene. I have picked up a little here and though however. I was wonder how to determine the size of the map window? Uhh...How to make it Show more of the map? The example I am looking at only has a small block, but I want to increase it to view more map at a time. Any suggestions on where to start?
Bitbit Help
hey i am making a character moving using bitblt to bit the character into a picture box
how to i make it so when i move the picture it will not leave the previous picture behind. so it will look like that character is moving.
thanks
BitBit Help
first off, what is Bit Bit, and how do you use it, can someone give me a good place to learn it from, tutorials or something, thanks in advance
Working With BitBit
Hi,
I've just began using BitBit now, so i'm not too good, i'm progressing slightly, but have a small problem...
Anyway, i've began making a square grid based maze game to get used to the functions of BitBit and cant seem to get something right, the game currently in no way resembles a maze, because I haven't started that bit yet...
To move the sprite properly, on a square-based grid i have set up an intXNow value to work with the intX, so that the character only moves so far at a time, by presetting intX to 10, then everytime you press to move, intXNow updates itself to equal intX, then runs the movement part on a timer...
Code:
Do Until intX >= intXNow + 50
-- movement code --
Loop
This works fine, but when you run it the first time he moves, he does four steps, the next time he does 5 steps, so he is no longer in the center of the x-axis grid...
I'm not sure what I have done wrong with this code.
Can somebody please look at my source code and tell me what i have done wrong to cause this uneven movement.
The source is in the zip below...
Your Help Is Greatly Appreciated.
BitBit Error
When i try to initialize BitBit i get this error:
Help????
BitBit With MSChart
Can you use BitBit to make a realtime MSChart Graph not flicker? I've looked through some of the threads here and they seem to mainly use pictureboxes for gaming. Is the principle the same, if so how would i implemet it?
Thanks
Sean
DLLImport - GDI32.dll - BitBit -
hi,
the Issue is ,
I would like to crop part of image. (I know the rectangle to be cropped from the tiff image). I tried DrawImage. But some Pixel Information is lost.
So I am trying to use BitBit approach.
My Code is ::::::
---------------Declaration - ----------------------
<DllImport("gdi32.dll", EntryPoint:="BitBlt", SetLastError:=True, _
CharSet:=CharSet.Unicode, ExactSpelling:=True, _
CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function BitBlt( _
ByVal hdcDest As IntPtr, _
ByVal nXDest As Integer, _
ByVal nYDest As Integer, _
ByVal nWidth As Integer, _
ByVal nHeight As Integer, _
ByVal hdcSrc As IntPtr, _
ByVal nXSrc As Integer, _
ByVal nYSrc As Integer, _
ByVal dwRop As Int32)
End Function
Private Const SRCCOPY = &HCC0020 ' (DWORD) dest = source
-----------------------
My function for cropping is
----------------------------
Dim g1 As Graphics = PictureBox1.CreateGraphics()
Dim imgCrop As New Bitmap(200, 200)
Dim g2 As Graphics = Graphics.FromImage(imgCrop)
Dim dc1 As IntPtr = g1.GetHdc()
Dim dc2 As IntPtr = g2.GetHdc()
BitBlt(dc2, 0, 0, 200, 200, dc1, 100, 200, SRCCOPY)
g1.ReleaseHdc(dc1)
g2.ReleaseHdc(dc2)
imgCrop.Save("c:Captured.jpg", ImageFormat.Jpeg)
MsgBox("Finished Saving Image")
------------
Error Msg :::
Unhandled Exception
PInvoke restriction: cannot return variants.
Anyone has idea about where I am doing wrong. Or any better approach for this
Transparency, BitBit() And Number Sorting
1. Transparency
Will a gif with a transparent background still have a transparent background on a form? If not then how can i get transparent backgrounds?
2. BitBit()
Unless it is very complicated and hard to explain could you show how to use BitBit() for animation?
3. number sorting
i have this code:
VB Code:
Dim dblAns As String Dim intDig As IntegerDim dbl As StringdblAns = "2856457889" For intNum = 1 To Len(dblAns) intDig = Mid(dblAns, intNum, 1) If (intDig Mod 2) = 0 Then If Len(dbl) Then dbl = dbl & ", " & Format(intDig) Else dbl = Format(intDig) End If Else dbl = dbl & Format(intDig) End IfNext intNum MsgBox "The numbers are:" & dbl
it splits the number 2856457889 into 2, 85, 6, 457, 8, 89
even numbers start a new number
rather than putting the split numbers into a string and displaying it in a msgbox i want it to load a new txtbox eg. txtNum fo each number.
thnx 4 help and i hope this post is more successful than last time
Make Bitmap Transparent With BitBit
Hi all -
Lets say I have a bitmap with a region that has been marked with a certain color to detone a transparent area - how could I go about BitBit'ing on top of another picture in VB so that the solid color becomes transparent? THanks
-Chris
Hmmm....bitbit Seems Easier Than Trying To Do Maps With An Editor?
Hello again,
I got my map working with bitbit, but the things are super small. I can barely see em hehe, anyone got a site that will show the break down of bitbit that what represents what? I had to just play with some and just do a row of numbers and see what I came out with. The last question is, to increase the actual size my bits display at do I need to increase the pixel size?
Thx for any help.
Questions: BitBit Moving, Walkmasks And Item Pickups.
Ok, so far have i quickly created a small program where a picture(the guy you control) moves instantly to the location of your click. Theres 3 things i must now:
1. How can i make my guy move slowly to the targeted location? not instantly.
2.How can i create walkmasks? Forexample if i create a tree, and i dont want my guy to walk right through the tree but around it.
3.How can i make my character pick up items? Forexample how can i make my guy get 10 score-points when he moves over an item, which in reality is a picture.
Edit*
I use BitBit.
This is not going to be a real game, iam just testing things out before i start creating a game.
Nothing is animated.
Help Me Understand, Please...
I will be creating a serie of projects to get me used to code gamelike programs. And so far I have desided to go with visual basic or c++ (Based upon all the READING, i mean extence reading, i have done in this forums), that is not the case or the reason of my question, but it is a good place to start reading.
My 2D Timeline will be:
1 - Pong
2 - Tetris
3 - Pac Man
4 - 2D Side Scroller Game ( Mario )
5 - Multy Functual Game that includes a Story, Characters, Items, Quest, etc ( zelda, RPG style)
There is a sofware called, Dark Basic pro, it is said that it will help me develope better games faster and stuff like that. The reason of my post here is to get some pointers because Im not sure if i should go and get this software and start coding and learning from it... rather than start with.. let say my first pong game, written in c++ or visual basic.
Does anyone has anything that could help me why not to choose Dark Basic Pro?
Please note that Im not trying to convert anyone nor im trying to start a silly debate about whats better, I implore you to post just the info that will help answer my silly question...
Should i go for it? Or start my gamming carrer/timeline using C++ and or VB?
Thank you for your help and patience...
ArsA
Does Vb Understand C?
as html understand other you just make the <langue=blahblah/blah>
is there a funcktion in vb so i can add a c# code into it? cuz i got some source how to convert mod and wav tunes
Need To Understand Dll
What are they?
What do they do?
What are they for (MDI / SDI / Database )?
What are the advantages?
What are the disadvantages?
How do I make one( to code one)?
How do I make my APP use it (read from it & write to it)?
DON'T UNDERSTAND!
Hi there.....
I have this project made in VB 5.0. I can't generate the .exe file in VB 6.0 because VB 6.0 doesn't recognize some of the methods (such as WindowTitle??). What can i do?
Also I have the .exe file previously generated in VB 5.0 (the same project) in another computer, but I'm not able to run it (only in that computer) ... the message I get is something like: "it's not possible to open the database... ActiveX component can't create object"
Ok I Still Don't Understand
OK........... I am making a program. where you add a message from text1.text to a listbox on another form. I want to be able to Save all the things in the listbox. into a ini file. and then i want to Load them back into the list box HOW do i go about doing this i am getting so frustrated
I Cant Understand Why?
i need some to tell me about the temprary file that is created while connecting to an access DB and then it disappears, becuse this file is still in my computer and the changes i made to the DB file through the VB app. i created r not stored but the r still in the temp file and do not transfered to the original access db.
am using DEinvironment to connect to the data. and the file is not created programmatically.
Help Me Understand...
I've read the ADO Tutorial and am starting my app from scratch with those concepts in mind.
My first task is to populate a DataList with a Recordset, which I opened with the method outlined in the Tutorial. However, when I do that, with the code below, the DataList is empty.
Code:
Dim Rs As ADODB.Recordset
Call OpenADOCn
Set Rs = adoCn.Execute("SELECT * FROM TableName")
With DataList
.ListField = "Name"
.BoundColumn = "Id"
End With
Set DataList.DataSource = Rs
Set DataList.RowSource = Rs
DataList.Refresh
However, if I use this code, it works just fine:
Code:
Dim Rs As ADODB.Recordset
Set Rs = New ADODB.Recordset
Call OpenADOCn
Rs.ActiveConnection = strADOCn
Rs.CursorLocation = adUseClient
Rs.CursorType = adOpenStatic
Rs.LockType = adLockBatchOptimistic
Rs.Open "SELECT * FROM TableName"
With DataList
.ListField = "Name"
.BoundColumn = "Id"
End With
Set DataList.DataSource = Rs
Set DataList.RowSource = Rs
DataList.Refresh
So on the one hand I got it to work, and that's great. But I want to understand WHY the other method - which seems more efficient to me - does not work.
Thanks.
I Don't Understand This
I have a Form called ABC. I have a PUBLIC variable called Cust_selected. When I click on a button I do FormXYZ.SHOW. When I clcik a button in this form my PUBLIC variable Cust_selected get sets here.
When I come back to FormABC I want to be able to check this PUBLIC vairable and if it is set to true I want to perform a read to a table. Where will the execution start when I come back to FormABC? I have it like this in FORMABC:
Private sub button_clicked()
If index = 3 then do
FormXYZ.show
If cust_selected = true then
Read the table
End if
End sub
Obviously it is not working for me. Any help will be greatly appreciated.
Help Me Understand I = 0
I have some items in a listbox, which are added by user. I want to add a edit feature, so the user can edited the selected item from the list box. Im not sure how i could do it, but i started something like:
VB Code:
Private Sub lblEdit_Click() For i = 0 To lstMainfrmEditPassword.Show vbModalEnd Sub
But without really knowing what i = 0 is, its dodgee for me. Please dont give me the code, just help me understand. Or i will never learn
Thanks
Can You Help Me Understand This
Hi All,
i have this program "See the attach"
and i want to understand two things:
1-in the question editor why there is no space for the correct answer, and also this from doesnot work fine.
2-why is the proram count and show the question in very strange way and where"in the code" does he said to stop showing the question if there is more than 2 answers are wrong.and how can we stop repeating the question which has appear before....
if you have any idea share it with me...Please
Anyone Understand This?
I am trying to :
1. create a new project with a single CommandButton labeled ‘Turn on system’. And then create a class for the project called clsSwitch. Add a single property to clsSwitch and a Boolean called State. Implement the following functionality: When the user clicks the button, the State value switches from True to False or False to True. If the value is True, the caption on the button should read ‘Turn off system’. If the value is False, the caption should read ‘Turn me on’.
Can anyone tell me whether what I have done so far is correct or not!!! Thanks!!! Or provide me with some assistance! I'm lossed!
I Don't Understand These Api's
When using visual basic, I know we use the properties and methods of objects exposed by the objects interface. What are we using when we use api's? Are we still using an object? If so, why can't we just reference it and use the objects as normal?
I Don't Understand.
I don't understand this:
Passing Arguments to Sub Procedures:
A quick word on passing arguments to procedures. By default, they are passed by reference. This means if an argument is changed within the procedure, it will remain changed once the procedure is exited.
C programmers have experienced the concept of passing by value, where a parameter changed in a procedure will retain the value it had prior to calling the routine. Visual Basic also allows calling by value. To do this, place the word ByVal in front of each such variable in the Argument list.
can I have a clear explanation plz?
I Don't Understand Something
Hi people!
I have a great problem and i think is my little knowledge of VB
I have 2 forms:
1 that calls a check mail program
2 That configures the uer name and password
This second form has a button called cmdOK, and i want that when the user clicks this button, some functions of the first form can be loaded.
The simple idea is that when the user click cmdOK, then the program checks for new e-mail.
The program on form 1 has the function to do that when you make double click.
I have tried to load the menu like:
Private Sub cmdOK_Click()
Load frmNumber1.mnuCheckMail
End Sub
I am sure that is some way to do that
Thanks to all the crazy VB fans
Don't Understand
1.
Can I make a procedure and procedure call in a form (VB)?
how? please give a very simple example....(cause i want to aviod duplicate codes)
2.
How to differentiate module call?
let say i have to modules namely "jack" and "Jackal"
Show a very simple example please.....
THank YOU
Don't Understand
I'm not understanding why this works, and what it dosn't when u change it. This is part of a keylogger that I rewrote from and example i found. This should work for keys 0-9 or 1-0 whatever way you want to look at it.:
VB Code:
Private Const VK_CAPITAL = &H14Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As IntegerPrivate Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer'****************************Dim keystate As Long, bb As IntegerDim Shift As Long For bb = 0 To 9 Shift = GetAsyncKeyState(vbKeyShift) keystate = GetAsyncKeyState(48 + bb) If Shift = 0 And (keystate And &H1) = &H1 Then Text1 = Text1 + Chr(48 + bb) End IfNext bb
I don't understand the "If Shift = 0 And (keystate And &H1) = &H1 Then" line.
actually just (keystate And &H1) = &H1
keystate is -32768 or -32767
&H1 what is that?
&H1 seems to always be "1"
but keystate And &H1 why would they = &H1 when &H1 is 1?
(-32768 and 1) = 1 ???? how can that be?
if u change the AND to & it runs constantly weather the key is pressed or not. (by the way that code is put in a timer.)
Does anyone know what i'm talking about?
Does -32768 get rounded to 0 or something?
Bah - Don't Understand What It's Asking For.
I found some code online that allows you to increase the brightness of a picturebox.
When I had a picturebox this worked beautifully.
For other reasons I realized instead of a picturebox I needed to use an imgbox.
Now when I try to test it I get the error "Method or data member not found.
It is referring specificly to
Code:
pixHdc = imgFile.hDC
In the code below. I don't understand what it is asking for. I am of course assuming "hDC" is not associated with an imgbox - only a picbox. So how do I change it? ARGH!
Code:
Private Sub Image6_Click()
'variables for brightness, colour calculation, positioning
Dim Brightness As Single
Dim NewColour As Long
Dim pixHdc As Long
Dim x As Long, y As Long
Dim r As Integer, g As Integer, b As Integer
'change the brightness to a percent
Brightness = CSng(Val(Text2.Text) / 100)
pixHdc = imgFile.hDC
'run a loop through the picture to change every pixel
For x = 0 To imgFile.ScaleWidth
For y = 0 To imgFile.ScaleHeight
'get the current colour value
NewColour = GetPixel(pixHdc, x, y)
'extract the R,G,B values from the long returned by GetPixel
r = (NewColour Mod 256)
b = (Int(NewColour 65536))
g = ((NewColour - (b * 65536) - r) 256)
'change the RGB settings to their appropriate brightness
r = r * Brightness
b = b * Brightness
g = g * Brightness
'make sure the new variables aren't too high or too low
If r > 255 Then r = 255
If r < 0 Then r = 0
If b > 255 Then b = 255
If b < 0 Then b = 0
If g > 255 Then g = 255
If g < 0 Then g = 0
'set the new pixel
SetPixelV pixHdc, x, y, RGB(r, g, b)
'continue through the loop
Next y
'refresh the picture box
'(a nice visual progress effect)
imgFile.Refresh
Next x
'final picture refresh
imgFile.Refresh
End Sub
I Still Dun Understand
ok. to narrow down my question. I am trying to find ports 1000-1002 to check if they have been opened or not and then close them if they are open.
i dun understand how a timer could help me with that
Who Can Understand This
Hi I'm trying to insert a Picture in the F1Book, I'm using the OBJCREATEPICTURE Method but I have troubles with "hMF" i don't know how to use it. If someone can make an example that explain more how to use it . I insert also the help of this control.
Thanx everyone
******************************************************
ObjCreatePicture Method
Member of: F1Book, F1BookView
Description
Creates a new metafile picture object on the active worksheet.
Syntax
ID = F1Book1.ObjCreatePicture nX1, nY1, nX2, nY2, hMF, nMapMode, nWndExtentX,
nWndExtentY
Part Type Description
nX1, nY1 SingleCoordinates that represent the first anchor point of the object. nX1 is measured in columns from the left edge of the worksheet; nY1 is measured in rows from the top edge of the worksheet.
nX2, nY2 SingleCoordinates that represent the second anchor point of the object. nX2 is measured in columns from the left edge of the worksheet; nY2 is measured in rows from the top edge of the worksheet.
hMF OLE_HANDLEHandle to the metafile to place in the picture object.
nMapMode Long Indicates how the metafile is mapped in the object. 7 indicates isotropic mode (keep aspect ratio); 8 is anisotropic mode (stretchable).
nWndExtentX,nWndExtentYLongDimensions of the picture.
ID Long Sets the identification number of the new picture object.
Help Me Understand
Code is linked at: http://rapidshare.de/files/14821850/Motion.rar.html
The thing is I would like to be able to add a capture module to this code with an option of taking a given number of bitmap images when motion is detected or maybe calling a capture to record in *.avi format.
Any way, the bottom line is I cant seem to be able to get the concept of how the motion is actually being compared and cant therefore grasp when motion does actually occur.
Could someone please be be kind enough to go through this code and explain to me the logic behind the comparison?
Please ignore the attention box and the fovea region; I intend to remove them prior to integrating a capture module once I have grasped the concept.
Thanks in advance
sarah
Just Trying To Understand
You can see I'm quite new to this. VB5. Trying to play a sound using
embedding. So I put an OLE control in the form and created an object from
file. Here's the code hoping to produce an exe for use in another pc:
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal
lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
' .................................................. ..........
Private Sub Command1_Click()
PlaySound "c:windowsmediamicrosoft office 2000gunshot.wav", 0, 0
End Sub
When I run the exe on the other pc (which doesn't have the file), silence -
just
a message saying "unable to access source document".
Then I added another line:
Private Sub Command1_Click()
OLE1.CreateEmbed "c:windowsmediamicrosoft office 2000gunshot.wav"
PlaySound "c:windowsmediamicrosoft office 2000gunshot.wav", 0, 0
End Sub
Still nothing. I'm doing my nut over this. Where am I going wrong? Any help
appreciated. BTW both versions work on a pc containing the required wav
file.
steve
Something Not So Understand...
Dear all,
Please refer to the red color code... For the 1st of coding, when the system run until the red color code, it will auto pop up the error message, "
i dont understand for the first part of coding, why after i change the position of the "OracleCall=''" and "OracleOn.Close"... then, it can works... and now, i change back to the original lines, then, it also can work, can i know what is the reason...? Please help me, i really dont understand... and i cannot find more information from the internet...
Code: Set OracleOn = CreateObject("ADODB.Connection")
OracleOn.ConnectionString = OraclePath
max = 2
OracleOn.Open
For ii = 1 To max
OracleCall = "INSERT INTO TraceInfo(PlanID, ProgressID, Serial, PassTime, MCName, Goh) " _
& "VALUES ('" & CLJSID & "', '" & CLKOIS & "', '" & CLSerial(ii) & "', '" & CLTime(ii) & "','NA','NA') "
OracleConn.Open OracleCall, OracleOn, adOpenStatic, adLockReadOnly
Next ii
OracleCall = ""
OracleOn.Close
Code: Set OracleOn = CreateObject("ADODB.Connection")
OracleOn.ConnectionString = OraclePath
max = 2
OracleOn.Open
For ii = 1 To max
OracleCall = "INSERT INTO TraceInfo(PlanID, ProgressID, Serial, PassTime, MCName, Goh) " _
& "VALUES ('" & CLJSID & "', '" & CLKOIS & "', '" & CLSerial(ii) & "', '" & CLTime(ii) & "','NA','NA') "
OracleConn.Open OracleCall, OracleOn, adOpenStatic, adLockReadOnly
Next ii
OracleOn.Close
OracleCall = ""
Many Thanks....
Don't Understand
This is what i don't understand
In the subform I scroll to the data i want example record 1
but when i press the button to popup the same subform
the record did not appear the same.
It still remian at record 1
No Understand The Use...
i have dowloaded this file, but have a questions:
1) it really convert access mdb in sql mdb?
2) if yes, where is located the new sql database, is saved in dir DATA of Sql dir?
I have set test.mdb for conversion, set the name of server, but after the convrsion in wich dir i can see the new sql database???
I dont find nothing!
http://www.mytempdir.com/808160
note: newbie:-)
Help Me Understand
Code: Set rs = New ADODB.Recordset
Set cmd = New ADODB.Command
Set cmd.ActiveConnection = gMyConn
cmd.CommandTimeout = 10
cmd.CommandText = "sp_UserLogin_PH3"
cmd.CommandType = adCmdStoredProc
cmd(0).Direction = adParamReturnValue
cmd(1) = txtUID
cmd(2) = txtPWD
cmd(3) = "3"
Set rs = cmd.Execute
If Not rs.EOF Then
If rs!usr_remarks <> "" Or Not IsNull(rs!usr_remarks) Then 'jane 04012004
MsgBox "User is not allowed to login. User has been marked deleted!", vbOKOnly + vbInformation, Me.Caption 'jane 04012004
Me.MousePointer = 0 'jane 04012004
txtPWD = "" 'jane 04012004
txtUID = "" 'jane 04012004
txtUID.SetFocus 'jane 04012004
Exit Sub
End If
what's usually the purpose of CommandTimeout ?
what's all these for?
cmd.CommandTimeout = 10
cmd.CommandText = "sp_UserLogin_PH3"
cmd.CommandType = adCmdStoredProc
cmd(0).Direction = adParamReturnValue
what does dis line mean? what's the "!" after "rs" for?
If rs!usr_remarks <> "" Or Not IsNull(rs!usr_remarks)
PLEASE Help I Must Not Understand!!!
I want a form that allows the user to be able to put the id# of a record in 1 text box and have the rest of the record appear in the rest of the form text boxes. I would like to use either an excel table or a access data base. PLEASE Help.
Don't Understand This Error
I have a dialog where I can select any mapped drive (not file) or directories on those drives. Using the resulting directory from the select, I pass the directory along to the routine below that spiders from the selected drive or directory. If I select a directory (or subdirectories) on any mapped drive, this routine works great. When I select the Root Directory (for example R:) it runs for a bit and errors out with a Run-time error '52': "Bad file name or number". When I go into debug, the line: s = Dir$(currdir, vbDirectory) is highlighted and (for example) s = "", currdir = "R:Sarbanes 2004" (or whatever) and vbDirectory = 16. The initial string passed to StartDir in this routine was "R:". I notice no matter what root drive I choose, vbDirectory will always = 16 and s will always = "" when it errors. currdir, of course, is whatever directory it was spidering when it errored out. It is important that I be able to spider from the root directory. Any help on getting rid of this error is greatly appreciated. P.S. The spidering routine here is from a posting here and it really works nice for what I am doing except in the case of the root directory. Thank you.
Joe
Code:
Private Sub DirSearchA(ByVal StartDir As String)
If Right(txtServerA.Text, 4) = ".sna" Then Exit Sub
Dim s As String
Dim currdir As String
Dim dirlist As New Collection
If Right$(StartDir, 1) <> "" Then StartDir = StartDir & ""
dirlist.Add StartDir
While dirlist.Count
currdir = dirlist.Item(1)
dirlist.Remove 1
s = Dir$(currdir, vbDirectory)
While Len(s)
If (s <> ".") And (s <> "..") Then
If GetAttr(currdir & s) = vbDirectory Then
dirlist.Add currdir & s & ""
Else
Open App.Path & "ServerAtmp.txt" For Append As #1
Write #1, s;
Write #1, currdir;
Write #1, FileLen(currdir & s)
Close #1
End If
End If
s = Dir$
Wend
Wend
lblStatus = "Status: Idle."
End Sub
Will I Ever Understand A Matrix?
I have come a long way in the past two weeks doing matrix math but for the last three days I have been trying to place a model and the camera at the same postion and orientation.
As I move around I see the model that is supposed to be me (the camera) on the opposite site of the 0,0,0 point. Kinda of like an out of body experience. I was sure I rotated wrong or postioned wrong so I kept working at it.
My last experiment finally did me in. I knew I was passing the same exact X,Y,Z and roation values and doing the matrix math the same so I tried using the same EXACT matrix for the camera as I did for the object and still they do not appear in the same place. This is nuts.
I believe I understand how to place objects in space now but do you use a matrix differently to place a camera?
Even if you can't help thanks for taking the time to read my post.
Can VB Understand Unicode???
I am building an XML sheet from a macro. Some of the contents are greek characters like beta and fi. When the macro is ran, those characters are replaced with question marks.
The code below is attempting to search and replace using uncode.
Q: How can VB understand what the original character is so that I can replace it? The trouble is that this VB macro can not understand the original text (basically eliminating any chance for a search/replace).
Any help from the experts is greatly appreciated.
How Understand The Refence Box In Vb 6.0?
Hello everyone
Time ago, i made a programm in vb 6.0. All ok, but 2 days ago i found out a virus in my computer , and so, i decided format the hard disk. But when i installed all again and i try to run my programm, appears an error "no reference to project or library found". Looking at the help at msdn, this shows tips about missing refrences in refernces box, but my project doesn't show some like that. In other words, if my program needs any lybrary or other thing, How can i know what would it be?. my project uses Ole connection to automatized excel, graphics in excel, and simple maths and calculus.
Any help would be very appreciated
Thanks in advance
Still Trying To Understand Textboxes ...
Hi, I'm very new to VB, and I'm trying to do a pretty simple system to calculate transport routes. Right now, I'm stuck just trying to verify the input from the user. My code is below.
The thing is when I run it, it keeps showing me the '"Please only enter points from the list."' part everytime I key a single letter in the text boxes (which are AnsFrom and AnsTo). How do I get it to wait & read the whole string first ??
Also am I correct in trying to go a different form once the user clicks OK (the form is called GetSolutn, as from the bottom)? Is that the right way to do it?
Code:
Public Sub Form_Load()
End Sub
Private Sub AnsFrom_Change()
Dim AnsFrom As String
If AnsFrom = "Airport" Then
MsgBox "OK"
ElseIf AnsFrom <> "Airport" Then
MsgBox "Please only enter points from the list."
End If
End Sub
Private Sub AnsTo_Change()
Dim AnsTo As String
If AnsTo = "Church" Then
MsgBox "OK"
ElseIf AnsTo <> "Church" Then
MsgBox "Please only enter points from the list."
End If
End Sub
Private Sub cmdOK_Click()
GetSolutn.Show
End Sub
Need Help To Understand How To Parse In Vb6
I am totally lost when it comes to parsing text. Can some one show me a few good tutorials or explain it in terms a old man can understand LOL. What I need to do is parse this information below
button1:Canon EOS 5::button2:Apple Ipod::button3:Nikon DC70::button4:0::button5:0::button6:0::button7:0::button8:0
Lets say I have 8 command buttons called command1, command2 and so on. I need command1.Caption=Cannon EOS 5, command2.Caption=Apple Ipod and so on.
The problem is I don't know how to parse out the information behind the :
Thanks,
Robert
Error That I Cannot Understand
Any idea why this code is giving me an error?
Code:
Global Selection() As Appt
Type Appt
Id As Integer
CustomerID As Integer
Date As Date
Time As Date
Length As Integer 'in mins
End Type
imgIcon.Visible = True
ReDim Preserve Selection(UBound(Selection) + 1) 'Error on this line "Script out of range"
With Selection(UBound(Selection))
.Id = frmClient.lstServices.SelectedItem.Tag
.CustomerID = frmClient.txtId.Text
.Date = frmClient.lstServices.SelectedItem.ListSubItems(1).Text
.Time = frmClient.lstServices.SelectedItem.ListSubItems(2).Text
.Length = Left(frmClient.lstServices.SelectedItem.ListSubItems(3).Text, Len(frmClient.lstServices.SelectedItem.ListSubItems(3).Text) - 4)
End With
Something I Dont Understand
THis is really funny to me, i got one field which may have Null content, when i run the following 2 set of code, which i think are the same, gives me different result, this first set of code result in error : invalid use of null...i don't understand why
If Trim(SelectNewReferrerMd5RS.Fields.Item(1)) = "" Then
NewReferrer = ""
Else
NewReferrer = Trim(SelectNewReferrerMd5RS.Fields.Item(1))
End If
If Not Trim(SelectNewReferrerMd5RS.Fields.Item(1)) = "" Then
NewReferrer = Trim(SelectNewReferrerMd5RS.Fields.Item(1))
Else
NewReferrer = ""
End If
Help Me Understand Arrays
I am not sure I understand arrays. I mean I understand what they are but how you set one up and how you read from it is a little confusing.
So i can set up an array by declaring the variable
MultTable() ? This is ofcourse if I dont know the parameters of the array.
Then to read from the array I say
ex.
if MultTable(R,2) > 170
some statement.
I mean is this right? I just dont know!
Trying To Understand This Code..
I am writing an application that reads data from com-port and I am succesful with that but not yet succesful in understanding the read data.
Here is a piece of the old versions (VB v3.x) source code:
Code:
Sub ShowValue (t As Integer, s As String) 's = the input data
Dim ByteLSB, ByteMSB As Integer
Dim StrLSB, StrMSB As String
For i = 1 To Len(s)
ByteString(i) = Mid$(s, i, 1)
Next i
If t < 7 Then
ByteMSB = 4 * (Asc(ByteString(2)) And &H3F) + (Asc(ByteString(3)) And &H60) / 32
ByteLSB = 2 * (Asc(ByteString(1)) And &H7F) + (Asc(ByteString(2)) And &H40) / 64
If ByteMSB < 16 Then StrMSB = "0" Else StrMSB = ""
If ByteLSB < 16 Then StrLSB = "0" Else StrLSB = ""
LblValue(t).Caption = CInt("&H" & StrMSB & Hex$(ByteMSB) & StrLSB & Hex$(ByteLSB))
Exit Sub
Else
' **** DDM
ByteMSB = 4 * (Asc(ByteString(2)) And &H3F) + (Asc(ByteString(3)) And &H60) / 32
ByteLSB = 2 * (Asc(ByteString(1)) And &H7F) + (Asc(ByteString(2)) And &H40) / 64
If ByteMSB < 16 Then StrMSB = "0" Else StrMSB = ""
If ByteLSB < 16 Then StrLSB = "0" Else StrLSB = ""
LblValue(0).Caption = CInt("&H" & StrMSB & Hex$(ByteMSB) & StrLSB & Hex$(ByteLSB))
End If
' **** SDM
ByteMSB = 16 * (Asc(ByteString(4)) And &HF) + (Asc(ByteString(5)) And &H78) / 8
ByteLSB = 8 * (Asc(ByteString(3)) And &H1F) + (Asc(ByteString(4)) And &H70) / 16
If ByteMSB < 16 Then StrMSB = "0" Else StrMSB = ""
If ByteLSB < 16 Then StrLSB = "0" Else StrLSB = ""
LblValue(1).Caption = CInt("&H" & StrMSB & Hex$(ByteMSB) & StrLSB & Hex$(ByteLSB))
' **** RF
ByteMSB = 64 * (Asc(ByteString(6)) And &H3) + (Asc(ByteString(7)) And &H7E) / 2
ByteLSB = 32 * (Asc(ByteString(5)) And &H7) + (Asc(ByteString(6)) And &H7C) / 4
If ByteMSB < 16 Then StrMSB = "0" Else StrMSB = ""
If ByteLSB < 16 Then StrLSB = "0" Else StrLSB = ""
LblValue(2).Caption = CInt("&H" & StrMSB & Hex$(ByteMSB) & StrLSB & Hex$(ByteLSB))
If t = 7 Then Exit Sub
' ********** t= &H24
' **** M150
ByteMSB = 2 * (Asc(ByteString(9)) And &H7F) + (Asc(ByteString(10)) And &H40) / 64
ByteLSB = 128 * (Asc(ByteString(7)) And &H1) + (Asc(ByteString(8)) And &H7F)
If ByteMSB < 16 Then StrMSB = "0" Else StrMSB = ""
If ByteLSB < 16 Then StrLSB = "0" Else StrLSB = ""
LblValue(3).Caption = CInt("&H" & StrMSB & Hex$(ByteMSB) & StrLSB & Hex$(ByteLSB))
' **** M90
ByteMSB = 8 * (Asc(ByteString(11)) And &H1F) + (Asc(ByteString(12)) And &H70) / 16
ByteLSB = 4 * (Asc(ByteString(10)) And &H3F) + (Asc(ByteString(11)) And &H60) / 32
If ByteMSB < 16 Then StrMSB = "0" Else StrMSB = ""
If ByteLSB < 16 Then StrLSB = "0" Else StrLSB = ""
LblValue(4).Caption = CInt("&H" & StrMSB & Hex$(ByteMSB) & StrLSB & Hex$(ByteLSB))
' **** IDENT
ByteMSB = 32 * (Asc(ByteString(13)) And &H7) + (Asc(ByteString(14)) And &H7C) / 4
ByteLSB = 16 * (Asc(ByteString(12)) And &HF) + (Asc(ByteString(13)) And &H78) / 8
If ByteMSB < 16 Then StrMSB = "0" Else StrMSB = ""
If ByteLSB < 16 Then StrLSB = "0" Else StrLSB = ""
LblValue(5).Caption = CInt("&H" & StrMSB & Hex$(ByteMSB) & StrLSB & Hex$(ByteLSB))
' **** BATTERY
ByteMSB = 128 * (Asc(ByteString(16)) And &H1) + (Asc(ByteString(16)) And &H7F)
ByteLSB = 64 * (Asc(ByteString(14)) And &H3) + (Asc(ByteString(15)) And &H7E) / 2
If ByteMSB < 16 Then StrMSB = "0" Else StrMSB = ""
If ByteLSB < 16 Then StrLSB = "0" Else StrLSB = ""
LblValue(6).Caption = CInt("&H" & StrMSB & Hex$(ByteMSB) & StrLSB & Hex$(ByteLSB))
End Sub
The inputstring contains 16 bytes. Each value for DDM,SDM,RF.. are coded in 2 bytes.. at start there are 3 bytes that are not calculated here.
In that part the real values of the data are calculated and displayed in labels. I don't really know if it even works ok.
That looks so messy to me and it is a very bad example how to write a code. (ByteMSB As Integer and no commenting of whats going on).
I hope some one has the eye to tell whats going on?
What does this do, specially that And &H3 ? Asc(ByteString(14)) And &H3
Thanks for your time.
Something I Dont Understand
im having a problem with mask and bitblt. im having an error "sub or function..." something like that. heres the code
Code:
Option Explicit
'something important that i couldnt understand >_<
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, _
ByVal X As Long, ByVal y As Long, ByVal nWidth As Long, _
ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, _
ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Const TILESIZE As Integer = 16
Private MYx As Currency, MYy As Currency
Private MapArray(0 To 9, 0 To 9) As Integer
Const MoveIncrement = 8
Private Sub Form_Activate()
Dim I As Integer, J As Integer
For J = 0 To 9
For I = 0 To 9 'tis one is causing me headaches
BitBlt Me.hDC, TILESIZE * I, TILESIZE * J, TILESIZE, TILESIZE, TileBox(MapArray(I, J)).hDC, 0, 0, vbSrcCopy
Next
Next
BitBlt Me.hDC, TILESIZE * MYx, TILESIZE * MYy, TILESIZE, PicMask.hDC, 0, 0, vbSrcAnd
BitBlt Me.hDC, TILESIZE * MYx, TILESIZE * MYy, TILESIZE, Picture1.hDC, 0, 0, vbSrcPaint
Me.Refresh
End Sub
or did i forget to put something?
Cant Understand Code
I have this hypothetical language, but i cant understand what role COUNT has in it.
PROCESS UseSprinklers[Watering,TimeOn,TimeOff]
## Turn the sprinklers on
WHEN TimeOn > CurrentTime AND Watering=False
Watering=True
COUNT Index[1-10]
Spinkler[Index]=True
## Turn the sprinklers off
WHEN TimeOFF > CurrentTime and Watering=True
Watering=False
COUNT Index[1-10]
Sprinkler[Index]=False
RETURN
I need to figure out what processing is taking place. Obviously "When the time that the sprinkler is set to turn on is later than the current time and the watering system is set to off, then the watering system is tuned on." but i have no idea what count does? Any takers?
Also how would i write a decision statement in this language? I know how to do iteration (duh!) but not decision.
TIA
|