Comatose 290 Taboo Programmer Team Colleague

Sendkeys is a command in VB that allows you to send keystrokes from your app to the currently active (foreground) application. For example, you can open a blank notepad document, and send something to it like so:

Shell "c:\windows\notepad.exe", vbNormalFocus
Me.Show
DoEvents
AppActivate ("Untitled - Notepad")
SendKeys "hello world"

The problem, is that you need the window to stay behind your application, and therefore, sendkeys will not work.

Now, you can TRY to use the windows API.... which has certain function calls that might help.... one of those function calls is "sendmessage" which allows your program to send a windows message (a hex number that windows understands to do something). Everything that happens to a window, mouse move, mouse down, mouse up is done by a windows message. One of the windows messages, is called "WM_SETTEXT", which has some hex value... pretty nifty huh, WM for windows message, and settext for what it does....

Now, we've just increased our power significantly from sending keystrokes, to sending any kind of message that windows can send....(just about, this isn't the C language, so we have no power in pointers [except addressof, but not really the same]). This leads us to a major problem.... it's all find and dandy, but we have to know the hWnd to send this information to. Every window (mind you, everything in windows is a window.... a textbox, a listbox, a window, a button, they are all a window) every window has an hWnd. An …

Comatose 290 Taboo Programmer Team Colleague

it would probably be to have 2 forms on the screen.... you COULD probably move it, but it doesn't really like it.....

Comatose 290 Taboo Programmer Team Colleague

Hmn, it should....

Comatose 290 Taboo Programmer Team Colleague

If you have VB6, It's better if you compile it yourself, because you can change the key used for encypting the password, here is the source...

Comatose 290 Taboo Programmer Team Colleague

Certainly.... it's coded in VB6, and I can attach both an EXE and the source code (in case you don't have a compiler)... let me work out the kinks and I'll post both up here.

Comatose 290 Taboo Programmer Team Colleague

I can make a program that does this if you want.... in fact, I've already started working on one (some time ago), I can resurrect it and finish it up if you'd like.....

EDIT: The code is just about done now.... I'm going to test it and work out any kinks, but it seems to work swell. How it works is, on the first load up you give it the information, username, password, domain (if applicable), and the path to the program to run. Then you hit save, and it saves all that info in the registry.... it also encrypts the password. It's not a super-secure algorithm for the encryption, but it keeps it from being plain text, and it might take a little work to get through. Everytime you run it after that, it reads the info from the registry, and uses it to the launch the program you have specified as the user you have specified.... if you need to change the information used by the program, all you do is pass the program any parameter, and it will load the GUI to change the info.... (or you can get crazy, and do it in the registry). There can even be an icon for loading the gui seperately..... anyhow, let me know if you want it.

Comatose 290 Taboo Programmer Team Colleague

Tayspen: Does that save the settings after you reboot?

Comatose 290 Taboo Programmer Team Colleague

Ouch, that's going to be tough, because most of the mechinisms required to directly affect another program require that program to have focus..... you can use SENDMESSAGE (the sendmessage api call) and try to send say WM_SETTEXT to the textbox in question, while leaving it in the background.... but finding the hWnd (Windows Handle) of the textbox in another program's thread is going to be real tough..... you can TRY findwindowex, (in conjunction with findwindow) but you are going to have a tough time with that.

Comatose 290 Taboo Programmer Team Colleague

you would need to use sendkeys..... there is a more complicated method, but I'm not sure if you can obtain the child hwnd of a cross-task app, and have control over it with sendmessage.... your best bet, is to use sendkeys.

Comatose 290 Taboo Programmer Team Colleague

Perhaps.

Comatose 290 Taboo Programmer Team Colleague

It's a matter of principle. Plain and simple. I started programming because of the fact that there were things I wanted on the system to be different, that were a specific way by default.... if I want to make any window stay on top of any other, damn it, I should be able to do that.... it's a matter of principle....

Comatose 290 Taboo Programmer Team Colleague

I will say that Davey's writings aren't pointless.... it helps to keep me up to date on situations that I don't have the time to research.... some people, who write blogs merely about themselves, and have no concept of anything else.... yeah, that's a different story.

Comatose 290 Taboo Programmer Team Colleague

While I love reading blogs.... I just don't blog to the community of bloggers.

