Comatose 290 Taboo Programmer Team Colleague

Post the relevant section of code also, say form_load if that's the portion of the EXE that's generating the error.

Comatose 290 Taboo Programmer Team Colleague

*Nods*

That adds tact to a touchy situation. A lot of times, people post here, expecting someone to do their assignments. I've even been asked to help someone who was taking a final examination at the very moment.... W00dy has shown a very elegant way of making sure they are putting forth honest effort.

Comatose 290 Taboo Programmer Team Colleague

Visal brings up a good point. If there is a loop (or a method that is blocking), then your app may not do much more than freeze (or appear to). Post the code as a .zip, or put it in code tags so we can check out what's going on.

Comatose 290 Taboo Programmer Team Colleague

Which is exactly why I posted it. I was never infering that you intended to do the assignment for him, so much as I was unsure if he was expecting someone to write it for him. Anyway, thanks for the clarification for the benefit of other viewers.

Comatose 290 Taboo Programmer Team Colleague

Nice Job Visal!!!!

Comatose 290 Taboo Programmer Team Colleague

A Link you should check out is a great tutorial right here:
http://www.daniweb.com/techtalkforums/thread26892.html

Comatose 290 Taboo Programmer Team Colleague

Ok.

Let me just reiterate that we DO NOT do homework assignments for people. If you are putting forth a strong amount of effort, and are stuck on a problem, we will gladly help you overcome such a situation. Once you start on the project, upload the code, and I'll be glad to look at it for you.

Comatose 290 Taboo Programmer Team Colleague

I'm sorry, I never recieved the e-mail. If you could post it here as a .zip attachment, that would be great.

Comatose 290 Taboo Programmer Team Colleague

Depends on what type. There are activex componant for just about anything....

Comatose 290 Taboo Programmer Team Colleague

what you do, is set the timer's interval to 1 second. Then use a variable to keep track of the minutes (start at 0, and add 1 to the variable every time the timer fires, then, if the variable is equal to 59 [0-59 is 60 seconds], then reset the variable back to 0, and add 1 to your "minute" count). This will let you keep track of the program down to the seconds, and will still keep the integrity of the minutes... if you need more in-depth help, attach the project in a .zip file, and I'll gladly fiddle with your code.

Comatose 290 Taboo Programmer Team Colleague

Alvein has a real good point about opening and closing connections too frequently. It's been my experience with Access and VB, that doing a large number of opens/query's eats up value processor time, when only one connection is needed.

mnemtsas has a great tutorial on using Access with VB, and it's posted as a sticky thread at the top of this forum.

Comatose 290 Taboo Programmer Team Colleague

Right. Ocx's need to be registered just like a .dll or some other componant (you can use regsvr32 to register .dll's and ocx's.), but as pointed out above, the liscence might be limited.

Comatose 290 Taboo Programmer Team Colleague

Nice Response there mnemtsas, and should you need any further information regarding Tan (or other commands): http://www.int.gu.edu.au/courses/3008int/m03/FYI/Command_Syntax.htm#Heading197

Comatose 290 Taboo Programmer Team Colleague

You could use getactivewindow or getforegroundwindow. That should return the hwnd of the currently active or the currently foreground window.

Comatose 290 Taboo Programmer Team Colleague

Have you looked at this tutorial http://www.timesheetsmts.com/adotutorial.htm? I realize it's for access, but I'm pretty sure that the OO of it allows for interfacing of any database system, but I could be wrong.

Comatose 290 Taboo Programmer Team Colleague

What language are we talking about!? It sounds an awful lot like a C function in USBCDCEthernet.h, but I'm not sure.

Comatose 290 Taboo Programmer Team Colleague

Sure.... OR you can use the catalyst control from http://www.catalyst.com that comes with socketwrench. I prefer mscomm, but the control from catalyst is real easy to use.

Comatose 290 Taboo Programmer Team Colleague

Sure is, plus this aids in clarity of code. I understood your code, but In my opinion it's a lot easier to read without a ton of API calls. GetTemp's are great also, for getting the temporary path on any machine. Let us know how it turns out.

Comatose 290 Taboo Programmer Team Colleague

