Comatose 290 Taboo Programmer Team Colleague

Nothing that is readily, so to speak. You may have a look at bitblt or stretchblt to copy pieces of the image, but as for the whole region selection issue, I have no pre-defined method. Good luck, let me know what you find.

Comatose 290 Taboo Programmer Team Colleague

Sounds to me like something that is supposed to be installed is not. Also, you might be having a version reference conflict. Maybe the installed version of word doesn't use a specific method that's being invoked.

Comatose 290 Taboo Programmer Team Colleague

It's a problem with my code (BAH):

if right(SearchString, 1) = chr(13) or right(SearchString, 1) = chr(10) then
     ' /* Should be Left, Not Right */
     SearchString = left(SearchString, len(SearchString) -1)
end if
Comatose 290 Taboo Programmer Team Colleague
if right(SearchString, 1) = chr(13) or right(SearchString, 1) = chr(10) then
     SearchString = right(SearchString, len(SearchString) -1)
end if

Would Also Do The Trick... There's more than one way to strip a newline (ok, that one's bad).

WolfPack commented: Done. +3
Comatose 290 Taboo Programmer Team Colleague

That is the best way to do it. A couple things I would note on this. One of them, is the use of an empty string in the replace function. I know on small applications, that it doesn't make a serious difference, but an empty string uses memory space (well, more than a null value). A Character holds (I believe it's) 8 bytes. A Null Value holds like 1, or 2. So, in really big VB applications, changing "" to vbnullstring can speed up the app (benchmarks show by 40%) by using vbnullstring instead of "". So, you could redo the function as SearchString = Replace(SearchString, Chr(13), vbnullstring) to perform the same action, and save RAM usage. Again, I know this isn't extremely important, especially with modern machines, but it's good to know, and a nice practice to have.

The other thing, and I'm not sure if this is the intended result or not, but the above code will remove ALL chr(13's) from the string, not just the trailing one (when reading files, it's usually not a problem, since input will separate lines by newlines as it's read in, but a lot of apps that I have built require reading a file (or from a socket) 1 character at a time). An alternative method, if you are just wanting to remove the trailing newline, would be to use the left function SearchString = left(SearchString, Len(SearchString) -1) .

I'm sure that the replace function is a fine solution for …

WolfPack commented: Useful points there. +3
Comatose 290 Taboo Programmer Team Colleague

E-mail what? What Code Exactly?

Comatose 290 Taboo Programmer Team Colleague

post an example of the textfile, and we can go from there. The concept is fairly simple, however. You open the text file, and while you are reading in all the contents, compare each line with whatever you are looking for (say, the persons social security number), and then if they do not match, add that line to a string (or to another, temp file), and if they DO match, simply don't add it to the new file (or the string variable).

Comatose 290 Taboo Programmer Team Colleague

I know one solution, but it's not what you want to do. You could basically build a server app, in VB, which accepts connections on one specific machine. Then, each workstation would have another VB program, that would connection through the network to that server app, and upload the computer name, the IP address, and the logged in user. Then, when they log out, simple connect again, and have them removed from that database, but that's a lot of overhead for something that should be fairly simple. I'll keep looking around.

Comatose 290 Taboo Programmer Team Colleague

Cool, let me know if that fixes the problem...

Comatose 290 Taboo Programmer Team Colleague

I don't understand the question. If you could give a little more detailed explanation, I'll see what I can do.

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

I don't understand what you are doing. They are logged into a server, and you want to know which machine it's from?

Comatose 290 Taboo Programmer Team Colleague

Are you sure it is properly registered in the registry?

Comatose 290 Taboo Programmer Team Colleague

why can't you do it on mouse_move? On mousedown set a boolean flag variable that says that the mouse is down. On mouseup clear the boolean flag variable (set it to false). On the mousemove procedure, check if the flag variable is true, and if so, draw the line..... if the flag variable is false, don't draw the line.... or am I completely missing the mark here?

Comatose 290 Taboo Programmer Team Colleague

Cool, let me know how that turns out.

Comatose 290 Taboo Programmer Team Colleague

You can change which printer you want to printer with the printer collection. Check this thread: http://www.daniweb.com/techtalkforums/thread22650.html

Comatose 290 Taboo Programmer Team Colleague