Comatose 290 Taboo Programmer Team Colleague

*Mumbles something about Police Officers Abusing Authority with Attitudes and Deserving Some Kind of retaliation*

Comatose 290 Taboo Programmer Team Colleague

you can use vartype to see if a variable is of a given data type.... for example:

If VarType(hWndOrForm) = vbLong Then
    ' /* Set hWnd To The Value Of The Passed Long */
    hwnd = hWndOrForm
Else
    ' /* Otherwise, It's A Form That Has been passed... Grab It's Handle */
    hwnd = hWndOrForm.hwnd
End If

checks to see if the variable is of type long. If it's about formatting, you can use the format$ function to reformat the data they posted (for example, a date in the wrong layout), or you could split apart the string and see if unauthorized characters (letters in a currency field) are found...

Comatose 290 Taboo Programmer Team Colleague

ctrl-printscreen seems to copy a screenshot (in XP anyways) to the clipboard..... then you can run mspaint (start run mspaint) and paste it into paint, in which case you can manip the image...... then when posting your thread (in advanced mode) there is an option to attach a file.... save the file in mspaint and attach it in the thread.....voila.

Comatose 290 Taboo Programmer Team Colleague

What kind of errors?

Comatose 290 Taboo Programmer Team Colleague

You want to embed excel into the form, or you want to read the excel data and display it?

Comatose 290 Taboo Programmer Team Colleague
Sexy
Comatose 290 Taboo Programmer Team Colleague
Comatose 290 Taboo Programmer Team Colleague

Ok, let's not bump old threads... if you have a question, post a new thread, and we will try to get you answered..... did you read the sticky thread?
http://www.daniweb.com/techtalkforums/thread41057.html

Comatose 290 Taboo Programmer Team Colleague

I figured it out, you have to create a stupid account and log into live windows.... let me see:
http://www.microsoft.com/windowsvista/getready/preview.mspx, then you log in, and it goes through like 113 redirects. The final product should have links for download, and a product key... I would paste that URL, but I'd be willing to bet you'd get an invalid login and get redirected to step 1 of my process here.... Now if only I can get it to freakin install :eek:

Comatose 290 Taboo Programmer Team Colleague

I just downloaded the beta 2 of windows vista..... went to install the upgrade, and it needs an installation key..... my question is, how the hell do you obtain this key?

Comatose 290 Taboo Programmer Team Colleague
Comatose 290 Taboo Programmer Team Colleague

VB can handle it by itself.... and would be easier than learnng the SQL Query's required to generate the kind of data and report that you want to do.... I will say to each his own. How I would do it, is I would build a VB program to handle all the data until the report is generated.... after the daily report is done, THEN add the daily record into the access database for storage and easier retrieval later.

I don't know all of the data that you want to add, so I can't give you a best explaination, but from what you said, they input all the amounts recieved, and the vb program can simply tally that up, (and store all the data of the money recieved throughout the day in a temp file) at the end of the day, generate a report, and save it in access for storage. Let us know what you come up with though.

Comatose 290 Taboo Programmer Team Colleague

Eah, freakin' web browser forced a double post!

Comatose 290 Taboo Programmer Team Colleague
Comatose 290 Taboo Programmer Team Colleague

I can make it so that i can't be moved..... but I'm struggling with the removal of the gay line.... I'll keep working on it though.

Comatose 290 Taboo Programmer Team Colleague

hahaha :)

Comatose 290 Taboo Programmer Team Colleague

The reason that's so crazy, is that the rabbit hole leads to wonderland...

*mumbles something about space-time continums and wormholes*


"Oh, by the way, if you'd really like to know, he went that way" - Cheshire

Comatose 290 Taboo Programmer Team Colleague

I seen it yesterday, but not today.....

Comatose 290 Taboo Programmer Team Colleague

Yeah, I talked to Dani about it, an she fixed the thread...

Comatose 290 Taboo Programmer Team Colleague

If it's a folder (BIT) then del won't get rid of it. You'll have to use rd or rmdir (same command). so, something like: rd /s "c:\my shit\BitTorrent\BIT" did you try the link http://www.purgeie.com/delinv/index.htm and see if that program works.....