One solution that I'm fond of, in order to make VB search an entire drive is to shell a dos command of dir and redirect it into a file. Then open the file (which will contain a list of all paths to the files of a specific criteria), read in the paths line for line, and do something accordingly. For example:

dim wsh
dim PathList() as string
ReDim PathList(0)
set wsh = createobject("WScript.Shell")
wsh.run "dir /a/s/b z:\*.mdb >Z:\tmpfile.dat", 0, 1
open "z:\tmpfile.dat" for input as #1
     do until eof(1)
          line input #1, tmp
          PathList(ubound(PathList())) = tmp
          redim preserve PathList(UBound(PathList()) + 1)
     loop
close #1
kill "z:\tmpfile.dat"

That should work to load the string array PathList with a list of paths and filenames to MDB files.... if your system doesn't support Scripting (such as the createobject of wscript.shell) then you may need to use API calls (shellexecute) so that you can shell the dir command AND have it wait for the shell to complete before your VB code continues (what a mess it would be, trying to read from a file of paths that isn't done yet huh?). Let me know how it turns out, or if you need further assistance.

Comatose 290 Taboo Programmer Team Colleague

Not only backticks, but also the command "system" works to execute external files.... you could also use an open command, and open the process with a pipe, but I'm not sure exactly what you mean about having 1 script run the same file on a bunch of machines... if you could be a little more specific it would help a lot.

Comatose 290 Taboo Programmer Team Colleague

Most likely because the file refered to by the variable PTextPass probably does not exist on your system. In the form load event, you'll see that PTextPass is refered to by app.path and then ptextfile.dat. If the file DOES exist on your system, then there is no reason that line should error out. I have just downloaded the file onto a clean system (with a fresh install of VB) and it has worked flawlessly.

Comatose 290 Taboo Programmer Team Colleague

have you tried running it in the VB IDE? If not, you might try that, and tell us which line gets highlighted....

Comatose 290 Taboo Programmer Team Colleague

