hkdani 39 Posting Pro in Training

Good grief!

There was a time when fgets did not exist.

And people said, "gets works."

Now, the more enlightened say it doesn't.

It works under certain conditions. It does not work under other conditions.

Is it safe?

Well, as long as there are hackers out there who have nothing better to do than to break the 1's and 0's of a novice programmer, then there might be a small percentage of instances in the life of gets where gets does not work.

Other than that, I just don't get your logic.

hkdani 39 Posting Pro in Training

Au contraire. If it only sometimes works, it's broken.

Do you work? If so,would you accept a $100 drop in pay this week because the payroll program only makes a mistake once in a while and doesn't add your hours correctly? After all, it is only once in 3 months...

Close enough doesn't work in computers.

Definition: works

It does the job.

Is it acceptable to WaltP?

I really don't care.

WaltP commented: No. Definition: Sometimes doesn't do the job correctly, doesn't work. -2
hkdani 39 Posting Pro in Training

hii.i want to implement movable images in my project like from left to right or top to bottom..please do help me out..if possible just give an illustration.........waiting for reply..thnx in advance

Private Sub Timer1_Timer()
   Dim lngFormEdge As Long
   lngFormEdge = Width
   
   With Image1
      If .Left + .Width < lngFormEdge Then
         .Move .Left + 20
      Else
         Timer1.Enabled = False
      End If
   End With
End Sub

Set your timer to whatever milliseconds you want: 1 is equal to 1 millisecond.

hkdani 39 Posting Pro in Training

And no, if something allows errors to happen it doesn't work.

Hey, if it works sometimes, it works. That's just a simple, logical fact.

My car works. If it doesn't start the first time, it does not mean that it doesn't work. It just means that it did not work that time.

If it doesn't work sometimes, it does not work sometimes.

You exist. Errors happen.

Do you work?

jephthah commented: gross logical fallacy. -1
hkdani 39 Posting Pro in Training

gets is still in the documentation. It works.

I wouldn't go so far as to say that it's wrong.

I would say that it's not safe, not recommended, not the best way to do things.

But it works. But it sounded like the user was having difficulty with just the basics. So I would recommended the simple form of returning an integer using gets just to get the ball rolling and encourage the new programmer with some concrete results without having to be further discouraged and confused by using a more complicated--albeit safer--method of returning an integer to use with rectangle.

But I really doubt that this beginner's program was going to lead to future pitfalls that would cause some corporate disaster ultimately leading to the downfall of civilization. Of course I might be wrong. Maybe the user should use fgets?

jephthah commented: just stop now. you're only making yourself look dumber. -1
hkdani 39 Posting Pro in Training

for (i=0 ; word[i]!=NULL; i++) My bad. The second portion of this type of for loop is a conditional test. Left out the test.

hkdani 39 Posting Pro in Training

I want to read each character of the given word, and assign it as a parameter of the function above.
I am still a newbie when it comes to characters, so any help would be really appreciated?

I would combine both of your functions into one to keep it simple. Don't see the need to break it down into two functions.

If you declare functions at top, then you don't have to prototype them.

int i,  j ;

for (i=0 ; word[i]; i++)
{
     j = is_whatever (word[i]);
   // Test the return value
   if (j ==FALSE)
           // Code to deal with a false return
           // You might want to write code to break out of the loop here
    else
           // Code
 }
  return j; // ?

you can loop through the word as mentioned above

hkdani 39 Posting Pro in Training

Is there any other way of doing it without the use of arrays?

In the context you've mentioned a word is an array of characters. And since you're dealing with an array of characters--i.e. a word as you put it--you must deal with the 'word' as an array.

There are probably an endless amount of ways to deal with your situation as there are programmers, but when you get right down to it, you have to deal with the word as an array.

Because that's what it is.

char word[] = " ";

In this case you could declare an integer i and loop through the array of the string entered.

int i ;

....

for (i=0; word[i]!=NULL; i++)
{
    printf("%c ", word[i]) ;
}
hkdani 39 Posting Pro in Training

Don't recommend the use of gets.

I'm aware of that. But I just think that the user needed some simple help. But to get the user started, it helps to not get them bogged down in all the fine details.

