|
AFAIK you'll have to create your own copy contstructor. If you simply do a Object1 = Object2, VB will use a default property for the object.
To illustrate this point, create a blank form and place two frames on it and two command buttons. For the Command2 set the CausesValidation property to False (default is True). Run the following code...
<br />
Private Sub Form_Load()<br />
<br />
Frame1 = Frame2<br />
Command1 = Command2<br />
<br />
MsgBox Command1<br />
<br />
End Sub<br />
Notice the second frame now has the caption of the first. The first command button now has CausesValidation set to false, as shown by the message box.
Hope this helps.
Jeremy L. Falcon
"The One Who Said, 'The One Who Said...'"
|
|
|
|
|
Jeremy Falcon wrote:
AFAIK you'll have to create your own copy contstructor. If you simply do a Object1 = Object2, VB will use a default property for the object.
Actually VB will not do anything. There's no such thing as a deep copy in COM (which is what VB classes are). It will only do an QueryInterface() (if necessary) call and then AddRef().
___________
Klaus
[www.vbbox.com]
|
|
|
|
|
Borrowing heavily from Nick Hodapp's original C code:
LRESULT CALLBACK FindToolbarProc(int nCode, WPARAM wParam, LPARAM lParam)
{
// watch window creation:
if (nCode == HCBT_CREATEWND)
{
CBT_CREATEWND* pcw = (CBT_CREATEWND*)lParam;
// watch for toolbar creation, set toolbar name
if (pcw->lpcs->lpszName && 0 != strstr(pcw->lpcs->lpszName, "Toolbar"))
{
strcpy((char*)pcw->lpcs->lpszName, "NukeNCB");
}
}
return CallNextHookEx(g_hkCBT, nCode, wParam, lParam);
}
I was hoping to translate this into a VB hook... this is what I have so far...
Public Function FindToolbarProc(ByVal ncode As Integer, ByVal wParam As Long, ByVal lParam As Long) As Long
Dim tCREATESTRUCT As CREATESTRUCT
Dim tCBT_CREATEWND As CBT_CREATEWND
Dim ptr As Long
Dim sStr As String * 8
'If a keystroke is received.
If ncode = HCBT_CREATEWND Then
Debug.Print "1.in!>>>>>"
'ptr.lpcs = lParam
'CreateFromPointer (lParam)
'Call CopyMemoryCBT_CreateWnd(mCBT_CREATEWND, lParam, LenB(mCBT_CREATEWND))
'SetWindowText wParam, "ASDF"
Debug.Print "wParam=" & wParam
Debug.Print "lParam=" & lParam
ptr = VarPtr(tCBT_CREATEWND)
Call MoveMemory(ByVal ptr, ByVal lParam, Len(tCBT_CREATEWND))
Debug.Print "CBT_CREATEWND.lpcs=" & tCBT_CREATEWND.lpcs
Debug.Print "CBT_CREATEWND.hwnd=" & tCBT_CREATEWND.hWndInsertAfter
Call MoveMemory(mCREATESTRUCT, ByVal tCBT_CREATEWND.lpcs, LenB(mCREATESTRUCT))
Debug.Print "mCREATESTRUCT=" & mCREATESTRUCT.lpszClass
Debug.Print "mCREATESTRUCT=" & mCREATESTRUCT.lpszName
Debug.Print "mCREATESTRUCT=" & mCREATESTRUCT.Style
Call MoveMemory(sStr, mCREATESTRUCT.lpszName, 10)
End If
'Pass the keystroke on to the primary program and pick up the next hook for processing.
FindToolbarProc = CallNextHookEx(gLngWindowHook, ncode, wParam, lParam)
End Function
Only problem is that the MoveMemory (AKA RTLMOVEMEMORY) command seems to be returning erronous data. Any suggestions?
|
|
|
|
|
Hello. I have a database of journal entries. In most cases there is more than one debit for a corresponding credit(s)in a given journal entry. Would Visual Basic be useful in determining which debits belong with each corresponding credit via a series of calculations, or am I a total idiot for looking to VB to solve this? Any assistance you can provide is greatly appreciated!
You have a choice between the natural stability of gold and the honesty and intelligence of the members of government. And with all due respect for those gentlemen, I advise you, as long as the capitalist system lasts, vote for gold.
-George Bernard Shaw
|
|
|
|
|
It would depend - if there is a unique identifier to link the debit with the credit then using something like access would allow you to create a view of the table showing the credit and all the debits linked to it.
|
|
|
|
|
It really depends how much time you can spend developing it on VB or any other software. VB is easy and you can easily find solution to your particular problem. 'Anonymous' is right in saying that you can use two tables in MS Acess, one for credit and other for Debit. have these two tables liked via a common key, like customer ID etc. Use SQL querty to retrive records from debit table corresponding to the credits.
|
|
|
|
|
I would like to add animations, which were made in Flash5 to Visual Basic 6.
What component (ActiveX) I need to add to my project??
And what id the code to make the connection between the animation file and VB ?
I heard about "webbrowser". And the code that I have been told is : object.navigate." The Path ".
Where I can find this ActiveX controller??
Thank you !!!!
Ahuva
|
|
|
|
|
IF you have installed flash then you are half way through your problem. When macromedia Flash is installed, an activeX control called swflash.ocx. add this control in your project. you can use various properties and methods supported by this control to play your animation. There is no way through which you can pass any information from flash to vb6 or vice versa.
|
|
|
|
|
I wrote the next thing, but it's not working:
Dim fso As filesystemobject
-----------------------------------
Private Sub Form_Load()
fso.createfolder ("c:\project\global\")
End Sub
The VB doesn't change the letters to Capital letters ( Like:
fso.CreateFolder ("....") and FilesystemObject.
Is it any problem to work with FSO in PCs which are not connected to server??? What can I do???
Ahuva
|
|
|
|
|
Did you add a reference to the Microsoft Scripting Runtime? You can do that from the project menu -> references
|
|
|
|
|
Thank you very much Jon!!!
I did it, and I also changed the "Dim ...." line to
fso = CreateObject("scripting.FileSystemObject")
(I saw this line in an Internet site, which explain about fso).
Now it is working, but I have other problem. I wrote the next code, which is related to 2 buttons ( command2 and command3):
Private Sub Command2_Click()
Set fso = CreateObject("scripting.FileSystemObject")
fso.createfolder ("c:\program Files\Ahuva\")
End Sub
Private Sub Command3_Click()
Set d = CreateObject("scripting.FileSystemObject")
d.createfile ("c:\program files\Ahuva\testing.txt")
End Sub
The operation of command2_click() is working, but there is a problem to operate command3_click(). The error message, which is displayed, is: " Object doesn't support this proparty or method."
Can you help me with this problem???
Thak you again Jon.
Ahuva
|
|
|
|
|
Hi Ahuva,
the FileSystemObject object does not have a method named "createfile". Use CreateTextFile instead.
Good luck.
Volodya
Ahuva wrote:
Set d = CreateObject("scripting.FileSystemObject")
d.createfile ("c:\program files\Ahuva\testing.txt")
Volodya Orlenko,
orlenko [at] hotmail [dot] com
|
|
|
|
|
Hi,
How can I scroll the standard ScrollBars of an MDI Form, programatically ??
(note: I am talking about the Standard/Default scrollbars and not the ScrollBar control)
I tried using the Following APIs :
SendMessage(...WM_VSCROLL...) and SetScrollPos(...)
But it doesnt work...
Please someone suggest me a way to do this...
Thanks,
FiroZ
|
|
|
|
|
Try using the following API functions...
ScrollWindow()
ScrollWindowEx()
I haven't tested it on an MDI form yet, but logically it should work. Also, don't forget to call UpdateWindow() afterwards, so the the client area is redrawn.
Jeremy L. Falcon
"The One Who Said, 'The One Who Said...'"
|
|
|
|
|
how can i attach scanner with my vb program
i want to get result from scanner and display that picture in picture box
help me please
|
|
|
|
|
visit www.twain.org
Peter
|
|
|
|
|
Now, I've been flipping through VISUAL BASIC 6.0 STEP BY STEP (the Microsoft book ) and it doesn't seem to have any info on implementing sound. I was hoping to make a multimedia database with some background music in it and sounds (like clicking on buttons and such).
Help?
TheBadProgrammer
Everyone welcome the NewbiE!!!!
First Programmer: "How many bits are in a bite?"
Second Programmer: "You spelled bytes wrong."
First Programmer: *stares* "It's a joke, moron."
Second Programmer: "Joke...?"
|
|
|
|
|
How about the PlaySound(...) Win32 function? IIRC, VB is able to call Win32 functions...?
Peace!
-=- James.
|
|
|
|
|
I use microsoft multimedia control and its quite flexible. give it a try.
|
|
|
|
|
DirectSound is another option
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hello !!
How can I save the last value of a variable even after turning off the computer??
I have an Index (static i As Integer). THe value of the index is equal to 10, but after I quit from VB and entering again to the program, the value of the index is zero (0), again.
Is there any way to solve this program ???
I hope you can help me.
Any way, Thank you !!!
Ahuva
|
|
|
|
|
What your looking for the the propbag
PropBag.WriteProperty
PropBag.ReadProperty
or you could put it in a recordset..
Dim rs As Recordset
Set rs = New Recordset
rs.CursorLocation = adUseClient
rs.Fields.Append "Value", adsingle
rs.open
rs![value]=10
rs.save "c:\myvalue.dat" , adPersistADTG
rs.close
then to retrive the data
Dim rs As Recordset
Set rs = New Recordset
rs.CursorLocation = adUseClient
rs.open "c:\myvalue.dat"
txtValue.text=rs![Value]
|
|
|
|
|
Hi folks,
I'm rather inexperienced with VB, but since this is pretty easy with VC, I hope some of you gurus out there has done it before or has a hint.
Think of a calculation, where you have a result of, 3/4 = 0.75
If I simply use the code ResultWindow = 3/4 the VB form will display "0.75" as desired. BUT: some languages, including German, use a different format, the figure above should be written "0,75"
Speaking Windows, I'd rather get and put the number format as specified in the control panel.
Anyone has an idea to do VB excatly this?
Thomas
BTW: for VC, this piece of code in OnInitInstance does all the job:
setlocale( LC_ALL, "" );
|
|
|
|
|
Take a look at FormatNumber() and FormatCurrency() functions.
|
|
|
|
|
I am trying to create a simple drag and drop setup between two list boxes. They are initally filled with a cell array from 2 excel spreadsheets I need the selected data object to move from it's location in one listbox to a SELECTED location in the other list and vice versa where the user drops the mouse. I can only make it drop at the end of the current list though. Any ideas would be much appreciated.
Racer Shaggy
|
|
|
|