
Nazgulled
Avatar/Signature-
Posts
120 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by Nazgulled
-
I tried to use your code but it still doens't work on Vista... It works fine on XP, I can change to 1024x768 and 1280x800 back and forth, but on Vista, I can't swap to 1280x800 but it works swapping to 1024x768... Anyone knows why?
-
Didn't work, I tried Unicode instead of Auto and with out the Alias but it didn't work so I just reverted to Auto with the Alias. It works that way... However, the same problem persists... On Vista, I can easily change to 1024x768 but not back to 1280x800... Dunno why... Already tried to run the compiled exe with the administrative privileges but it didn't help...
-
What about the Auto keyword? should I add it or not? I don't think it's the UAC, I'm running VS2005 with administrator rights (maybe the compiled application is not), anyway, as I said, the resolution changes to 1024x768 when I'm at 1280x800 but I can't change back from 1024x768 to 1280x800, dunno why...
-
With your declarations, it didn't work... However, I added the "Alias" from the old declarations into yours and it worked... Is this ok? But I have another problem (not yet tested with these new declarations), I'm trying to run this on Vista too, but it does not work as on XP. I have created a form with 2 buttons, one changes the res to 1024x768 and the other to 1280x800. These works fine on XP, I can change to either one of them, but on Vista, I can change the res to 1024 but I can't change it back to 1280... The code is exact the same, any reason why?
-
I've used the class and it was successful, however, on the line lResult = ChangeDisplaySettings(DevM, CDS_TEST) and also on the line lResult = ChangeDisplaySettings(DevM, CDS_UPDATEREGISTRY) I get the following: Is this some kind of warning? Is it safe to use it anyways? Is it possible to fix? How?
-
[VB] Can't get window handler of process just started
Nazgulled replied to Nazgulled's topic in Windows Forms
Actually, I was only testing with notepad and some .NET 2.0 application that I did before and this application of mine was the one not working but it is now with the above code. I even tested it with a few other applications and they all worked. I also tested with Photoshop and this one didn't work, but it's ok, who wants to hide photoshop anyway after starting it? It worked at first, I mean, the window opens and it hides but after a while it shows again... But this application is mainly for command line apps so, the above code will do I guess. Will Process.Handle will work on ShowWindow(ByVal hwnd As Integer, ByVal nCmdShow As Integer) instead of Process.MainWindowHandle? (which is working) -
[VB] Can't get window handler of process just started
Nazgulled replied to Nazgulled's topic in Windows Forms
I fixed like this: If Not CBool(fileProcess.MainWindowHandle) Then Do System.Threading.Thread.Sleep(100) pWindowHandle = Process.GetProcessById(fileProcess.Id).MainWindowHandle Loop While pWindowHandle = 0 Else pWindowHandle = fileProcess.MainWindowHandle End If Good solution? -
[VB] Can't get window handler of process just started
Nazgulled replied to Nazgulled's topic in Windows Forms
See my code on the first post, I already use Process.WaitForInputIdle() and I tried with and without Sleep() after the WaitForInputIdel() it doesn't work... With the other programs I tested, I could get the MainWindowHandle if I wait like 500ms before trying to get it, and it worked. But if you are saying that, what do you suggest to launch an application and get it's window handler? -
[VB] Can't get window handler of process just started
Nazgulled replied to Nazgulled's topic in Windows Forms
That's what I tried before posting this but it doesn't work. For some reason, the value returned is always 0 and I don't understand why... -
I'm doing some application that when executed, starts a few others and hide their windows. For hiding the windows i'm using the ShowHindow() API but I'm having a little problem, the code is this: Friend Const SW_HIDE As Integer = 0 Friend Const SW_RESTORE As Integer = 9 <System.Runtime.InteropServices.DllImport("user32.dll")> _ Friend Function ShowWindow(ByVal hwnd As Integer, ByVal nCmdShow As Integer) As Integer End Function Dim fileProcess As Process fileProcess = Process.Start(appPath) fileProcess.WaitForInputIdle() ShowWindow(CType(fileProcess.MainWindowHandle, Integer), SW_HIDE) It works, but there's one problem... I tried this on notepad and it worked, tried on another applications and it didn't work because the MainWindowHandle was 0... if I add a System.Threading.Thread.Sleep(500) before the ShowWindow() call, it would work for most of the applications. What can I do to make sure, every started application is hidden without having to use Sleep()? Some apps may need 0.5s others, may need a bit more or less and I would like to have something that checks the MainWindowHandle and hide it, when it's created. Can anyone help me out?
-
Thanks for everything, now it's all working fine :) and it's not that slow anymore... Maybe I'll add 3 different block sizes depending on the file size...
-
Hum... and a block size of 8191 is fast enough for a 100mb files? I didn't tested your code yet, but on the read command you have 0 for the offset, shouldn't this be the totalDone as we are reading in chunks instead of the whole file?
-
It seems to be fixed just using Long for the offset instead of Integer. However, I think I'll use the marquee sytle instead and I'm going to tell you why. I don't care that with your method it takes a bit longer to calculate the hash but I care if the whole process takes twice as much. Well, for small files this doesn't matter, but for large files, it's a different story. If the files are small, the progress bar serves no porpuse at all to be really functional (read: not marquee style) cause it will be gone in no time, but if the files are really large, it's good to have a progress bar, but this is the problem. Let's say that I want to compute a file hash with a size of 100mb. With all of the above code this will take twice as much as the time it would take with the normal method. Why? Because of the line: fileStream.Read(fsBytes, 0, fileStream.Length). The progress bar only starts to fill when computing the hash, not while reading the file bytes into an array. And I can easly see that before the progress bar starts to move, it takes a while toread all the bytes, but when the progress bar starts to move, computing the hash for the 100mb files is quick with your method. What takes time is reading the bytes. What if the file is like 500mb? Well, I tried, but it takes so long to read all the bytes, it may not take that long to compute the hash with your method or .NET's native (doesn't matter), but reading the bytes (which I have to, to use your method), takes too long... There's no solution for this right? To speed up the process of reading the bytes I mean. I could read the bytes by parts and also update the progress bar but that would just serve the progress bar porpuse and I want speed on top of that...
-
A delegate is what I have right now, I just didn't feel the need to post the code here to the problem I'm having. I just have that overflow problem... If you say it can be fixed by using a larger data type, like long or is there a bigger one? As for rearranging the statement, I don't know how to do that. Math is one thing I was never good at, and I really don't see how can I have the multiplication after the division... I can't really test anything right now, nor search the MSDN database but will later...
-
Sorry, but it was my problem... I was calculating the hash with the 2 different methods in the same block of code and the byte array for the ComputeHashMultiBlock method was having only zeros, that's why the hash was different. I think the stream was being read for the ComputeHash from .NET and then it was at the end of the stream, so no bytes could be read... The array was being created with the needed amount of bytes but their values were all zero. Also, the fsBytes array needed to be initialized with fileStream.Length minus 1, otherwise, the hash was wrong. But now, I'm having a different kind of problem on your code. I tried to compute the hash for a 50mb file and I got an exception on this: ((offset * 100) / input.Length)
-
Thanks. But I wasn't able to correctly use the code. What's exactly the input and size parameteres recieved by the ComputeHashMultiBlock method? This is what I have: Dim fsBytes(fileStream.Length) As Byte fileStream.Read(fsBytes, 0, fileStream.Length) bHash = ComputeHashMultiBlock(fsBytes, fileStream.Length) sHash1 = BitConverter.ToString(bHash) sHash1 = sHash.Replace("-", "").ToUpper Dim MD5 As New MD5CryptoServiceProvider Dim bHash As Byte() = Nothing Dim sHash As String bHash = MD5.ComputeHash(fileStream) sHash2 = BitConverter.ToString(bHash) sHash2 = sHash.Replace("-", "").ToUpper But sHash1 is different from sHash2. What's wrong?
-
Yeah, that's what I had before. Actually, I had ana niamtion of a progressbar I designed myself (with PNG files) cause when I frist started to develop this application, .NET framework 2.0 wasn't out yet so... But now, I'm moved on to 2.0 and I'm going to use the marquee style...
-
Yes, I'm using .NET 2.0 but that didn't work. I saw your example on the other thread and tried to implement it on my program but it doesn't work the way I want it. As you can see in my code in the first post, the line "bHash = MD5.ComputeHash(fileStream)" is the one that will calculate the md5 hash for the file. If the calculation takes like 5mins, the following lines of code won't be processed until that ComputeHash() method is finished...
-
I have this code that calculates a file md5 hash using threads and I want to know if it's possible to get the progress of this calculation so I can add a progress bar to the application (right now I have a simple animation letting the user now the application is doing something). Here's the code of this calculation: Delegate Sub DisplayHashCallback(ByVal text As String) Dim fileStream As Stream Dim hashComp As New Thread(AddressOf HashComputation) Private Sub HashComputation() Dim MD5 As New MD5CryptoServiceProvider Dim bHash As Byte() = Nothing Dim sHash As String bHash = MD5.ComputeHash(fileStream) sHash = BitConverter.ToString(bHash) sHash = sHash.Replace("-", "").ToUpper DisplayHash(sHash) End Sub Private Sub DisplayHash(ByVal text As String) If frmMain.FileHash.InvokeRequired Then Dim d As New DisplayHashCallback(AddressOf DisplayHash) Me.Invoke(d, New Object() {text}) Else frmMain.FileHash.Enabled = True frmMain.FileHash.Text = text Me.Close() End If End Sub This code is part of the WaitForm, the form with the activity animation. The WaitForm is shown when the user loads a file in the MainForm (frmMain). The WaitForm, as you can see, is the one that will compute the file hash, set the results in the MainForm and close itself. Is it possible to do what I want?
-
Nevermind, I kinda fixed it. Instead of using an ImageList, I add all images to the resources file and used My.Resources. Now the colors work correctly.
-
The ImageList is populated at design-time and the code that takes the image from the ImageList and shows it in the PictureBox is already in the first post. For the generated designer code, check this file: http://stuff.nazgulled.net/code/vb.net/FormProfilesManager.Designer.vb The ImageList control is called imgLabels and the PictureBox controls that will take images from it are named pic1Enabled, pic2Enabled, pic1DHCP and pic2DHCP.
-
That is not the problem, the first thing I did when creating the imagelist was setting it to "Depth32Bit" otherwise the PNG transparency wouldn't work...
-
I have an ImageList with some images, all of them are png with transparency and the transparency is working correctly. The images are somekind of square with a little outline in a transparent background. On the main form, I have a picturebox that will take one of the images in the listbox. The image it will take will be different acording to some arguments, but that doesn't really matter I think. To apply the pictures I do something like this: frmMain.pic1Enabled.Image = frmMain.imgLabels.Images.Item(0) The problem is that the image does not have the correct colors I designed in the first place. The outline is somewhat blue where it should be gray. The rectangle background is also a little blueish...
-
Nevermind, I solved my problem using ArrayList. Thank you all!
-
I didn't quite understood your post... I talk about create structures, declaring, initalizing and constructors but I can't relate that to a structure array and how correctly use it for what I'm attempting to do as described in the first post.