Yes, But the code won't be the same as with CSV (Comma Delimited) File. Here are a couple of links on concepts. These links focus on using word, but excel is the exact same concept. Once you understand how the tutorials (creating office objects, and automating office apps), we can dive right into porting over your code to work with excel (if you want).

http://www.daniweb.com/tutorials/tutorial51307.html
http://www.daniweb.com/tutorials/tutorial51315.html

Comatose 290 Taboo Programmer Team Colleague

In fact, if you want to get crazy, you can do this:
1. Open Notepad (start, run, type in "notepad" without quotes)
2. Paste this code into the notepad document:

dim wsh
set wsh = createobject("WScript.Shell")
wsh.regwrite"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\ActiveDesktop\NoChangingWallpaper", 1, "REG_DWORD"

3. Click File, Save
4. Change "Save As Type" to "All Files"
5. For File Name, Set it to "Disable.vbs" (without quotes)
and save it somewhere you would like
-You can name this anything, as long as you keep the .vbs

Comatose 290 Taboo Programmer Team Colleague

My search also turned up empty....looks as though karland made sure there were no floaters left around. I suggest using a built in method, anyway, as it saves in troubles with mobility: http://www.daniweb.com/code/snippet36.html

Comatose 290 Taboo Programmer Team Colleague

Moved To Geeks Lounge (For discussion). I fully agree with you Aparnesh, in fact, I raise the question of: what kind of code are you writing using a cell phone keypad?? I have a bad enough time dealing with a VB IDE and a keyboard :cheesy:

Comatose 290 Taboo Programmer Team Colleague

yup, or you can change the value from 1 to zero... whichever floats your boat ;)

Comatose 290 Taboo Programmer Team Colleague

If it's XP Home, DavidRayan's Method won't work. I have found a way to disable changing the wall paper, but changing the screen saver is still in the works....
start, run, regedit
open hkey_local_machine
open SOFTWARE
open Microsoft
open Windows
open CurrentVersion
open policies
if you don't have an ActiveDesktop Folder below Policies, right click on the policies folder, choose new, key. Name it ActiveDesktop. If you DO have the ActiveDesktop folder, open it up.
Now, in the right pane, right click, choose new, and select DWORD Value. Name the new blue binary looking icon to "NoChangingWallpaper". Once it's there, and named, double click on it, and change it from 0 to 1.
Hit Ok. The desktop wallpaper shouldn't be able to be changed now.

Comatose 290 Taboo Programmer Team Colleague

If you are trying to print to the printer, why not use VB's built in printer object. Such as printer.print?

Comatose 290 Taboo Programmer Team Colleague

What do you mean by guide them? Like, give them steps, or are you talking about having them type the info into the VB App, and then having The VB Program actually change the settings?

Comatose 290 Taboo Programmer Team Colleague

A Little Bit Here. Basically, There is a module, and the module contains the API Declarations, The Required UDT's (User Defined Types) and a public function that when called, will show the dialogbox, and return what the user selected to the calling procedure (like in a variable) filename = dialogbox or whatever. As soon as the dialogbox is launched (in this example, with a command button), it enables the timer control. When the program is first run, the timer is not enabled (no need to be, since we only need to check for the dialogbox when we call the function to show the dialog box). The timers interval is set to 100 milliseconds... you can lower this if you want, but it seems to work pretty efficiently.
The timer code, basically looks for the dialog box window, and if it doesn't find it, it just exits the sub, and waits for the timer to fire again.... at 100 milliseconds, this doesn't take long. If it does find the dialogbox (this is done using the findwindow API) then it gets the dialog box's dimensions (left, right, top and bottom in pixels). It also gets the form's dimensions, and then calculates the width and height of the dialog box. It then calls movewindow to move the dialogbox flush with the left edge and top edge of the form, and then quites the timer.

The code itself is overly commented, so that you know exactly what's going on, and why. If …

Comatose 290 Taboo Programmer Team Colleague

I don't understand what you are trying to do? You don't want the C++ app to generate output to the Dos window?

Comatose 290 Taboo Programmer Team Colleague

I don't understand what you mean by "hiccup" in the listbox.... but if the listbox is bound somehow to a database, I think you have to modify the database to modify the listbox....(or maybe modifying the listbox modifies the database).

Truth be told, I do it the old fashioned way. Querry the database yourself, and use the listbox's as nothing more than a way of displaying the info to the user...