A drowning man isn't concerned about the method. He just wants someone to throw out the lifeline.

Aia commented: That's not help. It is not simple and it is not worth invoking. -2
hkdani 39 Posting Pro in Training
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main()
{
     int x1, y1, x2, y2 ;
     char String[80] ;
     printf ("Enter Starting X: ") ;
     gets(String) ;
     x1 = atoi(String) ;
     printf("Enter Starting Y: ") ;
     gets(String) ;
     y1 = atoi(String)  ;
/* ......
    */
     rectangle (x1, y1, x2, y2) ;
     return 0 ;
}
/* that's basically it. I downloaded the Turbo C++ 3.0 IDE. Looks like a free download. But it generates an error linking rectangle.  Running on Windows 2000: undefined symbol _rectangle in graphics.cpp (the name of my source file).  But like the previous poster suggested, the example code given in the help file should be your best source of help. Maybe someone with more experience with this compiler could help you get around the error message here in the linking. Found a post. In the IDE you need to make sure the Graphics Libraries is checked from the Menu: Options>Linker>Libraries!*/

That's the general idea. But that should get you started. After checking the Graphics Library in the options menu, the program compiled, linked, and ran and actually drew a rectangle. Pretty cool for an old IDE. Reminds me of that video I saw on YouTube of this guy who hooked up an ancient 300 baud per second analog modem. He put the phone on microphones to receive and transmit the audio. And then he hooked it up to the current world wide web and using a linux box and used lynx to view a …

hkdani 39 Posting Pro in Training

------------------

Windows.. I'm using borland turbo C++.. do u have any idea about this problem.? i'm so desperately need some example of it.. :'(

Using the Free Borland 5.5 command line compiler?

Which version?

Using Borland C++ Builder?

hkdani 39 Posting Pro in Training

Hi! I need help to my Turbo C program.. I need to create a program that will ask the "Starting X:", "Starting Y:", Ending X:", and Ending Y:" on different shapes.. this is how the program should be:

SQUARE:
starting X:
starting Y:
ending X:
ending Y:

CIRCLE:
Starting X:
Ending Y:
Radius:

LINE:
Starting X:
Ending Y:

and also

POLYGON:

...the user will write numbers in starting X, starting Y, ending X, ending Y, and radius, after encoding the numbers, the result will create the shape that the user chose and according to their X and Y and radius of the program.

* I dont really have any idea how to start with it. I'm just a beginner and need some hand to help me. I understand if you don't want to give away code because I'm not show my effort as a starting point. You can give me some link about this program, if you'd like to. (^_^) thanks..

You want to do this in Windows, in Dos, Linux?

hkdani 39 Posting Pro in Training

Finally, figured it out.

Needed to declare a reference in the Standard bas module to the Control. But the control will not instantiate inside the bas module.

So, you instantiate the reference in the control itself by using the following syntax:

' Code for Module
Public MyTimer as UserControl1
Public sub Timer Proc (ByVal hWnd as long, ......)
       MyTimer.FireEvent
end Sub
' Code in User Control

Public Property Let Enabled(ByVal New_Enabled As Boolean)
   m_Enabled = New_Enabled
   Set MyTimer = Me
   TimerProc
   PropertyChanged "Enabled"
End Property

And then once the MyTimer Variable (Really a reference to the physical address of the User Control) has been set to the UserControl itself, then the event will fire inside the user control. But just notice that MyTimer has to be instantiated before calling the TImerProc function in the Standard .bas module.

Why do you have to use a standard bas module?

Because when using the TimerProc function you have to use the Pointer Value to a function. And VB6 only allows that in a standard bas module:

Using the AddressOf Keyword
Any code you write to call a function pointer from Visual Basic must be placed in a standard .BAS module — you can't put the code in a class module or attach it to a form. When you call a declared function using the AddressOf keyword, you should be aware of the following conditions: (MSDN)

hkdani 39 Posting Pro in Training

You want hardcore, these guys have hardcore... http://www.thescarms.com/VBasic/timer.aspx

Good Luck

Thanks, vb5

They have some interesting stuff, but not exactly what I'm looking for.

