Jump to content
Xtreme .Net Talk

Denaes

Avatar/Signature
  • Posts

    975
  • Joined

  • Last visited

Everything posted by Denaes

  1. To simplify things: 1. I want to write specific text into one textbox. 2. I want to write different text into the second textbox. 3. click the "Start" button. If this works, I can see it opening up a whole lot of possibilities in the office. Is this how you run it using the process class: Process.Start("Filename") I'm just not sure how to get the handle from that, but I'm sure I can figure out EnumChildWindows and SetWindowText API's. Thanks for the pointer, Its a place to start snooping :)
  2. I know about Automation, but this isn't that sort of case. I know you can run an external exe file. But can you manipulate it someway? Here is the situation, and it's not complicated: A file that opens up, the form has a "From" and a "To" text box, then a button "Start". We want to create a "controller" app with VB.Net so we can set it to run automatically at certain times. The form always opens up with blank text boxes so you have to fill it out every time. If it were a simple file/path/directory backup I'd just write it, but this file shuts down databases, copies them, sets some switch in the copied databases to "storage" with the time and date, then re-activates all the origional databases when finished. Since I know VB can cause the application to execute, I'm thinking there might be a way to get the focus to one text box, vb sends it a path, jumps to the next textbox and gives it another path, then clicks the "run" button. Is there a way to do this, maybe having VB simulating mouse clicks at certain coordinates and then "type" out a string? This would make creating an "Automated Shell" program for simple apps a really sweet deal!
  3. Ok, if this isn't VB Syntax specific I'll eat my trackball! I know 32bit variables will run better on a 32bit machine. int16 is there for programming on 16bit machines and same with int64, for the 64bit OS's (one of the new windows OS?). I think I've seen that Integer is now 32bit. Int32 is 32 bit. Is there any difference between the two? I'm thinking (my own logic here) that the Int(Number) variables are ment to be the standard used variables, so the programmer has full control and Integer is a legacy bit from VB6. Am I right? Are there any differences? Is one faster than the other or provide any different functionality?
  4. This seems to be a question I've been wondering, which is more efficient? I'm doing something really simple, graphics wise. A Tetris clone. Lame yes, but I need to grab all the basic vb.net bmp skills and this is a way to do so. Ok, so I'm making each piece up of 4 squares, which are 16x16 blocks. Is it going to be any faster/easier on the processing to have all 6 sprites in one bmp or in 6 tiny bmp files?
  5. Why does it seem that when you know how to do something, then that control is taken away for "ease of use", it just seems harder? I'm trying to do a double buffer to my picturebox. Currently I'm having no problem drawing 50+ shapes to the picturebox, but I want everything to appear at once. This was pretty easy in VB6, you just used a double buffer and flipped it. Ok, I have to do things the .Net way (or at least learn how). I saw another post about this and I found out that .Net does it for you, if you jump through its hoops ::groan:: Ok, so I read that you needed to turn on DoubleBuffer and AllPaintingInWmPaint on, which I believe I did here: Sub EnableDoubleBuffering() Me.SetStyle(ControlStyles.DoubleBuffer _ Or ControlStyles.UserPaint _ Or ControlStyles.AllPaintingInWmPaint, _ True) Me.UpdateStyles() End Sub I call this procedure on form load. I read that you have to do all of your drawing in the Paint or OnPaint Methods, using e for all of your drawing. This is my attempt: picScreen_Paint(ByVal sender as object, ByVal e as System.Windows. Forms.PaintEventArgs) Handles picScreen.Paint Dim g as graphics = e.graphics dim bmap as Bitmap bmap = new Bitmap(FilePath) dim Rect as Rectangle Rect = new Rectanble(0,0,16,16) g.drawimage(bmap, rect, 0,0,16,16, GraphicsUnit.Pixel) End Sub This actually draws a gameblock on my picturebox (picScreen). My main problem is that I have all of this bitmap info in a class, in which I normally pass the picturebox reference across. If the drawing has to be done from e.graphics, can you just pass the e across instead of the picturebox?
  6. yeah, I'm pretty sure thats what I'm looking for... though the first part is something I'm not used to seeing: "<Runtime.InteropServices.DllImport("kernel32.dll", EntryPoint:="RtlMoveMemory")>" Not used to brackets in my VB... I guess its universal .Net stuff :P It looks like it works... And I can declare it over and over again with different arguements? Or do I still need to declair them all as Overload functions?
  7. Well, that looks interesting While that link does have some interesting ideas and sure is useful, the issue isn't CopyMemory. There are more than a few windows API's that have a declaration "As Any". "As Any" was basically a varient to leave a variable open to anything from string, pictureboxes, integers and buffers. In .Net, you can overload a function so that you have many different functions with the same name, but different parameters. If you're given a picturebox as a parameter, it looks for the CopyMemory using Picturebox as a parameter - if non is found an exception is thrown. I'm sure you can use "As Object" as everything in .Net is an object, but thats supposed to be poor programming and in this particular case, copymemory is supposed to quickly copy units of memory, so speed should be of the essence. I can "Jig" it right now only using one form of the function (from a back buffer to a picturebox), but I'd like to learn the proper way to overload an API call without it giving an error and expecting a "End Function" or "End Sub" at the end. That link you gave me does look interesting, though at the moment it just overloaded my head and sent me running for caffine. I'll have to settle down with that and figure it out :P
  8. Heres an example: Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" ( _ ByRef Destination As Any, _ ByRef Source As Any, _ ByVal Length As Int32) This is the declairation, but there arn't any "Any" in .Net, Object is closer, but it would be better to overload the function/sub to handle certain conditions. I keep trying different ways of overloading, but I get errors about expecting the end of the procedure which isn't there because its an API declaration.
  9. For vb6, in class, this was a requirement that you used a control array. The point is learning how to use the control array, I'm really not going to go into buisiness creating and selling lean robust Minesweeper Clones :P Now I'm learning .net, and I'd like to learn how to use it in .net. Minesweeper was just an example really. I know in vb6 I had no problem using bitblt drawing api's to load pictures and create a grid on the form, which would work in this case requiring only 4 tiles (up, down, up flag, down mine... maybe down mine X). If you know of any sites that deal with drawing API's in .net or .net drawing functions, That'll probobly be one of my next few goals to learn.
  10. It looks like you're assigning the new button to the variable of b (for button). b.location is where it goes (x,y) b.text would display i in the text property (good for numbering buttons/whatever). me.controls.add(b) adds the button to Me (the form). addHandler b.Click I know this adds the .click event, but why do you need to use it? I thought the .click (as well as the others) were all methods in the button class. AddressOf ButtonClick - I have no clue what this does. Oh, wait a sec. It looks like the AddressOf ButtonClick I saw above was telling it which procedure name to trigger on the .click. That's useful. Ok, whats DirectCast do? I've been seeing a few things like this, playing with objects. cType was another, which I think forces an object into the class of another (make an object a textbox for a second to use a textbox property). I also didn't pick up where you actually named the button. Does it not need a name since you used the AddressOf? I'm only trying to pick this apart for better understanding. My two .net books are fairly broad so don't go into a whole lot of detail in this sort of thing, and its not a major topic of the book, so what there is, is probobly stuffed in something elses section.
  11. damn, I searched around and didn't find this. if this works perfectly, then its better than vb6. If I recall vb6, you couldn't (or it was difficult) to create a control array in code, you kinda had to cheat and make two buttons (in the case of buttons) to create the array, and delete one, leaving the first with an index of 0. On the recieving end of the procedure for their .Click, how do you figure out the index of the clicked button? Sender.index?
  12. Ok, this is one thing I loved about vb6, the control array. It made some programming, especially with multiple repetitious controls, much much easier. An example would be MineSweeper. its like 16-100 buttons/labels, which are variable. with a control array you can easily add more controls and easily run through a for...next loop to place them all. I've seen people say that a Control Array is very un-OOP. Does VB.Net have anything to replace them, or to handle these situations? I know for things like clicking different buttons you can just add multiple ButtonNames.Events(click, mouseover, etc) to a prodecure and use the "Sender" to refer to which one was activated. Other than that, I'm at a loss to achieve half the functionality of a control array. Like in the minesweeper idea, how would you populate the program with 16-100 buttons/labels during runtime, AND make them all responsive to your procedure for clicking? I know I'm not even 1/4th the VB.Net programer that I was in VB6 (which isn't saying a whole lot), but control arrays made it so simple, only having to deal with the index of an existing control array. 1 or 1,000 members, it didn't matter. You could easily add more and keep track of them all. So far in VB.Net, its a LOT of copy and pasting to add controls to a procedure. Short of making 100 labels (tedius and unproffessional) and hiding those not used, I'm not sure how to go about this. There should be a site or FAQ or something devoted to this. Control Arrays were a pretty strong and useful technique, and at least in my college class/book, it was the preferred proper technique to have 1 procedure and a control array with a case statement rather than 12 seperate procedures. Any help would be greatly appreciated, even related concepts that I didn't specifically touch upon
  13. Thats was one theory I had. I was looking for the least drain on resources... I guess I figured it was quicker/easier for VB.Net to just rename it rather than make a copy of it, then delete it... I don't care, they're all small files and my boss didn't give me any speed or resource considerations, just trying to make it as streamlined as possible. Hey, that might work out fine... let the boss get the crappy version, he's happy... later on I figure out how to rename properly and the process is done in half the time and I look smart :P I'm sure Dilbert would have a name for this, and it would involve Weasel :D
  14. say I wanted to change an extension from .wpd to .txt. I know how to read a filename, at that point I'd have to search for the .wpd and if found, replace it. I'm not sure how to do the replacing in .net. Could anyone help me out ?
  15. Don't ask me why, but the Wordperfect dll that comes with wordperfect 2002 worked with vb6, but not with vb.net. I won't let that get in my way... I need to search for a particular string and grab the next 11 characters after that. I could do that without much of a problem, but I did hit a little snag. using the Streamreader with this code: Dim sr As StreamReader = New StreamReader(New FileStream(path, FileMode.Open)) TextBox1.AppendText(sr.ReadToEnd) sr.Close() I get the answer of "WPCP", which is the 2nd through the 5th characters of the document, read in a text editor. There is like 10 pages of text. If I change the file extension to .txt, I get the entire document and I can search for my string and grab out the 11 characters I need. Is there a way to force the streamreader to read like a text document without changing the file extension? As a last ditch, show something to the boss, solution I can locate the filename, change it to .txt, open and scan, then change back to .wpd... but thats two more lines of code than should be needed and actually might slow down the program over 900 programs worth of time. If anyone can figure how to make it open any file type as if it were a text file, I'd be very happy
  16. Actually thats a very good link. I'm still exploring it and other links within that link. I'm just glad I'm not the only person to have this problem/desire. Thank you :D
  17. It looks perfect... If I was able to use MS Office for everything at work. 90% of the office uses Wordperfect. I already posed the idea of them all choosing "Save As..." and selecting "Microsoft Word .Doc". Wordperfect is a crappy wordproccesser compared to word, but its about 99% cheaper (for the price of 1 copy of MS office we got a liscence to run Corell office for the entire buisiness, unlimited machines) and has far superior conversion capabilities. In theory if everyone wern't so damn lazy, they could just save as a word document and wordperfect opens word documents. In fact, since 90% of our policies and statements are in wordperfect, even those who use MS Office have to have Corell Office on their machines because Word can't read Wordperfect. The big stumbling point here is that apparently Corell offices 2002 Suite doesn't have Application Automation .DLL's compatable with .net. I might have to whip out vb6 for this project, which is a shame because it takes 5x as long for vb6 to just scan the directories than it takes .net. EVERYTHING has a Summary page... EXE's, WPD, DOC, TXT, COM, BAT, etc Everything. I don't see why if Windows can access it when you click properties, there isn't some function for it as an API or in VB...
  18. Yeah, fileInfo was the first thing I tried. I figured Microsoft would have to put the summary info in there, thats where it belongs. I'd seriously love it if FileInfo can read the author or keyword from the summary page of a files properties. My heard skipped a beat at a solution so simple... then I saw you wern't geting any of those values, just the standard ones. If this method can get/write to the Keyword, Author or Description fields then I'm in luck, but I havn't found out how to do that.
  19. I'm attempting to use the .dll with a msword document and ms excel, it works with their name property, though much slower than .nets io.file properties. It doesn't work with "Keyword" or "Author". After the second part, I thought the file or an instance of word/excel might somehow be open. I rebooted and on a cleen reboot I still got the error. Only on trying to pull up part of the Summary, not the .name method.
  20. It said it was Office in general, and everything in 2k and xp. I honestly don't know why .net or vb in general seems defunt in being able to bring up the properties of a windows file, which has been a standard part of the windows OS since at least win95, if not windows 3.1. I've been trying to use this .dll with word documents, .wpd documents and others. .wpd, wordperfect documents, are by far the more important since the documents I need to catagorize are in wordperfect format. The other .dll I couldn't get to work with .net was the wordperfect automation dll. I wonder if I can use the same sort of 'get properties' commands that you can get with ms word. well thank you for your help
  21. I havn't been able to figure out how to read or write to the name, author, subject, category, keywords or comments in vb.net. If its in there somewere, I'd be more than happy to to learn how to do it in .net, any suggestions?
  22. Well, that did something. I had the .dll added to my project as a resource before. Now I copied it to system32 and registered it. Now I get this error: I find the last part ironic, how it says its not an OLE document, because it actually says it is and its a download from microsoft. Any insight on this other error? Thank you for your help :)
  23. I'm trying to get file properties. I first got this type of error using the Wordperfect Application .dll. This error was from a .dll from microsoft for reading file properties. Here's my code I used: Private oFilePropReader As DSOleFile.PropertyReader Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click oFilePropReader = New DSOleFile.PropertyReader Label1.Text = oFilePropReader.GetDocumentProperties("C:\Source Code\DirMap.exe").Name TextBox1.Text = oFilePropReader.GetDocumentProperties("C:\Source Code\DirMap.exe").Keywords() End Sub Is there something wrong with the code? Is there a reason why .net won't accept those two .dlls, but it does accept others? If this won't work, is there another way to get a files attributes like: Author and keyword?
  24. I can access all the attributes through Shell32 or System.IO.Files, whichever is quicker or more efficient I'm not sure. But I don't need to access the attributes, I'm trying to get ahold of the text fields on the Summary tab page. You know, Name, Keywords, Comments, etc. I want to be able to read a word out of the keywords, or even sort them based on their Keyword. Someone sent me a .dll for vb6 (which I'm about to look into), and told me to use the Shell.Application. In .Net I don't see a Shell Application, only Shell32, which has TONS on folders and everything else, but I couldn't find anything on this. I'll try out the dll, but isn't there a way to do it IN VB.net? I mean, you should have full access to the windows environment. The only thing I'm left to thinking is API. I looked at AllAPIs.net and nothing jumped out at me for this situation. Any help would be greatly appreciated :)
  25. I've heard that C# and VB.Net are effectivly the same language, only with a different dialect. That C# is more comfortable for C users, but effectivly uses the same commands and shares the same speed/performance of VB.Net. I've also heard that C# is better for making games, so presumably better in some performance issues. Honestly, from the common sense I gather, unless it too offers backwards compatability to C/C++, it should perform better than VB.Net as there would be less overhead. VB.Net has to deal with a lot of backwards compatability issues. True they kicked a bunch of them out, but there are still redundant ways of doing things to keep the old vb6 programmers happy. I'm not sure how much overhead this is carrying, but it should be some. So which are the advantages of each? Does C# have the same database advantages that vb.net does? Does one outperform the other? is one easier or more robust? I've heard different answers to some of these questions looking around on these and other boards, but I thought I'd ask and get opinions and facts.
×
×
  • Create New...