Comatose 290 Taboo Programmer Team Colleague

make sure you have read this thread first, and follow the links. If this proves to be of no help, attach the project in a .zip and I'll see what I can do.

http://www.daniweb.com/techtalkforums/thread53781.html

Comatose 290 Taboo Programmer Team Colleague

No... recdata is a variable that will contain information received from a socket. It is, in no way shape or form, an object. I don't understand what you are doing, or trying to get accomplished, but let me lay out how this reads:
1. Send The Literal String (send the word) "text1" across the network
- if you are trying to send the data that the user typed into text1
-across the network, you would do winsck1.sendata text1.text 2. declare X as an object variable
3. read data from the network, and store it in a variable called RecData
4. Try to set an object variable to the value stored in RecData
-set binds a variable to the specified object.
-you can not bind an object to a variable value....
-the RecData variable has no .text property, no enabled property
or any other kind of property.... it's just a variable that holds a
value, not an object variable.
5. Try to set the .Text Property Of the Object Variable X to "hi"
-Since You can't set X (an object variable) to a scalar variables
value, this will fail, if the line before it did not terminate the
program due to errors.

I do understand, however, what you are trying to do. You want to send an object reference across the network, and then use that object reference on the receiving machine. The problem is, the …

Comatose 290 Taboo Programmer Team Colleague

Ok, I have bad news. As far as I can tell, it can't be done with a commondialog control box. This is because the calling procedure (your app) gets frozen when the call to .showopen takes place. So, you call show open, and everything halts until the user either cancels, or selects a file. I do, however, have a workaround.

Does it have to be centered on the form, or can it be just over the form? The reason I ask, is because if the form is maximized, it will be different code than if the form is a normal sized window.

If the form is a normal sized window, is it cool to align the dialog box with the left and top edges of the form? This will put it on the same screen, and it won't look bad unless the form is bigger than the dialog box. I have been able so far, to center it (top of the dialog is centered between the top and bottom of the form, and the left edge is dead centered between the left and right edges of the form), but it looks really goofy.

The work-around requires the use of the API, and eliminates the need for the common dialog control at all... the only downfall (if you can call it that) is that the dialog window is different than the commondialog window. It's still a dialog to show open, but it's the same one that Operating system …

Comatose 290 Taboo Programmer Team Colleague

By screens you mean monitors right? As in, you have two monitors, and you click "open" in your app, and it loads the commondialog on the other monitor?

Comatose 290 Taboo Programmer Team Colleague

Sorry it has taken so long to respond, I've had a lot on my plate....

The problem here, is that what you want to do, requires a control array. VBA (Excel) doesn't allow control arrays, and therefore means you have to modify your for loop.

An array, is a variable that has many slots for values. I try to describe the simplest form of an array, like an egg carton, with 1 row for eggs. There is only 1 egg carton (1 variable, say X) but a number of places to put eggs (called an index). So, The variable X can be like this:

X(0) = "hello"
X(1) = "goodbye"
X(2) = "some more stuff"