I figured out one way to do it. But not exactly what I want either. I have to add a class module with a friend method and event to the project which can be instantiated in the standard bas module. Then the Class Module Method can fire its own event independent of the User Control. However, have to instantiate the class module for the client besides adding the user control to the client app.

What I want is the event to fire directly from the User Control so I don't have to instantiate the Class Module in the client app.

hkdani 39 Posting Pro in Training

I found another very good thing,

Its VideoOcx and WebCamOcx but I cant use it very well,

If some onr knows about it

Well, I would say the first step should be to pick out a web cam that has some software available to use. I would suggest a low cost solution like X10's. Their free Software Development Kit works for VB6 and you can use theirs or some other X10 protocol compatible web cam.

If you want to do that, you'll probably find some more concrete help. Otherwise, let us know what web cam you currently have and we'll see what we can do.

hkdani 39 Posting Pro in Training

Trying to raise an event in an ActiveX control from a module (.bas file).

Been trying to create a timer control that will go past the 1 minute limit of the vb6 timer.ocx. The Windows API SetTimer will do this. But wanted to create an Active X timer control that will raise it's own Timer Event.


In the module.bas file:

Public Sub TimerProc (ByVal hWnd as Long, ByVal uMsg as Long, ByVal idEvent as Long, ByVal lpFunc as long)
' This is where I would like to somehow activate the event in the 
' ActiveX control code. But am stumped. I was wondering if it were
' possible to change a property value in the ActiveX Control at this
' portion of the code? If so, then code could be written in the 
' ActiveX control with the Property Change to fire the Timer event.
End Sub

Any ideas? This is a hard core problem. Who has a hard core solution?

Thanks,

Hank

hkdani 39 Posting Pro in Training

But I'm not able to print one bold line.

Will someone please help out?

I would suggest not using escape sequences and LPT1. Instead I would load a driver for the printer and print using the following:

Printer.Print

I've seen code like you mentioned and I believe the easier way is to just use the driver and set the Printer device to the proper printer device. You should be able to set the font along with the font properties as you desire using VB6's printer object.

But if you want to do it like you mentioned, then I believe you need to send the proper escape sequence to notify the printer that you are going to send an escape code.


Don't know if you want to go that route, but in the long run that would probably be the easier way and allow for the use of different printers not tied to

hkdani 39 Posting Pro in Training

Could I avoid that by taking out the first argument and just asking for one thing in the command line, char *Name[]?

In short--if I understand what you're saying--the answer is no. command.exe Param1 Param2 If you just want the second parameter, then that would be argv[2] or in your case Name[2].

In the above example of using the command line, Name[2] should give you "Param2", and Name[1] should yield "Param1"

hkdani 39 Posting Pro in Training

http://www.iu.hio.no/~mark/CTutorial/CTutorial.html

This is a good link to a free tutorial. Gives you the basics.

hkdani 39 Posting Pro in Training

I would set your argument to your function to a char pointer: int myatoi(char *pszArg) Since you're wanting to pass an array of characters-- i.e. argv[1] -- to your function you may use a char pointer (*pszArg).

You can then work through the char * as follows:

int i;

for (i = 0 ; pszArg[i] != NULL; i++)
{
   // Code to process your own atoi function.

}
hkdani 39 Posting Pro in Training
int main(int argc, char *Name[]) {
/* char *Name = "Josh"; */
printf("%d",myatoi(Name));
return 0;
}

One problem here is you're not using the proper value for your function: myatoi(Name).

If you have one argument after your executable, the proper format would be the following: myatoi(Name[1])

The second argument in the main function is a pointer to an array of strings (arguments from the command line). argv[0] would be the command itself, argv[1] would be the first parameter after the command, argv[2] would be the second parameter, etc. .....

int main (int argc, char *argv[])
{
    if (argc == 2)
        {
             myatoi(argv[1]) ;
         }
    else
         {
               printf ("Please, enter a name after the command line!\n") ;
          }
     return 0 ;
}
hkdani 39 Posting Pro in Training

To say the internet is evil would be the equivalent of saying, "Guns are evil."

However, society is bound to enforce the evil use of guns. Murder is wrong and should be punished in a civilized society.

