|
Leave off the Security.AccessControl.RegistryRights.SetValue in the regKey = Registry.LocalMachine.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True, Security.AccessControl.RegistryRights.SetValue) line.
Please don't say it's urgent. It's a given because everyone thinks their question is urgent.
|
|
|
|
|
I have a question about your code. I inserted it into a project of mine (using Visual Studio 2008) and it refused to compile "until there was an 'Opening Try' statement." I've scanned your code and in fact don't find a *Try* statement. Where, in your code, did you or do you plan to place the *Try* statement?
David
|
|
|
|
|
'****i used to be put it like this example...***
'***************
<br />
Private Sub mySubFunctionName()<br />
try<br />
<br />
'****youre code statement goes here*****<br />
<br />
Catch ex As Exception<br />
MsgBox(ex.ToString)<br />
End Try<br />
End Sub<br />
|
|
|
|
|
Excuse me "The JZ" thanks for the reply.. i really appreciate your effort.. but i've try it before, before i've post this thread..
NOTE!!!!!!!! i forgot to say that this code work good in Windows 2000!! but does not work on "XP Pro SP3" or higher like "Vista".. and i want it to work with this OS platform... you can try my code and let me know if it will work on XP Pro SP2
anybody there got a good possible solution??
<br />
regKey = Registry.LocalMachine.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True)<br />
but this still gives me a security exception error like this...
System.UnauthorizedAccessExeption: Attempted to perform an unauthorized operation.
at Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str)
at Microsoft.Win32.RegistryKey.SetValue(String name, Object value, RegistryValueKind value kind)
but just like i've said before from the very first of my thread? my code can only read but can't write on the registry... how am i suppose to write in the registry using Microsoft.Win32??? without having security exception error... my user account is already an administrator and i already set my application as a full trust application in PROJECT PROPERTIES/SECURITY/ENABLE CLICKONCE SECURITY SETTINGS as FULL TRUST APPLICATION of my WINDOW PROJECT IDE VS2005....
'*********** please review my code********
'***********this is my real actual code a little differ in my fisrt code which i just simplified before****
<br />
Imports System.IO<br />
Imports Microsoft.Win32<br />
Public Class myApplicationName<br />
Private Sub CreateAutoRegistryKey()<br />
Try<br />
Dim regKey As RegistryKey<br />
<br />
'NOte: appKeyName will be look like this "myApplicationName.exe"<br />
Dim appKeyName As String = FileIO.FileSystem.GetName(Application.ExecutablePath)<br />
<br />
'Note: then appKeyName will now look like this "myApplicationName"<br />
appKeyName = appKeyName.Remove(appKeyName.IndexOf("."), 4)<br />
<br />
regKey = Registry.LocalMachine.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True)<br />
<br />
If regKey.GetValue(appKeyName) = Nothing Then<br />
MsgBox("No value found")<br />
regKey.SetValue(appKeyName, Application.ExecutablePath, RegistryValueKind.String)<br />
MsgBox("key " & appKeyName & " has been created")<br />
Else<br />
MsgBox("Value Found")<br />
If regKey.GetValue(appKeyName) = Application.ExecutablePath Then<br />
MsgBox("value equal")<br />
Else<br />
MsgBox("value not equal")<br />
regKey.SetValue(appKeyName, Application.ExecutablePath, RegistryValueKind.String)<br />
MsgBox("key " & appKeyName & " value has been remodified")<br />
End If<br />
End If<br />
Catch ex As Exception<br />
MsgBox(ex.ToString)<br />
End Try<br />
End Sub<br />
End Class<br />
Please anybody help... please??...
modified on Monday, July 21, 2008 9:07 PM
|
|
|
|
|
Hmmm. Does your user account have permissions to write to HKEY_LOCAL_MACHINE?
|
|
|
|
|
Yes! my user account is an administrators account... that's why im pretty confuse... why this can't work well..
and there's another... i forgot to say that my code, work well in Windows 2000!! but does not work on "XP Pro SP3" or higher like "Vista".. and i want it to work with this OS platform... you can try my code and let me know if it will work on XP Pro SP2 because i dont have XP Pro SP2 anymore...
anybody there got a good possible solution make this work on the other OS platform?? i've already expected that my code will not work on Vista cause of its very high security features... but i wonder how to make it work in XP SP2 or neither XP SP3 which is my point of platform to run my application..
and also...
Thanks to "The JZ" for giving attention in this thread.. i really appreciate a lot..
and im really glad if any body there will share their good idea... please???
|
|
|
|
|
Oppzzzz!!! Sorry to bother... im confuse... my user account is one of administrators account type and has no restriction.... i wonder why my application code does'nt work well until??? until i use the computer fixed/real administrator account when the OS first installed... which means??? all other administrators acount type.. dosn't really a fully administrator account???
Hey... "The JZ" thanks for the great help!!! youre a lot of help.. thanks again...
|
|
|
|
|
Hi all,
I am looking forward to develop a Proxy Mail server, for our office mail distribution.
In Detail: All the mail of our company(Branch office) employees go to our main mail server hosted at www.website.com
To access our mail from the branch office we need to use a proxy mail server(placed in our branch server) which can fetch mails from the main server and distribute them to the individuals.
As i said i need to develop the same, and googled but i did not get any inputs.
Can any body please help me, and provide some information from where i can get started.
Previously i wrote a piece of code through i am able to send mails over, but not able to fetch them. please help...
I will be thankful for any kind of information...
Jats
|
|
|
|
|
I would like to get Visual Basic 6.0 source code for displaying video / frame capture using a higher resolution Web camera (more than 640 x 480)
Currently i have a code for displaying video / frame capture, but only upto 640 X 480 resolution.
I want to display video / capture frames upto 1600 X 1200 resolution.
I am willing to pay for the source code. Could anyone direct me to a web site that can solve my problem?
|
|
|
|
|
Clement Victor wrote: I am willing to pay for the source code. Could anyone direct me to a web site that can solve my problem?
Sounds like you want to post a job on the new CP job site, and see if you can find someone you can pay to develop this for you.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Have a look at ComponentSource. Chances are you will find a commercial control for your requirements and sometimes even with source code.
640x480 resolution is MPEG2 standard resolution so I am guessing you want HD quality.
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
We had a ASP.NET 1.1 Windows app that had the code below that I'm now trying to implement in ASP.NET 2.0 Windows app. The problem is that Main is "not found". The idea behind this is that it checks to see if the server has a new version and, if it does, it downloads it to the client computer and updates it. Can't figure out what I'm doing wrong... I get the error at the first Try / Catch at typeContent.InvokeMember. The error message is "Method 'Example.My.MyApplication.Main' not found."
The code is based off of the posting found at http://www.codeproject.com/KB/dotnet/DotNetBuildSmClnts.aspx[^]
Thanks,
Dan
Imports System.Reflection
Imports System.Security
Imports System.Security.Policy
Public Class Utility
Friend Shared Sub CheckForNewVersion()
Dim assemblyContent As System.Reflection.Assembly = Nothing
Dim strURL As String = "http://www.example.com/example/example.exe"
Try
assemblyContent = System.Reflection.Assembly.LoadFrom(strURL)
Dim Version As String
Version = Replace(assemblyContent.FullName, Microsoft.VisualBasic.Left(assemblyContent.FullName, assemblyContent.FullName.LastIndexOf("Version=")), "")
Version = Microsoft.VisualBasic.Left(Version, Version.LastIndexOf(", Culture="))
Version = Replace(Version, "Version=", "")
If My.Application.Info.Version.ToString <> Version Then
Dim typeContent As System.Type
typeContent = assemblyContent.EntryPoint.ReflectedType()
Try
typeContent.InvokeMember("Main", BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.Public Or BindingFlags.InvokeMethod Or BindingFlags.Static, Nothing, Nothing, Nothing)
Catch ex As Exception
SetSecurity(assemblyContent.Location.ToString)
Try
typeContent.InvokeMember("Main", BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.Public Or BindingFlags.InvokeMethod Or BindingFlags.Static, Nothing, Nothing, Nothing)
Catch exp As Exception
WriteToEventLog("Invoking Main(): " & exp.ToString, EventLogEntryType.Error)
'End
End Try
End Try
Try
System.IO.File.Delete(assemblyContent.Location.ToString)
Catch ex As Exception
End Try
End If
Catch ex As Exception
End Try
End Sub
Private Shared Sub SetSecurity(ByVal Location As String)
' Irrelevant code here
End Sub
End Class
modified on Monday, July 21, 2008 12:49 AM
|
|
|
|
|
Hi,
Anyone can tell me if getting the current time of other computer is possible in VB6? I'm not using a SQL Server just VB it self. If possible can someone teach me or give an idea how to do it?
Thanks
Regards,
klaydze
if(you type your code here) {
Messagebox.Show("You help me a lot!");
}
else {
You help me = null;
}
|
|
|
|
|
Where is your vb6 app executing and of which computer you want current time.
Develop2Program & Program2Develop
|
|
|
|
|
You need an NTP client, such as this one[^].
If you are wanting to get the time from a computer on your network then you'll have to install an NTP server on it.
|
|
|
|
|
hi klaydze
Have you noticed that there is VS2008, man its Good, there is something they call Silverlight, nice Technologies.i was Developing in vb6 before, and am laughing at myself when i when i looked at vb6. Why Continue with vb6 man. what you want is Simple in .NET
Change Microsoft does not Support vb6 anymore its Dead
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Vuyiswa Maseko,
yes your idea in using VB2008 is good, but the program is existing and i just want to update there existing program. And the program is running in a third party software which is a Rockwell Software what they called RS View also the program is VBA not totally VB6. Maybe i will try all your suggestions.
Thanks
Regards,
klaydze
if(you type your code here) {
Messagebox.Show("You help me a lot!");
}
else {
You help me = null;
}
|
|
|
|
|
klaydze wrote: VB6
As the others have suggested, get away from VB6, it's been dead for a long time now. Put your efforts into VB.NET or C#.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
I want to execute an msi package with adequate permissions on XP SP 2 computers that do not have local administrator logged in. Everything is working fine with *.exe, but msi packages do not run.
This is what I have picked up from articles on the Internet and am trying to do:
command = "msiexec.exe /?" 'Even this is not working
Try
CreateProcessWithLogonW(user, domain, password, Convert.ToUInt32(1), _
command, command, Convert.ToUInt32(0), Convert.ToUInt32(0), _
currentDirectory, startupInfo, processInfo)
Catch ex As Exception
Console.WriteLine(ex.ToString())
End Try
There is no exeption thrown, or anything in the System event log on my test computers except messages about The Windows Installer service entered the running state, and stopped state.
Is there anything special I am missing? Pointers in the right direction, or alternative ways to do this would be much appreciated.
|
|
|
|
|
We use clickonce, however we also have a number of issues where the admin access is restricted. You need to remember the prerequesites, IE the dotnet runtime and anything else you may be installing that does not go into the app folder. Also if you are relying on any registry entries for your app you are dead in the water also.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thank you for replying. I forgot to mention I am running .net v 1.1 and visual studio 2003. The small application I am making is supposed to be used for controlling application roll-outs and upgrades with Microsoft Systems Management Server 2003. Client computers differ in regard to what they have installed, an often it is recommended to uninstall an application before making an upgrade. I know I can run queries from sms to find out wich computer has what application, but I think that it will be more tidy to advertise packages that can "decide" wether to run an install/uninstall or not.
For example Adobe Flash Player ActiveX should be uninstalled and the computer rebooted before upgrading, (this works since the uninstaller is *.exe and I can reboot the computer with sms), but there is also a plugin msi for Firefox, and i want this msi to run IF firefox is installed on that machine.
Everything is working except for launching the msi. Maybe I could try to launch a vbs script from my app that again launches the msi? But then there is the admin rights issue again.
Any suggestions or alternatives is appreciated.
|
|
|
|
|
Just to inform others that might be thinking about a similar way to deploy software. I have found out that launching a vbs file with this function does not work either.
|
|
|
|
|
Hello,
How can I find all the shared folders in a network ?
I want to populate a database with all the pictures on the drives of my metwork in a single loop.
I can do it from a kwon startfolder but not for all the folders in the network
Thanks
|
|
|
|
|
Wow thats a potentially nasty program to put on a corporate netwrok!
You could loop through each drive mapped to your machine and then through each folder as you must be doing.
For drives not mapped to your machine you will need permissions and the name of each share. Discovering the shares - someone else will need to help you there.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi
I have filled a dataset at runtime and then binded to bindingsource1, it is working nicely but when i was searching the list it is continuously ignoring the first item.
dim idx as Integer = BindingSource1.Find("City",CityName)
Then I manually check the idx property and if it is -1 then it checks the first item if it matches or not and it matches.
If idx=-1 then
If BindingSource1.Item(0)("CityName") = CityName then idx=0
End if
Although the technique works but why is it so and why can't it find the first row?
Regards,
MAP Tiger
Tiger Softwares
Software Designer and Developer
VB.NET, ASP.NET, VFP
|
|
|
|