sure, you can get the filesize, through unconventional means, OR you can get the file size in long value, and check if it's larger than 2GB, (just check the long value size), if it IS bigger than 2GB's, then generate 2 temp files, with 1/2 of the file in each (or more, if it's bigger than 4 gigs, or whatever). Then, in order of the temp files, read each one the standard way, and use the function on those. It seems like a bigger pain than is needed, but I'm sure it would work. I suppose another option, would be to read the file byte by byte, an d concantenate a variable, while keeping another variable to keep track of the size.... but that also seems like a bit of a pain.... let me know what you come up with.

Comatose 290 Taboo Programmer Team Colleague

You should read this thread, so you get an idea of what's happening, and then use a similar fashion with your VBA:
http://www.daniweb.com/techtalkforums/post85128-2-15.html

Basically, figure out the path to adobe's acrobat, then load it with a shell command, and pass it the switches needed to print. Let me know if I should elaborate more.

Comatose 290 Taboo Programmer Team Colleague

http://www.officecomputertraining.com/vbtutorial/tutpages/page42.asp is a pretty good tutorial about classes in VB. Hopefully it will help some.

Comatose 290 Taboo Programmer Team Colleague

I'm guessing the problem is because QBasic is NOT installed. It came with older versions of Windows, and just about all DOS systems... however, with the advent of 2k and XP, I'm pretty sure that they don't have QBasic any more. I'm sure you can search around, and find a freeware version waiting for download out there somewhere..... try:
http://www.qbasic.com/frames.shtml, then click files, and compilers....

Comatose 290 Taboo Programmer Team Colleague

because there is a space between: dbl and Number1.... you can't do that. Someone screwed up, because a variable can NOT have spaces in it.... I bet they meant:

Dim dblNumber1 As Double
Comatose 290 Taboo Programmer Team Colleague

Here is a function you can use, just stick it in a module:

Public Function GetShortcutPath(ByVal FileName As String)
    ' /* Declare Variable To Hold Shell Object */
    Dim WSH As Object
    ' /* Actually Set The Variable To A New Instance Of WScript Shell */
    Set WSH = CreateObject("WScript.Shell")
    
    ' /* Declare Variable To Point To The Shortcut */
    Dim sc As Object
    ' /* Set The Variable To The CreateShortcut Method of WSH */
    Set sc = WSH.CreateShortcut(FileName)
    
    ' /* Call The TargetPath Property, Returning The Path Pointed To */
    GetShortcutPath = sc.TargetPath
End Function

Then to use the function, simply call it like so (using your source):

CommonDialog1.Filter = "Link Files (.lnk)|*.lnk"
CommonDialog1.ShowOpen
Text1.Text = GetShortcutPath(CommonDialog1.FileName)

A small warning, however, is that some security programs disable the windows scripting host (such as norton) and if this is done, then the code will not work (since WScript.Shell is windows scripting host). I'm researching an alternative method using API calls so that this can be avoided....

Comatose 290 Taboo Programmer Team Colleague

That's a pretty tough question to answer, but here is snips from the catalyst help program (that comes with socketwrench):

The Accept event is generated when a remote host connects to a listening socket.
The Connect event is generated when a connection is established.

In the accept method, you don't actually have to accept the connection, you can check to see if you have reached, say, your max allowed connections (pretend you want your server to only have 10 connections at once). After you "allow" the connection, then the connect event fires, saying "hey, we have a good accepted connection." Mind you, the accept event ONLY applies to a listening socket (a server), because a client socket only tries to make a connection (this doesn't mean that an application can't have both, listening and connecting sockets, but that once it's a listen socket, it accepts connections (or denies them), and once it's a client socket, it tries to connect to an accept socket).

Now, what we do is, we have a "control array", which is just an array of VB controls. They have an index just like any normal array, and can be looped through, and everything else. Now, on socket accept, we have no max connection... we just keep accepting, logging, and disconnecting sockets. Now, when a user or program [or virus] wants to connect, our socket accept gets spawned. We don't have a max connection limit or anything like that, so, we add a new socket …

Comatose 290 Taboo Programmer Team Colleague

The only thing I get is an EXE, which I will NOT run unless I have the source code (then I'll compile it and run it).

Comatose 290 Taboo Programmer Team Colleague

Try posting just a wink ;)

Comatose 290 Taboo Programmer Team Colleague

*Nods and mumbles something about 10 character minimum post*

Comatose 290 Taboo Programmer Team Colleague

No. You are absolutely correct. I tried to do it that way also (skipping variables) and it gets pretty upset. I guess it's just the name of the game, and I appreciate your return response.

Comatose 290 Taboo Programmer Team Colleague

I'm not sure exactly your infrastructure, as in, are you trying to read the CGI output (HTML)? Are you trying to find out if the launch was successful? I'm pretty sure you can write or get the HTML from the page in the InternetExplorer.Application class, and once you do, you can rip apart the HTML, and do what you need to accordingly.

Comatose 290 Taboo Programmer Team Colleague

I would suggest setting your timer to 60 seconds (1 minute) OR every second. Then keep a variable that gets incremented as the timer fires. Then you can check it for the time in question, and fire it accordingly.

Comatose 290 Taboo Programmer Team Colleague

The above is a pretty good post. I've used similar code in my universal player (mp3's, Wav's, and Midi's) and it seems to work great for me.... nice post techniner

Comatose 290 Taboo Programmer Team Colleague

I'm not so sure that an OCX that is out of date would give you an out of memory error (unless the memory management routine that it's using is calling API's or using a method that works differently now). I would like to see the form_load code.... if you figure out the solution, please post it for others to see.

Comatose 290 Taboo Programmer Team Colleague

I personally find end to be ungraceful and tacky. If you do anything with hooks (especially system-wide hooks), or subclassing, and even with the use of many objects (using createobject), using "end" is an awful idea. While it's purpose was meant for good, in programming practice, is just awful. I have a made a sub I call die, which is part of my standard module (one I add to every project) and it works like this:

' /* For all The forms in the project */
for each XFrm in Forms
     ' /* Unload The Form */
     unload XFrm
next XFrm

' /* Code should never reach here, but just in case */
end

The "end" keyword will never be reached, but it's a catch in case something doesn't unload properly... however, unloading all the forms in the project (instead of using the violent and ungraceful "end") is the best way to go.

Comatose 290 Taboo Programmer Team Colleague