Well, you can do the same thing with controls (at least, in VB4, 5 and 6). You can make a control array (which would be many controls, all with the same name), in two ways. 1, is to put a control on the form, with the same name as another control (lets say, you add two command buttons, command1 and command2, then change command2's name to command1) and VB will notice there is already a command1, and ask you if you want to make a control array. The other way, is when you add a control to the form, change it's "index" property to 0. Then, whenever you name a control the same name, it will just change the index of that control.

The bad news, is VBA (the VB that …

Comatose 290 Taboo Programmer Team Colleague

set the field's (guessing a textbox) .enabled property to false? text1.enabled = false

Comatose 290 Taboo Programmer Team Colleague

What was the solution? That way, should this problem arise again, we can have the fix available?

Comatose 290 Taboo Programmer Team Colleague

For those of us (myself included) who have been tracking this thread.... what was the solution?

Comatose 290 Taboo Programmer Team Colleague

You mean, if they choose a database.... close the program, and then open the program up again, you want the database to still be the same... right?

Comatose 290 Taboo Programmer Team Colleague

There are a ton of reasons why this can/would happen. Runtime Error 490 is inability to open the specified file.... it doesn't really give a reason, but for some reason it failed. Application.FollowHyperlink Me.form_location is the line that it would have flipped out on, the problem, however, is that there is nothing wrong with the code..... Application.FollowHyperlink is generating the error. When you call the FollowHyperlink method, it tries to do it's thing, and fails. I'm guessing that maybe there is still a copy of Adobe open, hiding in the background, or windowless.... maybe an object reference to it is still active.... without the actual document in question here (the database AND the external file) it makes it a lot more difficult to tell.

Comatose 290 Taboo Programmer Team Colleague

I can't really tell by your code, but is this VB express, .NET, or Legacy (VB 4, 5, or 6)? If it's Legacy VB, could you attach the project in a .zip to your next post, so that I can download your code, and see your problem. The truth is, I can't even replicate your error. I'm guessing, since vb6 doesn't have a .checkstate property for checkboxes, that it's not VB6. Something to check, and I see (based on your question) why you would have done this, but you are testing the checkboxes .value property against an empty string (""). Something to consider, would be testing against vbnull or vbnullstring.

Comatose 290 Taboo Programmer Team Colleague

Setting The Listbox to have multiple columns will not work the way you expect it to. Having a Mult-Column listbox will only show both columns, when the length of the first column is full. To illustrate this, start a new project, and drop a listbox on it. Change it's columns to 3, and add this code to form_load:

For I = 0 To 300
    List1.AddItem I
Next I

As you can see (depending on how "tall" you made the listbox) the first column fills up first, then the second, and third.... so on. In order to do what you want, it will take a bit of crafty programming, using the API. Check this site for further details: http://www.thescarms.com/vbasic/listbox.asp

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

Yes. It's not generally done, and will probably make your code more difficult to follow and understand when you are trying to add/update things later..... beyond that, as was mentioned in another thread, you'll be using more memory (to create an object variable to an object that already exists) to work with data and store data that already exists in the object. HOWEVER, it CAN be done. Here is a small example that I just built, with nothing but a form and a textbox..... in the form_load, I put this:

Dim x As Object
Set x = Text1
x.Text = "hi"

And the .text property of the text1 textbox has changed to "hi". Again, I advise against this method for a large number of reasons, but certainly it can be done, and will work.

Comatose 290 Taboo Programmer Team Colleague

Well, when it goes black you are connected. Some server programs will send information first (on connect, say "Connected.", or some other short way of letting you know), and some will prompt you with a prompt.... like a unix shell, or a login.... yours just stays blank, which is fine, you don't need a prompt. To send the information, just type whatever your app would send, and then hit enter... (I don't remember, you might need to hit enter twice). I dunno why he can't can't to you..... are you running the same server app as he is?

Comatose 290 Taboo Programmer Team Colleague

lover's method is accurate, and will work.... however, it's not good programming style. As Waltp Mentioned, it's easier first off, to reference the object hierarchy, and beyond that, why would you want to use memory space (a variable) to contain information that's ALREADY stored somewhere? That will slow down the program (more processing, and memory usage) and make code a bit more difficult to read....

Comatose 290 Taboo Programmer Team Colleague

For sending e-mail attachments, or do you mean once you have downloaded the e-mail messages from a pop3 or imap server, you want to have a link to the attachment (which, at this point, should be a local file). What exactly are you doing?

Comatose 290 Taboo Programmer Team Colleague

A helpful technique that I use when testing socket programs (you are running the same server program that he is right?) is to use telnet. Start, run, type in "cmd" (no quotes) hit enter. Then type in telnet hisIP PORTNumber... so it will look something like telnet google.com 23 . Then, send any data that your client program would send. Telnet will let you know if you made a connection or not, and will let you know if the server responded.....

Comatose 290 Taboo Programmer Team Colleague

Which Can but shouldn't be done ;) (the hard way)

Comatose 290 Taboo Programmer Team Colleague

:( wow. I guess you're right.

Comatose 290 Taboo Programmer Team Colleague

The guy who's not behind the router/firewall?

Comatose 290 Taboo Programmer Team Colleague

I wouldn't suggest going about it that way. You can add a textbox to the form, and set it's "multiline" property to true. Then go to the "scrollbars" property, and choose if you want vertical, horizontal, or both. They will only be active when the data goes beyond the textbox, and basically works as you would expect.

Comatose 290 Taboo Programmer Team Colleague

;) no problem.