Also, something else that throws me, is if that file is the one that won't get deleted, why does it say: CAIDWFIT? Is CAIDWFIT the file inside the BIT folder? Also, bit torrent isn't running when you try to delete this is it? If so, naturally, it won't work. If bit torrent is NOT running, and the dos commands don't work, let me know.

Comatose 290 Taboo Programmer Team Colleague

is it just me, or is this thread empty:
http://www.daniweb.com/techtalkforums/thread47461.html

I have recently answered a post in that thread, and now the screen shows blank..... any ideas?

Comatose 290 Taboo Programmer Team Colleague

You can monitor a directory (it doesn't appear that you can monitor just a single file). But if you monitor the directory that contains the file, whenever any file in that directory gets modified, your program will get alerted. This rely's on an API call to ReadDirectoryChangesW, check this link:
http://www.vbcity.com/forums/topic.asp?tid=28055

Comatose 290 Taboo Programmer Team Colleague

You can go into Dos, and try to delete the file manually using it's short name..... or trying doing it using wildcards. You could also try this tool:
http://www.purgeie.com/delinv/index.htm

If the file is not invalid (assuming this tool doesn't fix the problem) let me know.... either the filename is invalid, and windows can't access it (for a number of reasons), or another app is using the file and won't release it (in which case I can get around that). Let me know.

Comatose 290 Taboo Programmer Team Colleague

What's the path to the file? It's on the desktop? Also, are you able to do anything to the folder, such as set attributes (system, hidden, read-only) or can you do absolutely nothing with it?

Comatose 290 Taboo Programmer Team Colleague

I've done that..... it didn't uh, work as well as one would hope. I always thought a slick thing to do would be to build an IRC client where you can tag a user.... and then when they are tagged, whatever they type will spoken (text2speech) through the speakers..... This way you don't have to flip back and forth all the time.

Comatose 290 Taboo Programmer Team Colleague

Hahaha, if I was professor maybe....

Comatose 290 Taboo Programmer Team Colleague
Comatose 290 Taboo Programmer Team Colleague

I've done this..... it requires the microsoft text-to-speech control. The package (if you google, you should be able to find it) has controls to go in both directions (text to speech, so the computer can talk to you, and voice recognition, so you can talk to it, and it can respond).

http://www.microsoft.com/MSAGENT/downloads/user.asp#tts

Comatose 290 Taboo Programmer Team Colleague

Plus a database would be a serious waste of database (and processing) power to handle a few values that need to be saved.

Comatose 290 Taboo Programmer Team Colleague

;) why not?

Comatose 290 Taboo Programmer Team Colleague

You'll have to post your code, or attach your project.... if I understand you correctly, I don't understand why, when they change the value of the variable, you can't write the new value to the database at the same record location..... then there is no comparison needed, the database has the new value.... are you using Access or SQL? Is this a flatfile database?

Comatose 290 Taboo Programmer Team Colleague

Sure, I just ask you let me know what you plan to do (so others reading can get a good resolution to it too). If you have any other questions, ask away... someone will answer.

Comatose 290 Taboo Programmer Team Colleague

Also Some of the programs you use in windows you can run in linux with Wine, which is difficult to set up for someone who doesn't have a lot of linux experience, but is pretty durn good.

Comatose 290 Taboo Programmer Team Colleague

Hmn, does it have to be from the .dbx file, or can you use vbscript to retrieve the addresses?

Comatose 290 Taboo Programmer Team Colleague

Is the captured text from your own program, or a different program? Again, if you explain what you are trying to do, I can help you a bit more.

Comatose 290 Taboo Programmer Team Colleague

Are you talking about making VB click one of it's buttons, or do you want to click buttons in another app's program? You can make VB click one of it's own buttons by simply setting it to true. So, pretend you have form1, and 2 buttons (command1 and command2) command2 exits the program, and command1 does a msgbox, and then exits the program. The code for command1 could look like this:

msgbox "goodbye"
command2 = true
Comatose 290 Taboo Programmer Team Colleague

You should be able just to reference those elements. Let's pretend you have form1, and form2. You have a button on form1, and a combobox on form2. In the code for the button on form1, you could do this msgbox form2.combo1.text , and it will gladly display the information in form2's combobox, with a click of a button on form1. If you are talking about something more complex, you may need to delve into using files, or registry entry's as a means to save your data for use from another app or something like that.