And likewise, Pornography is wrong and it's spread and use should not be tolerated or encouraged by society. The basic unit of society is the family. And pornography breaks down a person's resistance in other moral areas of actual adultery and fornication: sins, if you will, which lead to divorce and the breakdown of the basic unit of society.

hkdani 39 Posting Pro in Training

it gives me a runtime error("Run-time error '91': Object variable or with block variable not set").

It doesn't look like you instantiated your ranges. Don't know.

Set rnge = new Range

Also, you should be careful in your declaration of variables. VB6 is not like C.

Dim rnge, intI as Integer,  road as Range

The variable rnge will be set to a variant type, intI as an Integer, and road as a Range.

hkdani 39 Posting Pro in Training

I am using the InValidateRect to erase the temp fill

InvalidateRect just defines the coordinates of one Rect Structure. The next API you should use is the BeginPaint API which should reference that rectangle.

The invalidated areas accumulate in the update region until the region is processed when the next WM_PAINT message occurs or until the region is validated by using the ValidateRect or ValidateRgn function. (Win32SDK)

A call to the BeginPaint API should generate a WM_PAINT message.

And you also have to be aware that there is an update Region for any particular window. There may be other Rect Structures that have been passed by InvalidateRect to that window. And if those other calls have set the Erase Flag to TRUE in their InvalidateRect call, then irrregardless of your request to not erase the other areas, all areas of the update region will be erased anyway.

If the bErase parameter is TRUE for any part of the update region, the background is erased in the entire region, not just in the given part. (WIN32SDK)

hkdani 39 Posting Pro in Training

i disabled the UAC in the user account and installed the software. it is running perfectly.

The whole point of the recent upgrades for Vista was security for the operating system. Windows has been behind the times since Windows 95 because of allowing programs to install their files in system directories. And there has been a rash of security problems associated with a poorly designed operating system that allowed programs to install files that could potentially harm the operating system.

There should be no reason why your program should not run when you follow the proper guidelines for installation paths.

Install your program files in the program files folder. Install any user data in the %APPDATA% folder or the COMMON APPDATA folder. And if you compile any of your own ActiveX controls, do not place them in the Windows System folder. A good place to put them would be the Program Files\My App\system folder.

Sure, your program will run. But I would suggest putting in the extra effort and find the real reason why your program is not running and upgrade your installation process so that your program follows the upgraded security procedures built into Vista.

People criticize Vista. But I think a lot of that is based upon ignorance of the faults in the previous operating systems.

hkdani 39 Posting Pro in Training

No value in param1

Well, that's probably your problem. I would say you need some value there for your database command. You need to figure out why no value is in that variable at that point in your program.

Load DataEnvironment2
With DataEnvironment2
If .rsCommand1.State <> 0 Then .rsCommand1.Close
.Command1 Text2.Text
End With
DataReport2.Show

So, if you set a breakpoint at line 3 by clicking in the column to the left of the code, your program should stop at that point and you should be able to determine what value is in Text2.Text. You can use [F8] to step through your code 1 line at a time. If there is none, then you need to fix that bug so that your command1 will have a parameter that it can use. It can't use a NULL value.

hkdani 39 Posting Pro in Training

(param1 as long)

So, you answer my question with another variable. That's interesting. And so, if I ask you what the value of Param1 is you would give me another variable?

Perhaps Param2?

hkdani 39 Posting Pro in Training

How can I send a string into my POS POLE Display...???

A pole display is like any other device.

Printer.Print

MsgBox "Hello, World"

You need to have an object that has methods, properties, and or events. A pole display is an object. But VB6 has no built in code that I know of for pole displays. So you probably need to load libraries, references, or components that will supply you with the those properties.

