|
I have developed a very simple d3dim object creating and picking routine working quite well. On the other hand, rotation and translation do not work together.On either of them the object starts from different locations.
if u can help me please contact and i'll send my little code to you as well.
Thanks
|
|
|
|
|
I am searching for insight on the relative benefits / downsides to using the "As Any" data type in VB.
My assumption is that CPU cycles are taken in order to resolve the data types at runtime vs.
the use of a stronger type declaration, but I have no numbers telling me that is the case.
Any insight appreciated
Mike
|
|
|
|
|
API calls probably don't go much faster when stronly typed.... but,
API calls ALWAYS crash if you do it wrong, so strong typing is much better but not because of speed.
|
|
|
|
|
I am searching for insight on the relative benefits / downsides to using the "As Any" data type in VB. My assumption is that CPU cycles are taken in order to resolve the data types at runtime vs. the use of a stronger type declaration, but I have no numbers telling me that is the case. Any insight appreciated
Au contraire. VB will do no type checking on an "As Any" variable (although it still needs to figure out what it's passing in order to know how to pass it). I don't think you need to worry about CPU cycles here. It's better to worry about how "As Any" will impact your code readability. If you have an API that takes one or more "As Any" arguments, is it always clear what, how and why you are passing what you're passing?
As Any is mainly useful for APIs with arguments like lParam in SendMessage that can be basically anything. Always strong type if you can, but avoid the "multiple overloads" mess for an API (like so many people do with SendMessage).
___________
Klaus
[www.vbbox.com]
|
|
|
|
|
Hi all,
I am looking for a way to import a C++ class (exported from a DLL) in a VB or VBA project. I know how to work with "declare" for exported functions and with COM but the requirement I have is for a C++ class.
Thanks in advance!!!!!!!!
Alberto Gattegno
Software Engineer
http://www.itginc.com
|
|
|
|
|
Sorry, but I don't think this is possible (there might be some obscure trick...). You should probably write a COM wrapper after all.
--------------
"Fabricati Diem, Pvnk"
|
|
|
|
|
Not possible. In order for VB to understand a "class" it must be a COM object. VB has no idea what a straight C++ class is.
___________
Klaus
[www.vbbox.com]
|
|
|
|
|
I need to draw a Equilateral triangle, and also rotate it and bounce it off the screen, i have seem this done before, but i dont know ehere to start,
any help in pointing me in the right direction, and any code samples would be nice
Thanx
Matt
|
|
|
|
|
I don't have time to do the details... but,
to give you a clue: What you need to do is host the directx7 library by making a 'reference (via the object browser) first, even though the machines use DX8 'cause thats where direct draw is, OK?
In your code you'll have to:
option explicit
Private MyDX7 as NEW vbDXlib.DirectX7
Private MyDirectDraw as vbDXlib.DirectDraw7
sub Form1_OnLoad()
set MyDirectDraw = MyDX7.DreateDirectDraw7
yadda...yadda..yadda...
the trick is that DX7 HAS to be created 'as new'
THEN you get DirectDraw (in-directly) which you then use some UserDefinedTypes (UDT's) to initialize a 'primary_surface' and the 1st 'offscreen_surface'. All this just to get a page flippin scheme so your stuff draws REAL_FAST... before you call your bitmap (of any shape you desire) into a 2nd 'offscreen_surface' using:
MyDirectDraw.CreateSurfaceFromFile(bla,bla,bla)
-which is a holder in memory for your 'sprite' as some call would say. You then use DirectDraw's
super cool graphics methods to paint rotated versions of the sprite (to the current degree) on a 4th 'offscreen_surface' before dumping that 4th surface to the 1st 'offscreen' surface, so that the picture will be there when the 'Form1_repaint' is called by the Operating_Sys or your animating timer control's ticker event.... Get the DirectX8 sdk and look at the vb-Billboard sample. Really, it shows you exactly what you are trying to do 'cept they made their whirly-gig go in a circle. You'll have to do the bouncing yourself, but the hard parts will be taken care of. You'll be pleasently supprised with the performance, even on a 200mmx or so you could get >45 fps especially if you have a flat color (black?) background so you don't have to clip.
PS: Try using this basic structure for gradient backgrounds, use a 128x128 bitmap created in say... ulead photoImpact's magic gradient (they have a 30 day demo for free) or other graphics package. That size is great 'cause you won't see ANY pixel lines even when the form streches it full screen, unlike the windows desktop... and it re-paints faster than you can do a loop! »geeky ain't I...
CodeCrafty®
nauhaus@swbell.net
|
|
|
|
|
Want something fast mail me(cemkalyoncu@yahoo.com). DirectX has too many depencies but if you use GDI effectively you will increase speed(setdibits API ).
|
|
|
|
|
"As New" has no speed benefit and it can actually be dangerous in some cases. Declaring the variable and then using "Set x = New Y" is exactly the same thing and is a better coding practice.
What you're trying to explain here (I think) is that late binding (Dim x As Object) is far slower than early binding or semi-late binding.
___________
Klaus
[www.vbbox.com]
|
|
|
|
|
We're loading some additional ActiveX references into our project, but it's causing 429 errors in other ActiveX objects (like grid controls) that have previously worked just fine. The VB Run-time environment won't run, and forget trying to compile anything.
We've tried moving the priority of the references up and down, but that doesn't help, except we uncovered a DAO 3.5/ADO 2.0 conflict. Any suggestions?
Austin Jones
apjones@up.com
|
|
|
|
|
Hi,
Can any one tell me some good testing tools for VB COM?
Also, can one please elaborate where can the pitfalls in a VB COM be?
Also can one one send me a sample code in which there is a memory leak in VB? (ie how to create a memory leak in VB programme)
Thanx in advance,
Regards,
~A.
|
|
|
|
|
I would like to know whether VB5.0 supports DAO? Also I need to read more than 10,000 records from a file and hence manipulate it.Which is the best method of read available with VB 5.0?If i go for binary read, i need to use the OPEN method and if it is text read can i go for Filesystemobject?
If it is a text read, which will give more performance, FSO or the open method?
I am using a number of collections and classes in my application.Will it affect the performance?
Can i be able to increase the performance by using DAO recordsets instead of Collections?
Please give me a reply
Thanks,
Sripriya
|
|
|
|
|
Hi
1) Yes DAO is available in VB 5 . ofcorse in VB 4 , DAO was the prefered way of working with databases . but why not to consider ADO which is also avaialbe under VB 5
2) I add another method , text file access as a OLEDB data source . it is a very convinient task using DAO . you will have all the luxery of ADO and Recordset in your program without a single line of code . I think it is more important to considet parsing speed of your file ( spliting in collections , sorting , ... ) than just reading speed . using ADO you can use ADODB::Recordset as a collection with sorting/parsing/searching capabilities . there is a great article on this topic in MSDN .
3) using VB code for parsing , searching or sorting is not as fast as you might desire . besides you have to do it all in your code .
4) Using DAO recordsets is a good choice too . but again you have to read the text file and parse as different fields , then write into recordset . use ADODB::Recordet to eliminate all these steps .
I hope it would be of help
|
|
|
|
|
Hi!
i want to create an offline e-book on cdrom...
is there a possibility, to start the MS IE customized (e.g. without menubar, locationbar, satusbar, ...)? JavaScript's window.open() does it, yes, but the browser-window, that initiated the window.open() function, will not self.close() without asking the user to do so..
so i am looking for a possibility to start IE customized??
thx
|
|
|
|
|
Check out the "Kiosk" mode of IE. It will probably do what you want.
|
|
|
|
|
Does anybody know how I'd get this to work?
I'd like to sort my spreadsheet so that I have duplicates one above the other (there will be two or more) I'd like to get it to do a calculation on a field where a cell has th sme account no. Something like
if ActiveSheet.Cells(1,4).Value = ActiveSheet.CElls(1,7).Value Then
ActiveSheet.Cells(1,7).Value = ((ActiveSheet.Cells(1,5).Value)-(ActiveSheet.Cells(2,5).Value ))
ActiveSheetRows(x).Delete End If
So if there are two rows with the same account no it will calc the contents. Id theres three it wil calc the three etc. Then it will delete all but the row with the answer in. Then move on to the next rows in the sheet and carry on from there.
Anyone have an inkling?
I can get it to look at a single rows values and set a format then delete all rows without the format but this isn't what I need:
'Write formula to first cell
Sheets(UserInput).Select
Worksheets(UserInput).Range("L1").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-2]>=RC[-1],0)"
Worksheets(UserInput).Range("L1").Select
'Copy the formula onto all cells
Selection.AutoFill Destination:=Worksheets(UserInput).Range("L1:L4000"), Type:=xlFillDefault
Range("L1:L4000").Select
Worksheets(UserInput).Range("L1").Select
'Find all rows where 0 has been set and delete them
num = 0
Do
Worksheets(UserInput).Columns("L:L").Select
On Error Resume Next
Selection.Find(What:="0", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False) _
.Activate
If Err.Number = 91 Then
End
Else
RowNo = ActiveCell.Row
Worksheets(UserInput).Rows(RowNo).Delete
End If
num = num + 1
Loop Until num = 3000
Please help
|
|
|
|
|
Hi,
I am using input boxes to enter data into a spreadsheet. But my problem is that if the user makes an error then they can't go back. This is partly because after the user has input the data my code puts their data into variable and then does various calculations with it before putting the result into defined cells.
Does anyone know how I could put in a user update if they right click the cell where they have made an error? The new data would then have to be refrshed through the rest of the code. Heres an example of some of the code
Private Sub Workbook_Open()
Dim mydate As Date
Dim baldate As Date
Dim duedate As Date
Dim todate As Date
Dim TheDate As Date ' Declare variables.
Dim Msg
Dim hey
Dim Ms
Dim instal
Dim instmon
Dim mon
mydate = Date
ActiveSheet.Cells(15, 1).Value = mydate
rentac = Application.InputBox(Prompt:="Enter rent account number", Default:="1234567", Type:=1)
tenant = Application.InputBox(Prompt:="Enter name of tenant", Default:="Tenant", Type:=2)
adda = Application.InputBox(Prompt:="Enter house no and street, eg 1 Walnut Street", Default:="1 Walnut Street", Type:=2)
addb = Application.InputBox(Prompt:="Enter name of Town, eg Prudhoe", Default:="Prudhoe", Type:=2)
AddEx = Application.InputBox(Prompt:="Enter additional address lines, eg Hexham", Default:="Prudhoe", Type:=2)
addc = Application.InputBox(Prompt:="Enter name of County, eg Northumberland", Default:="Northumberland", Type:=2)
addd = Application.InputBox(Prompt:="Enter postcode, eg NE42 123", Default:="NE42 123")
bal = Application.InputBox(Prompt:="Enter opening balance", Default:="100.0", Type:=1)
baldate = Application.InputBox(Prompt:="Enter date at which balance applies", Default:="17-06-01", Type:=1)
duedate = Application.InputBox(Prompt:="Enter first charge date eg usually Monday coming ", Default:="18-06-01", Type:=1)
todate = Application.InputBox(Prompt:="Enter last charge date if different from end of year ", Default:="31-03-02", Type:=1)
rent = Application.InputBox(Prompt:="Enter weekly rent", Default:="45.00", Type:=1)
ActiveSheet.Cells(13, 1).Value = "Ref" & rentac
ActiveSheet.Cells(81, 2).Value = rentac
ActiveSheet.Cells(17, 1).Value = "Dear " & tenant
ActiveSheet.Cells(51, 1).Value = tenant
ActiveSheet.Cells(52, 1).Value = adda
ActiveSheet.Cells(53, 1).Value = addb
ActiveSheet.Cells(54, 1).Value = AddEx
ActiveSheet.Cells(55, 1).Value = addc
ActiveSheet.Cells(56, 1).Value = addd
ActiveSheet.Cells(25, 2).Value = baldate
ActiveSheet.Cells(25, 8).Value = bal
ActiveSheet.Cells(27, 2).Value = duedate
ActiveSheet.Cells(27, 4).Value = todate
ActiveSheet.Cells(27, 7).Value = rent
fred = DateDiff("w", duedate, todate)
ActiveSheet.Cells(27, 5).Value = fred + 1
eric = DateDiff("m", duedate, todate)
'ActiveSheet.Cells(27, 9).Value = eric + 1
Dim boolCanExit As Boolean
Do
boolCanExit = True ' will always exit unless the user enters incorrect value
freq = Application.InputBox(Prompt:="Would you like the standing order paid monthly or weekly?", Default:="monthly", Type:=2)
TheDate = Date
Msg = DatePart("m", TheDate) ' Msg now equals the number current month number
dayDate = Date
Ms = DatePart("d", dayDate) 'Ms now equals the current day number
If freq = "monthly" Then
If Ms >= 8 Then
eric = eric - 1
End If
'the annual charge
wop = ActiveSheet.Cells(29, 8).Value
'the annual charge divided by how many periods are left
jazz = wop / (eric + 1)
'the rounded figure
ollie = (Round(jazz, 2) + 0.01)
'the two multiplied together which gets you within pennies of the right fig
thomas = ollie * (eric + 1)
remfig = (thomas - wop) 'the odd fig
dick = ollie - remfig
ActiveSheet.Cells(31, 1).Value = "Less 1 payment @"
ActiveSheet.Cells(31, 2).Value = dick
ActiveSheet.Cells(32, 1).Value = (("Less " & eric) & " payments @")
ActiveSheet.Cells(32, 2).Value = ollie
ActiveSheet.Cells(32, 8).Value = eric * ollie
'this bit sets the payment date code
If Ms >= 8 Then
Msg = Msg + 1
End If
instal = 15 & "th "
If Msg = 1 Then
mon = "January"
End If
If Msg = 2 Then
mon = "February"
End If
If Msg = 3 Then
mon = "March"
End If
If Msg = 4 Then
mon = "April"
End If
If Msg = 5 Then
mon = "May"
End If
If Msg = 6 Then
mon = "June"
End If
If Msg = 7 Then
mon = "July"
End If
If Msg = 8 Then
mon = "August"
End If
If Msg = 9 Then
mon = "September"
End If
If Msg = 10 Then
mon = "October"
End If
If Msg = 11 Then
mon = "November"
End If
If Msg = 12 Then
mon = "December"
End If
ActiveSheet.Cells(87, 3).Value = instal & mon
Msg = Msg + 1
If Msg = 1 Then
mon = "January"
End If
If Msg = 2 Then
mon = "February"
End If
If Msg = 3 Then
mon = "March"
End If
If Msg = 4 Then
mon = "April"
End If
If Msg = 5 Then
mon = "May"
End If
If Msg = 6 Then
mon = "June"
End If
If Msg = 7 Then
mon = "July"
End If
If Msg = 8 Then
mon = "August"
End If
If Msg = 9 Then
mon = "September"
End If
If Msg = 10 Then
mon = "October"
End If
If Msg = 11 Then
mon = "November"
End If
If Msg = 12 Then
mon = "December"
End If
ActiveSheet.Cells(88, 3).Value = instal & mon
ActiveSheet.Cells(88, 4).Value = "monthly"
ActiveSheet.Cells(89, 3).Value = "15-03-02"
Else
If freq = "weekly" Then
Dim i As Integer
Dim datTemp As Date
For i = 1 To 7
datTemp = DateAdd("d", i, Date)
If Weekday(datTemp) = vbMonday Then
ActiveSheet.Cells(87, 3).Value = datTemp
ActiveSheet.Cells(88, 4).Value = "weekly"
ActiveSheet.Cells(89, 3).Value = "25-03-02"
'MsgBox "Next Monday will be " & datTemp
End If
Next
Dim datnex As Date
Dim dated As Date
dated = datTemp
For i = 1 To 7
datnex = DateAdd("d", i, dated)
If Weekday(datnex) = vbMonday Then
ActiveSheet.Cells(88, 3).Value = datnex
'MsgBox "Next Monday will be " & datnex
End If
Next
Dim derrick
derrick = DateDiff("w", datTemp, todate)
'ActiveSheet.Cells(31, 2).Value = (ActiveSheet.Cells(29, 8).Value) / (derrick + 1)
' ActiveSheet.Cells(31, 1).Value = (("Less " & derrick + 1) & " payments @")
'ActiveSheet.Cells(31, 8).Value = (ActiveSheet.Cells(31, 2).Value) * (derrick + 1)
'the annual charge
wop = ActiveSheet.Cells(29, 8).Value
'the annual charge divided by how many periods are left
jazz = wop / (derrick + 1)
'the rounded figure
ollie = (Round(jazz, 2) + 0.01)
'the two multiplied together which gets you within pennies of the right fig
thomas = ollie * (derrick + 1)
remfig = (thomas - wop) 'the odd fig
dick = ollie - remfig
ActiveSheet.Cells(31, 1).Value = "Less 1 payment @"
ActiveSheet.Cells(31, 2).Value = dick
ActiveSheet.Cells(32, 1).Value = (("Less " & derrick) & " payments @")
ActiveSheet.Cells(32, 2).Value = ollie
ActiveSheet.Cells(32, 8).Value = derrick * ollie
Else: MsgBox "Error you have not entered a relevant frequency Please enter monthly or weekly"
boolCanExit = False
End If
End If
Loop Until boolCanExit = True
End Sub
Many thanks
|
|
|
|
|
i'm looking for a vba code for send mail with attach
|
|
|
|
|
I am looking for an editor for VB that would replace the existing clunky one. Ideally this editor would store bookmarks and have more advanced search capabilities.
|
|
|
|
|
The problem is that it would be a real pain to reproduce the behaviors of the dropdowns n' such...
However it wouldn't be hard for you to code an ad-in thing-IE (pun intended) to handle that as a floating_window/toolbar/menu using a custom CommandBar or two... perhaps also utilizing the WebBrowser control. The key is to check out what you get a grip on when you create a new 'add-in' project, by looking in the object browser.
CodeCrafty®
nauhaus@swbell.net
|
|
|
|
|
Can anybody give me some sample coding in VB6 to get the row number of a selected row in a DBGrid.
|
|
|
|
|
How do I determine how many pages in a tif image file.
|
|
|
|
|
hi!
I want someone who'll help me with a pivot table and pivot chart in vb
when i'll press double click on the chart i'll get then next level from the coulmn in the pivot.
thanks!
|
|
|
|
|