|
hai guys,
i am distributing a external winodow hook dll to the users system32 folder while installing my app. but after the installtion, when program is laucned, the dll loaded in vista, but no hooking. if restarted the pc only it works. but no problem in xp. it hooks and works fine after the installation.
whats wrong?
this is th innosetup code
Source: "D:\myproject\distribusion\xxxhook.dll"; DestDir: "{sys}"; Flags: ignoreversion
btw, it is a vb6 application.
|
|
|
|
|
My first question would be is the user running the code an Administrator?? You said you're using WIndows hooks, but not just anyone can use those functions.
|
|
|
|
|
Hai dav,
i am running in the admin account.
but here i dont think account is a concern in my openion.
hooks and permissions have no connection if i am correct.
the main think here, after restarting the machine, the hook works in vista.
but not imediatly after the installation.
D
|
|
|
|
|
afridy wrote: hooks and permissions have no connection if i am correct.
Depends on the hook. You never specified what hooks you're using, so it's impossible to say.
afridy wrote: the main think here, after restarting the machine, the hook works in vista.
but not imediatly after the installation.
Does the problem happen on a fresh machine that hasn't seen your app yet? Or is the problem occuring only when you reinstall the app or install a newer version of it? Is the setup replacing the .DLL immediately or is it queued for replacement when Windows starts. Is the .DLL still in use when your setup is run?
|
|
|
|
|
[quote]Depends on the hook. You never specified what hooks you're using, so it's impossible to say.[/quote]
Hai dave, sorry, yah it's a window hook that intercept messages and discard clicks from receiving by external windows when mouse move on them.
|
|
|
|
|
[quote]Does the problem happen on a fresh machine that hasn't seen your app yet? Or is the problem occuring only when you reinstall the app or install a newer version of it? Is the setup replacing the .DLL immediately or is it queued for replacement when Windows starts. Is the .DLL still in use when your setup is run?[/quote]
yah, this happens on the fresh machine.
the setup installes the dll on the first run and not at the restart since i have not specified sharefile or restartreplace in innosetup.
btw,how to check my dll is running or not while the program is running?
|
|
|
|
|
If this happens on a fresh install of the application, the .DLL isn't running since it's not installed yet.
You can't check to see if it's running or not. A .DLL is loaded into the process that uses it. If the application you launched that uses the .DLL is still running, then any .DLL's it used are still loaded and running to.
In that case, I don't know why your code doesn't work without a restart. Right now, I don't have to the time test and/or research it either.
|
|
|
|
|
thanks dave for the time you took to solve my issue. hope i could find some more tips here.
|
|
|
|
|
hi
i m running windows application in vb.net by pressing F5.
Then igot the error like
"Error while trying to run Project
Unable to start Debugging
The Binding handle is invalid"
plz help me
if i run any windows application from my system i m getting this error.
It is not for one project.for all the windows application projects
plz help me
vijay kumar D
|
|
|
|
|
All you've given us to work with is the error message you got. So, you'll have to read through these[^] Google results to find a solution.
|
|
|
|
|
hello everyone...
i encountered this error:
Creating an instance of the COM component with CLSID {00024500-0000-0000-C000-000000000046} from the IClassFactory failed due to the following error: 8007000e.
in
Dim Excel_App As New Excel.Application
after i got any error when exporting excel programatical.. the last error i encountered was "out of memory to excute this program" then after that i cant run the application at all..
is there any solution to get rid this error? except in restarting the local machine...
please please help..
thanks in advance
jyn
|
|
|
|
|
Well, that memory error might have something to do with it. It appears you've run the machine out of memory. WHat are you doing that's allocating so much memory?
|
|
|
|
|
thanks for your reply Dave..
i just retrieving so much data from database..maybe my local machine cant handle it thats why it raised that error.. but when i put my app in pur server, i dont encounter that error.
jyn
|
|
|
|
|
How much RAM is in the server compared to the workstation??
|
|
|
|
|
Does anybody know if there is a way to Shutdown a computer without using CMD. I know that you can use
System.Diagnostics.Process.Start("ShutDown", "/s")
and C:\>shutdown but both of these use CMD where the user that is going to be using this program has CMD and batch disabled. If there isn't another way to do this then could you please tell me how to run a batch file as another user.
Thanks for your help in advance!
modified 8-Sep-21 21:01pm.
|
|
|
|
|
You're looking for ExitWindowsEx[^]. The user running the code, of course, has to have the permission to shutdown the machine though.
|
|
|
|
|
Ok I have figured out how to install an LPR port like so : (using the shell command of course)
Code:
Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnport.vbs -a -r CSE-ATLAB-BWQ -h at-cetus.ad.ufl.edu -o lpr -q CSE-ATLAB-BWQ
rundll32 printui.dll, PrintUIEntry /if /b "test_1" /f "%SYSTEMDRIVE%\7760.inf" /q /r "CSE-211-CLQ" /m "Xerox Phaser 7760GX PS" /z /u
Now the issue is when I do a check for it to be installed or already installed I do:
Code:
Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnport.vbs -l -r CSE-211-CLQ
The issue is that the above command shows all the ports, not just the one that I am looking for. and If I get that working, how on earth to I trap the output and
get a specific word that would show that it is installed out of:
Server name
Port name CSE-211-CLQ
Host address at-cetus.ad.ufl.edu
Protocol LPR
Queue cse-211-clq
Byte Count Disabled
SNMP Disabled
How do I accomplish this??
Also How do I use the shell commands in the background worker?
|
|
|
|
|
The easiest way would be to change the command line to pipe the output to a file, then read the file and process it.
Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnport.vbs -l -r CSE-211-CLQ > filepath
As for launching those commands, it doesn't matter it it's launched from a background thread or not. The process you launch will get it's own process space and it's own threads.
|
|
|
|
|
The problem is that the shell commands never get ran it seems. When I type it in the command prompt it works fine, but when I:
Shell("Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnport.vbs -a -r CSE-ATLAB-BWQ -h at-cetus.ad.ufl.edu -o lpr -q CSE-ATLAB-BWQ")
It never runs. Did I use the wrong command?
|
|
|
|
|
Look into the Process class and it's Start method.
|
|
|
|
|
Process.Start("Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\prnport.vbs -a -r CSE-211-CLQ -h at-cetus.ad.ufl.edu -o lpr -q cse-211-clq")
The above doesn't execute. Nothing else after it gets run either. When I do a Process.Start("Iexplorer.exe") it runs. What am I doing wrong? Does it help that I am running 2 shell commands per printer for 18 printers?
|
|
|
|
|
Trey5498 wrote: The above doesn't execute. Nothing else after it gets run either
It appears youre thread quit for an unexpected reason or it threw an exception that you ate and ignored.
Trey5498 wrote: What am I doing wrong?
I have no idea without seeing the code that setups up the thread and the code it's running.
|
|
|
|
|
Imports Microsoft.Win32
Public Class prnProcessing
Dim x As New System.Diagnostics.Process
Public arrInstalled As New ArrayList()
Dim WithEvents ToDoWork As New System.ComponentModel.BackgroundWorker
Public Sub prnProcessing_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If prnSelection.arrToInstall.Count > 0 Then
'added 10-2-08
prnProgress.Style = ProgressBarStyle.Continuous
'prnProgress.Dock = DockStyle.Bottom
prnProgress.Visible = False
prnProgress.Minimum = 1
prnProgress.Maximum = prnSelection.arrToInstall.Count
'end add 10-2-08
ToDoWork.WorkerReportsProgress = True
ToDoWork.WorkerSupportsCancellation = True
ToDoWork.RunWorkerAsync(prnSelection.arrToInstall)
Me.CenterToScreen()
Else
MsgBox("There are no printers to install. Please choose the printers you wish to install.")
prnSelection.Show()
Me.Close()
End If
End Sub
Public Sub ToDoWork_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles ToDoWork.DoWork
Dim worker As System.ComponentModel.BackgroundWorker = CType(sender, System.ComponentModel.BackgroundWorker)
If e.Argument IsNot Nothing AndAlso TypeOf (e.Argument) Is ArrayList Then
Dim arrToInstall As ArrayList = e.Argument
If arrToInstall.Count > 0 Then
Dim i As Integer = 1
For Each printer As String In arrToInstall
CallByName(Me, printer, CallType.Method)
worker.ReportProgress(i)
i += 1
System.Threading.Thread.Sleep(200)
Next
End If
End If
End Sub
Public Sub ToDoWork_ProgressChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles ToDoWork.ProgressChanged
prnProgress.Visible = True
prnProgress.Value = e.ProgressPercentage
End Sub
Public Sub PrinterProgress(ByVal i As Integer, ByVal worker As System.ComponentModel.BackgroundWorker, ByVal e As System.ComponentModel.DoWorkEventArgs)
worker.ReportProgress(i)
End Sub
Public Sub ToDoWork_EndProgress() Handles ToDoWork.RunWorkerCompleted
ToDoWork.Dispose()
prnWrapup.Show()
Me.Close()
End Sub
Public Sub CSE211CLQ()
'Added on 10/27/2008
Process.Start("cmd", "Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\prnport.vbs -a -r CSE-211-CLQ -h at-cetus.ad.ufl.edu -o lpr -q cse-211-clq")
Process.Start("cmd", "rundll32 printui.dll, PrintUIEntry /if /b ""CSE-211-CLQ"" /f ""C:\7760.inf"" /q /r ""CSE-211-CLQ"" /m ""Xerox Phaser 7760GX PS"" /z /u")
arrInstalled.Add("CSE-211-CLQ")
'end Added on 10/27/2008
'for test purposes
MsgBox("CSE-211-CLQ Installed", vbOK)
End Sub
End Class
Here is the form that contains the BGworker and Dos commands. I truncated the printers to one so that it wont be spam. I added the "cmd" to see if that would make a difference and it still doesnt work, however the command prompt pops up and everything else executes, just not the adding of the printer/port.
|
|
|
|
|
Utter spaghetti. There's stuff that there's no definitions for. Example: What's prnSelection.arrToInstall ? Where is it defined? How is it getting passed to this code, ...
And what's with this CallByName garbage?? Don't. Just put the printer names and the two command lines you need to run for them into an array and you can loop through building the command lines and launching them from that. If you think you need to use CallByName, you really need to rethink your design.
You may also want to look into changing the Process.Start commands. The .exe to run would be "Cscript" and "rundll32", not "cmd".
|
|
|
|
|
there are 4 forms in this project
(form 1) prnSelections - Has 18 checkboxes so the user can select what they wish and ONLY install those.
arrToInstall is an arraylist that is filled when the check boxes are check upon clicking the next button
(form 2) prnOverView - Doesn't show up here as it is just the middle man for the user to make sure of the printers
(form 3) prnProcessing - which installs the printers.
(form 4) prnWrapup - Another form just to show which have successfully been installed hince the reason I was looking for an easy way to check the port/printer has been created so I do not attempt to install it more than once.
CallByName is used to call the installation function because printer is the value of that particular spot in the arraylist.
I tried without the BGworker before, however the progressbar would not get filled as that is what I need.
I hope this clears up a few things of what I am trying to accomplish.
and do you mean Process.Start("Cscript.exe %WINDIR%\System32\Printing_Admin_Scripts\en-US\prnport.vbs -a -r CSE-211-CLQ -h at-cetus.ad.ufl.edu -o lpr -q cse-211-clq") ?
modified on Wednesday, October 29, 2008 10:07 AM
|
|
|
|