Usually the manufacturer supplies those as plugins (ActiveX controls:e.g. ocx files, Dynamic Link Libraries: dll's, or servers: executables that will respond and serve data back to the VB program.

If all else fails, you should read the manual that came with your pole display.

hkdani 39 Posting Pro in Training

What values are you getting for Text2.Text?
I don't understand

Text2.Text has a string value: e.g. "Joe", "Schmo","123", etc. If you put a break at this section of the code, what is it returning?

hkdani 39 Posting Pro in Training

.Command1 Text2.Text What values are you getting for Text2.Text?

hkdani 39 Posting Pro in Training

Hangman. I always thought you guessed letters and not words. Have they come up with a new way of playing the game?

I would say that you need to set up a string array that matches the word that you are guessing.

And then I would create a string array for the correct word.

Dim strArrayWord(11) as string
Dim strArrayGuessed(11) as string

Every Time a correct letter (letter not word--little bit of a difference) is guessed, you fill the strArrayGuessed(x) with the proper value.

So, if the word is BassettHound and the user chose 's,' then strArrayGuessed(2) = "s": strArrayGuessed(3) = "s" Your next step would be to check each array to see that each member matches. You could use a for loop:

dim bCorrect as Boolean
bCorrect = True
 for i = 0 to 11  
       if strArrayGuessed(i) = strArrayWord(i) then

       else
             bCorrect = False
             exit for
       End if
next i

if bCorrect = True then
     ' Success
else
     ' Failure
End if

The Boolean variable bCorrect will not be left as True unless all letters of the word are correct. That's a start.

hkdani 39 Posting Pro in Training
Option Explicit

Private Sub Form_Load()
   If App.PrevInstance = True Then
      MsgBox "Program already running.", vbInformation, "Program status"
   ' End the program
   End
  
   End If
End Sub
PinoyDev commented: has the expertise +1
hkdani 39 Posting Pro in Training

It would appear that your problem is that every time your brute force loop finds an item it adds it to the list.

Instead of adding the item to the list in the nested if end if, count the occurences that it are found in that Nested If structure.

Dim intCount as Integer

If ' ........................
     intCount = 0
     
     For ' ......................
            if " .................................
                  intCount = intCount + 1
            End if
      Next
      
      If intCount > 0  then
               List1.Additem ' ...........................
               intCount = 0
      End if

End if
hkdani 39 Posting Pro in Training

my software runs from a disk (cd). i use autorun to open the package.
thx again

Here's a couple of questions for adamsn. But in the mean time, I am tapping into the cosmic spirit and trying to pick up your vibes. Hmmmmmmmmmmmmm. Hmmmmmmmmmmmmmmmmmm. Hmmmmmmmmmmmmmmmmmmmm.
Shucks, no results yet. Hmmmm.
Well, here's a few questions:
1. Are you running a setup package with the Package and Deployment Wizard?
2. Are you using the Microsoft Windows Installer 1.X?
3. Are you just running a compiled executable on the CD without any installation program?

hkdani 39 Posting Pro in Training

I developed a programme in vb6. It refuses to open on Vista. I do not experience any problems with XP.

Like he said, be specific.

But check your installation paths. Do not add any of your files to the system path: e.g. c:\windows\ ..........

Finally, Microsoft is becoming wise and not allowing programs to install files in the system directories. Put them in the Program Files folder or in the Application Data folder: %APPDATA%

hkdani 39 Posting Pro in Training

Is it that you can only ReDim an empty array?

The ReDimstatement is used to size or resize a dynamic array that has already been formally declared using a Private, Public, or Dim statement with empty parentheses (without dimension subscripts). (MSDN)

Microsoft says the Redim Statement is to be used with arrays declared with empty parentheses. I guess you could try otherwise; but why?

But I think I see your problem. Forgive me, if you've already solved this.

But look at how you started:

'Assigns names to array space 1
        arrNames(0, 0) = "bnsjon"
        arrNames(1, 0) = "bnsjack"
        arrNames(2, 0) = "bnsjane"
        arrNames(3, 0) = "bnsjill"
        
'Assigns Passwords to array space 2
        arrNames(0, 1) = "jon"
        arrNames(1, 1) = "jack"
        arrNames(2, 1) = "jane"
        arrNames(3, 1) = "jill"

The area that has the most values is the first dimension. Since the Redim Preserve feature is designed to preserve the data only when you expand the second dimension. Make the second dimension the dimension you want to increase.

Dim intArrayCount as integer

Private Sub IncreaseArray(CurrentArrayCount as Integer)
     Redim Preserve strNames (1, intArrayCount + 1)
End Sub
hkdani 39 Posting Pro in Training

Preserve Optional. Keyword used to preserve the data in an existing array when you change the size of the last dimension. (MSDN)

I think the key word is preserve. The whole purpose of the Preserve key word is to preserve data.

It's intended use is when increasing the size of the last dimension of a multimensional array. Notice that the MSDN documentation does not say changing the first dimension: it says, "the last dimension."

If you want to use the Redim Preserve features, then follow the guidelines:

If you use the Preserve keyword, you can resize only the last array dimension and you can't change the number of dimensions at all. (MSDN)

hkdani 39 Posting Pro in Training

Go to this link and click on the Inquire Now button, fill out the information.

Request an SDK, an ActiveX control, or a link to a PDF for the manual that we can get our hands on.

hkdani 39 Posting Pro in Training

ok, thanks.. after that? could you give me sample outline for me as guide,

Manufacturer, Model Number.

is it possible to program it by using visual basic?

Coudn't really tell you without the manufacturer, model number. But just about anything is possilbe with VB6.

but i want to learn.

I just want the model number and manufacturer's name.:@

hkdani 39 Posting Pro in Training

ok, thanks.. after that? could you give me sample outline for me as guide,

Yes, that's not a problem. But don't hold your breath. But we still could use a manufacturer and Serial Number. Anyone can look on the internet and download the PDF manual from the manufacturer.

Sometimes, you have to call the manufacturer yourself and he will send you a link with that info. Some manufacturers require you to sign a non-disclosure agreement.

But usually they give you an ActiveX control with the necessary documentation.

Or at least they will give you some sort of documentation that details how the data is sent. And what that data means. That's what VB5 means when he says they provide no interface. You might have to write your own ActiveX control.

hkdani 39 Posting Pro in Training

I DONT KNOW HOW TO SHOW ALL THE INFORMATION FROM FORM 2 IN FORM 3. I GOT 1 LIST BOX AND THREE LABELS IN FORM 3

It might be a good idea to add a module to your program and declare some Public Arrays there in that module.

Public Grades(0 To 8) As String
Public Points(0 To 8) As Integer

Then you wouldn't have to use those Dim Statements on the second form. And your data would be accessible in all three of your forms.

Does anyone know how to validate the list box in this program?

I assume that you don't want any data to match.

If you used Public Arrays or Public Variables in a new module or even the variables as you have them currently declared, your program would execute quicker and also be easier to understand, if you would work with variables rather than values on controls on your form.

That's not a good habit to get into. I've seen programs where the programmer stored all his data he worked with in hidden text boxes on the form. What a terror to figure out! Try finding the data in hidden controls.

If you store the values you wish to place in the list in a variable array, you could use a loop to cycle through the array to check for data redunancy (repeating data values) and then warn the user to enter a unique value for that list, if redundant data is …

hkdani 39 Posting Pro in Training

we already have the thumbprint scanner

Ok. (1) Who is the manufacturer, and (2) what is the model number.

We should be able to help you from there.

If not, do you have the manual? If all else fails, read the manual.

hkdani 39 Posting Pro in Training

Visual Basic really doesn't have any operators that deal with bit shifting directly like C (<< or >>).

But in the C language the COLORREF data type contains the RGB value with a high order byte of zero and it's in a 32 bit value with the following format: 0x00bbggrr. And C has three special color macros: GetRValue, GetGValue, and GetBValue which do not exist in VB6: C uses these three macros to extract the red, green, and the blue values. C uses bit shift operators in these macros.

But the COLORREF data type is a hexadecimal number which is formed from the RGB value and the high order byte &H00.
There are 4 bytes in that number: the low order red byte (rr or red), the second byte (gg or green), the third byte (bb or green), and the high order byte must always be zero.

Visual Basic only gives us the first 3 bytes. But that's all we need anyway.

The highest RGB Value would be from the values of 255, 255, 255

lngValue = RGB(255, 255, 255)

The lngValue would be 16777215 Hex$(16777215) would yield FFFFFF

Red would be &HFF, Blue &HFF, Green &HFF

However, if you had a small value like 25 for the RGB VALUE, that would pose problems for finding the hex values: hex$(25) would yield the string "19." You have no values for the green or the blue.

So, one way to get around this problem is to just add …

hkdani 39 Posting Pro in Training

Nah, unfortunately that didnt work hkdani. But thanks for the post

That's funny: it works on my vb6 program. Actually, that's the method that I learned from a Microsoft CD on VB6 programming fundamentals. I've been using that method for years. It's odd that it doesn't work for you.

What I like about the method that Microsoft recommends is it's simplicity. That's why they made Visual Basic, because they knew that programs could be written faster and programmers could be more productive, if they were provided a simple way to perform a task such as the task you describe.

From what I've read and studied from the established authors and programmers, they always recommend the KISS method: Keep it Simple Stupid.

Yes, it's true that you can use API's. And it looks quite impressive. But in the end, in the real world it's all about achieving a desired end within a certain time frame.

If you can't achieve that end with the tools that VB6 provides, then VB6 has the flexibility of being able to call the Windows APIs from the Platform Software Developer Kit (PSDK). But as a general rule, use the tools that VB6 provides and only venture into APIs if VB6 doesn't provide the means to accomplish your end.

When it comes right down to where the rubber meets the road the end user will never see your code. He only sees your program. The programmer should not try to impress someone …

hkdani 39 Posting Pro in Training
Option Explicit
Private Const RGB_R = 1
Private Const RGB_G = 2
Private Const RGB_B = 3

Private Sub cmdFindColor_Click()
     Dim lngColor as Long, intRGB as Integer, lngRGBValue as Long
     ' Code to find RGB value
     ' Blah, Blah, Blah
     ' intRGB would be RGB_R, RGB_B, etc.
     ' lngRGBValue would be the RGB Color value
     ' lngColor would be the Red, Green, or Blue Value you wish to find
     lngColor = Return_RGB_VALUE(lngRGBValue, intRGB)
End Sub

Private Function Return_RGB_VALUE(RGB_Long As Long, RGB_Color As Integer) As Long
If (RGB_Long > 0) And (RGB_Long < 16777216) Then
     ' Return the Red, Green, or Blue value based on the RGB Value and
     ' the Color requested.
     Return_RGB_VALUE = (RGB_Long / 256) ^ ((RGB_Color - 1) And 255)
     ' Convert the RGB value into an 8 bit value and take that value
     ' the exponential value of the bitwise comparison of ((Color - 1) And 255)
     ' The And operator in this case returns the bitwise comparison of 2 numbers.
   Else
     ' Not a valid RGB value
     Return_RGB_VALUE = -1
   End If

End Function
hkdani 39 Posting Pro in Training

This link appears to be a good way to go.

I've used the way I explained, but this appears to be a simpler way and is pretty well documented.

hkdani 39 Posting Pro in Training

Iam working in setup creation using VB6

I take it you're trying to write a program that will install or setup your program? That's pretty difficult to achieve with vb6 language alone and probably the easiest route is to use some Window APIs to achieve your goals.

Use the ShellExecuteEx API and extract the process handle for the exe that you wish to run.

Use the WaitForSingleObject API on that process handle.

And then use the CloseHandle API to close the handle

hkdani 39 Posting Pro in Training

Id like it so that when you click the 'x' button to close the program it doesnt just end.

Use the Form_Unload() event

Private Sub cmdX_Click()
     unload Me
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Dim intReturn As Integer
    
    intReturn = MsgBox("Ready to Exit", vbOKCancel, "Exit?")
    If intReturn = vbOK Then
    Else
        Cancel = True
    End If
End Sub
hkdani 39 Posting Pro in Training

Just click inside the gray column to the left of Call Main_ON() .
Put a question mark before the variable name and press enter in the Immediate Window. The next line should show the value of the variable.


Immediate Window
-----------------------------------
?strUserName
JoeUser

I would put your debug.print right after the if varFound = True Then line.

if varFound = True then
    debug.print strUserName, strPassWord, ' etc. .................
hkdani 39 Posting Pro in Training

BUT I didnt enter a username OR password.

Put a break at Call Main_ON and use your immediate window to check the values of strUserName , strPassword and the values in your arrNames.