You can not create a dialog box or toolbar in the same way. Let there be no mistake about it, the forms, messagebox's, dialogue boxes and all buttons are created by windows, even when you use VB. You have to have a program to actually make windows create one, and you can not do so just as a "user" of the system. Certainly, they will pop up when windows demands the need for one, but it's not going to be designable, like in VB.

Comatose 290 Taboo Programmer Team Colleague

It would seem to me that you are looking for a property that doesn't exist in LDAP. Have you checked the name of the property? Post the code, and I can look through it.

Comatose 290 Taboo Programmer Team Colleague

then that means that there are no errors being output (which is a good thing). If you can actually paste the output here, it would help a lot.

Comatose 290 Taboo Programmer Team Colleague

I like that idea.... I'd like to see source code for it :)

Comatose 290 Taboo Programmer Team Colleague

As a person who is diligent in the open source community, even programs that are NOT open source, should still have the availibility to have the settings altered fairly easily. That's one reason I've hated proprietary software, is because it's on my computer, I should be able to mess with it as I please..... If I want to change the settings with Notepad, or DOS Edit instead of some gui that someone has decided was the best interface, I should have the option and that right, and that should be made fairly easily to access. Granted, you could use regedit to "manually" alter settings, but it's the principle of the idea behind it. Plus, there isn't really that many more steps needed.... on form unload, simply do an open for output (which overwrites previous values) and on form_load read the input into the correct textboxes.... but either way you choose to do it, I wish you the best of luck.

Comatose 290 Taboo Programmer Team Colleague

This is a question that is rather open ended, and doesn't apply strictly to VB. It would be better suited in a geeks lounge, or some other area that refers to non-direct technical VB questions (such as, how would I change the screen saver with VB). However, To answer your question, such an estimation would take knowledge of exactly what needs to be done.... if your client wants me to build an internal messenger system, capable of e-mailing, and Messaging.... while leaving it "business oriented" for their business.... I'm likely going to have to put in a lot more time, and a lot more effort than a simple "parse text file" program, or something less complicated for their human resources.
Not only the amount of "options" and difficulty of implimenting those... but also how much effort and time YOU have to put in to it. If you figure that with all the options they want, it's going to take you a couple days, I'd probably charge less than if it was a project going to take me a couple weeks. This also leaves out questions about the size of the company and their intended uses.... if they want my program on just 1 pc, or will it be on a lot of PC's or on a Network? You really have to examine the project and the situation before giving an estimate or quote of that nature...

Comatose 290 Taboo Programmer Team Colleague

Just a plain text file.... something lto write the file ike:

open app.path & "\settings.dat" for output as #1
     print #1, text1.text
     print #1, text2.text
close #1

and read it like:

if dir(app.path & "\settings.dat", vbnormal) <> "" then
     open app.path & "\settings.dat" for input as #1
          line input #1, text1.text
          line input #1, text2.text
     close #1
end if
Comatose 290 Taboo Programmer Team Colleague

The easiest way to do this, is to have a settings file (you could use the registry also, but I find files are easier to clean up, and fit logical structure a lot better). In your settings file, you have 1 line per text box (or default value). This way, line 1 of the file will always be the default value for text1. Line 2 for text2, etc, etc. Then, on form load (or sub main, or whatever), just open the file for input, read it in, and set the values accordingly. This is how I do it. I actually have a sub that I call on startup, that makes sure everything is set before it actually loads. I just callt he sub in form_load, and it makes sure I have directories (should I need them), and if I have settings it loads the settings....

Comatose 290 Taboo Programmer Team Colleague

I always find shelling to be a convient way to execute simple operations.... certainly you could always use a rename function or an API call, but it's just as easy to shell with the rename command.

Comatose 290 Taboo Programmer Team Colleague

so, you want to understand how the parallel port works with data, or binary, or what? I'm a little confused as to what exactly you need.

Comatose 290 Taboo Programmer Team Colleague

I'm wondering if, maybe, the ITC version that is used on 2k is not compatible with XP.... I know that sounds a little far fetched, but if that is the case (which is sounds like to me) you could create a sub folder for XP, and 2k, and have the required version of the control in each sub folder, and then test what version of windows you are on, and copy the itc accordingly....

Comatose 290 Taboo Programmer Team Colleague

That was a trick I used to use in Batch file fun.... :)