I find that nobody really answers posts nowadays. So here's my idea: Post to this, and one of the people who have responded will answer, but most likely it will be me :). So, what troubles your VB-Life?
Printable View
I find that nobody really answers posts nowadays. So here's my idea: Post to this, and one of the people who have responded will answer, but most likely it will be me :). So, what troubles your VB-Life?
http://forums.vb-world.net/showthrea...threadid=25753
If you want, try your luck at any of the four question I asked. Thanks for your time. Joe
[Edited by Joey_k29 on 08-09-2000 at 10:55 AM]
You could use mciGetCreatorTask, but I don't know how, or you could do this:
I know it's a little far-fetched, but it may work. (Q #4)Code:
Do
chDir E:\ (or whatever you're CD-ROM drive is)
Loop until err.number <> 0
'code to excecute when it's open
To your first question, You may be able to do this with obtaining a window handle from the shell. Although, I have no clue how to do the rest. Why do you want to do those things, anyway?
What is the UBound() Function?
The Ubound() function returns the highest number of your array. For example, If I had this code:
Code:Option Base 1
Dim MyArray() as Integer
Private Sub Form_Load()
Redim MyArray(15)
MsgBox "Ubound returns " & ubound(myarray) & ". Lbound returns " & lbound(myarray) & "."
Msgbox "Ubound should return 15 while lbound will return 1 (option base 1)."
End Sub
I am trying to log what programs are being accessed on the cdrom. Do you have any specific code for the answer to my first question that I may use?
Thank you Joe
By the way, unfortunately the cdrom thing did not work. It works if the cdrom is just put in, but if you explore it the code does not execute. Thanks anyway. Any other ideas?
[Edited by Joey_k29 on 08-09-2000 at 11:31 AM]
Thanks, just wondered what it was, I didnt really need an example, but thanks neway, well that was my question :p
How do I log messages sent to other processes?
I tried to SetWindowLong to my proc, but then i found out it only works if you're trying it on your own window.
I need some good hooks explanation.
Anyone?
If you mean SubClassing, this will work:
That's a short subclassing technique. Call it like this:Code:Public Const GWL_WNDPROC = -4
Public lpPrevWndProc As Long
Public Sub Hook(Frm as Form)
Dim FrmhWnd as Long
FrmhWnd = frm.hWnd
lpPrevWndProc = SetWindowLong(FrmhWnd,GWL_WNDPROC,AddressOf MyWndProc)
End Sub
Public Sub UnHook(Frm as Form)
Dim Temp
Dim FrmhWnd as Long
FrmhWnd = frm.hWnd
temp = SetWindowLong(FrmhWnd,GWL_WNDPROC,lpPrevWndProc)
End Sub
Function MyWndProc(ByVal hw As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
MsgBox "Message: " & format(now,"HH:MM:SS") & " " & Cstr(hw) & " " & Cstr(uMsg) & " " & CStr(wParam) & " " & CStr(lParam)
MyWndProc = CallWindowProc(lpPrevWndProc, hw, uMsg, wParam, lParam)
End Function
I didn't just make you call the hWnd in the Hook and Unhook because this way it looks funny.Code:Private Sub Form_Load()
Hook Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
UnHook Me
Cancel = False
End
End Sub
Uh...yeah....hook me....hic!
:):(:):(:):(
As you can see, some like it while others do not.
This is easy.
I know how to do this stuff.
But in this method i can't hook into windows which are not in my app.
Any other suggestions?
So, that's you're style. I don't know how to get other program's hWnds, but you may be able to get the window by it's classname, and use that hwnd. Are you trying to do this for winamp? If you are, I can send you my ddraw shell example for Winamp (you can use it to make Visualizers, no royalties or anything). BTW, I'm out for lunch now :)Quote:
Originally posted by Sc0rp
But in this method i can't hook into windows which are not in my app.
How do ido a good mp3-player.
Is ther esomething i can use for free
Sastraxi: When dealing with Hooking and SubClassing, it's easier to pass the hWnd of the Form rather than passing the Form itself. This way, you can SubClass other programs.
Sc0rp: To find the hWnd of a window, use Findwindow
Code:Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Any, ByVal lpWindowName As Any) As Long
Private Sub Command1_Click()
'Get the hWnd of Calculator and SubClass it
hParent = FindWindow(0&, "Calculator")
SubClass hParent
End Sub
Private Sub Form_Unload(Cancel As Integer)
'Unsubclass Calculator
UnSubClass hParent
End Sub
There is an exewrap example that logs ussage, i will paste it in here(modified to log only the CD-Rom)
Change the registry like thisCode:Sub Main()
On Error GoTo errHandler
Debug.Print Command$
If Command$ <> "" Then
Dim i As Integer
i = InStr(Command$, "\") 'get Position of first slash
Dim MyStr As String
MyStr = Left(Command$, i - 1) 'get drive letter
If MyStr = "D:" Then ' Is it The CD-Rom
'(code to log usage)
End If
Call Shell(Command$, vbNormalFocus) 'Shell that program
End If
End
Exit Sub
errHandler:
MsgBox Err.Description, vbCritical Or vbOKOnly, Err.Number 'what went wrong
If Err.Number <> 53 Then
Call Shell(Command$, vbNormalFocus) 'Make sure the program runs!
End If
End Sub
NOTE: Make sure you put in the correct file path, this program mite lock you out of your computer, so make a back up of this part of your registry, so you can restore it!Code:HKEY_CLASSES_ROOT\exefile\shell\open\command to: "C:\exewrap.exe" "%1" %*
HKEY_CLASSES_ROOT\lnkfile\shell\open\command to: "C:\exewrap.exe" "%1" %*
HKEY_CLASSES_ROOT\piffileshell\open\command to: "C:\exewrap.exe" "%1" %*
HKEY_CLASSES_ROOT\batfile\shell\open\command to: "C:\exewrap.exe" "%1" %*
HKEY_CLASSES_ROOT\com\file\shell\open\command to: "C:\exewrap.exe" "%1" %*
See tip http://www.vb-world.net/tips/tip121.html
I know you should pass the hWnd, not the form. I was just pointing out that that is not the correct method, but it was REALLY funny! Hook Me.. Yeah, Hook Me, too!
Do you have any suggestions?
As I stated there, you would probably need to use a WAV file for that.
I once did the same thing! Here's the code:
This reply probably has some bugs, but you get the idea.Code:--modtick.bas--
Public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Public Const SND_ASYNC = &H1 ' play asynchronously
Const Tick = "tick.wav"
Sub Main()
Dim A
Dim OldSecond As Long
OldSecond = Second(Now)
Do
If Second(Now) <> OldSecond Then
OldSecond = Second(Now)
PlayWav Tick, SND_ASYNC
End If
DoEvents
Loop
End Sub
Sub PlayWav(ByVal File As String, Args As Long)
Dim RET As Long
RET = sndPlaySound(App.Path & "\" & File, Args)
End Sub
[Edited by Sastraxi on 08-09-2000 at 02:17 PM]
I'm pretty sure you could use a DirectX component to do that. I'm not sure, but is the Multimedia aspect of directX DirectPlay or DirectAnimation?
There is a grammatical mistake in the subject of my last post. It should be MP3s, not MP3's.
Megatron,
About your reply to my post with FindWindow.
I know how to find window handles, the problem is that when i try to SetWindowLong to an handle which is not mine, it returns an error.
Does anyone know how I can alter the properties of the standard HTML selection list?
tx
dvst8
OK Here's one for you!
I need a way to figure out dependancy information for a project (like the way the package and deployment wizard does it) without using the package and deployment wizard. Any ideas anyone?
Try this site for WinSock stuff -
http://www.stardust.com/winsock/
Well, too bad that there isn't App.UsedDLLFiles. :)
But there is a way, I'm sure of that. You could find out manually, of course.
Cmdlg32.ocx
Msvbm60.dll
mycontr.ocx
kernel32.dll
user32.dll
Stuff like that. API calls from the dll, Controls you are using, MSVBM60.DLL!
I'm not really sure what you're talking about. Can you perhaps give a more detailed explanation?