hkdani 39 Posting Pro in Training

If Anybody can Please Help me.........How to do it using VB6/.net

use the arp command. The arp command is a system command; and you could use VBs Shell command to run it.

c:>arp --help

Should give you more information.

Hank

hkdani 39 Posting Pro in Training
Option Explicit
   Private Const MARQUEE = "This is a scrolling Marquee."
   Dim intLength As Integer
   Dim strMarquee As String

Private Sub Form_Load()
   lblMarquee.Caption = MARQUEE
   intLength = Len(MARQUEE)
   strMarquee = MARQUEE
End Sub


Private Sub tmrMarquee_Timer()
   Dim strFirstCharacter As String
   ' Find the current first character
   strFirstCharacter = Mid$(strMarquee, 1, 1)
   ' Remove the First Character
   strMarquee = Right(strMarquee, intLength - 1)
   ' Add it to the end
   strMarquee = strMarquee & strFirstCharacter
   lblMarquee.Caption = strMarquee
End Sub

You just need to ensure that your timer is enabled and have the interval property set to something like 750 (milliseconds). You can get by with one timer. In this example, the timer's name is tmrMarquee

Hank

hkdani 39 Posting Pro in Training
Option Explicit
Dim cnnADO As ADODB.Connection
Dim tbl As ADOX.Table
Dim ctg As ADOX.Catalog

Private Sub Form_Load()
' Instantiate the ActiveX data objects
Set cnnADO = New ADODB.Connection
Set ctg = New ADOX.Catalog
Set tbl = New ADOX.Table
' Open the database and establish the connection

cnnADO.Open "Provider='Microsoft.Jet.OLEDB.4.0';Data Source=practice.mdb"
Set ctg.ActiveConnection = cnnADO
' Add a new column (field) and make it autoincrementing.
With tbl
   .Name = "Employees"
   Set .ParentCatalog = ctg
   .Columns.Append "EmployeeIDs", adInteger
   .Columns("EmployeeIDs").Properties("AutoIncrement") = True
   
End With
' Append the new column
ctg.Tables.Append tbl

End Sub

Private Sub Form_Unload(Cancel As Integer)
cnnADO.Close
Set ctg = Nothing
Set cnnADO = Nothing
Set tbl = Nothing
End Sub

That should add a new autoincrement field to an existing database. But your request seems to be contradictory: alphanumeric autonumber.

Since the autonumber uses the decimal numbering system, you should only want numbers.

You'll need to add references to the ActiveX data objects library and tp the ADO ext for DDL and Security.

Hank

hkdani 39 Posting Pro in Training

can any body help me to convert this code from C++ to C

Sure, I'll help. Let me get you started.

#include <stdio.h>
#include <string.h>

Hank

hkdani 39 Posting Pro in Training

Save both values into 2 different variables.

Convert both to uppercase. Test to see if they're true. When in doubt. Use your immediate window: <Ctl +G>

This is false
----------------------------------------
Immediate
?"Hah"="HAH"
False


This is true
----------------------------------------
Immediate
?"HAH"="HAH"
True


--------------------
Immediate

?"GOOD GRIEF"="Good Grief"
False

?(ucase("GOOD GRIEF")=ucase("Good Grief"))
True

hkdani 39 Posting Pro in Training

if theres a "Haw" already inside the field "Username"

then i wanna add "HAW" (all CAPS)

Hah, hah. That's really funny:)

You have earned my first official Good Grief!

Hah, hah, hah.

I can't stop laughing!

hkdani 39 Posting Pro in Training

Global ErrorStatus&

Use the varType function: it returns the variable type.

You can use it from the Immediate Window
---------------------------------------------------
?varType(ErrorStatus&)


That will return a numerical value. Then you consult your MSDN documentation to see what type corresponds with that numerical value.

Hank

hkdani 39 Posting Pro in Training

Dim dbs As ADODB.Connection
Set dbs = New ADODB.Connection

It would make it read easier if you did the following:

Dim conPersonnel as Connection

Seems that dbs gives a misleading concept. As declared above, the person reading the code would have an easier time understanding that the process was using a connection property as well as Identifying in a general way what Table was being accessed.

With such a well written answer to your own problem, you should have solved it before you wrote the question:)

You don't really have to mention ADODB unless you are writing code in an application that uses Data Access Objects (DAO) as well as ActiveX Data objects at the same time.

Hank

hkdani 39 Posting Pro in Training

However now I'm in a position where I need to call a C# dll from VB6 and I need it yesterday.

That would be nice, if it were possible.

I know you can use a VB6 ActiveX component in .NET, but I really doubt you can go the other way.

I have some projects I would like to complete using some drop in .NET components in VB6, but they will not load in VB6.

hkdani 39 Posting Pro in Training

have completed my project in all respect but I would like to include all
table and report of Access and Crystal Report respectively in my VB 6 project SETUP FILE.
So. pl help me to include such file while creating SETUP file. If there is no way than I have to make extra exercise of copy paste wherever I install my SETUP file

You can use the package and deployment wizard!

That should handle your Microsoft Data Access Components (MDAC) installation. But you have to be careful on which version of MDAC you're Package and Deployment Wizard is referencing.

You'll need to check the MDAC_TYP.exe file to see that it matches the version you're using in your program. There are several versions out there.

If you have a copy of Visual Basic 6, Microsoft will allow you to install and download their Microsoft Visual STudio Installer version 1.1 to use with VB6 projects. It doesn't handle some of the older MDAC installs, but it should work with the more recent ones.

You can work around these problems by just making your own custom installer. But you need to make sure that your Crystal ActiveX objects are registered before they can be used on another computer.

The Package and Deployment Wizard usually takes care of this, and the newer Visual Studio Installer also has settings to register ActiveX controls as well.

If you could, I would go with the newer Visual Studio Installer. …

hkdani 39 Posting Pro in Training

thanks for your input. However, is there such a syntax like
(Toggle Plain Text)

database.movefirst

Weeeeellllllllllllllllll. That's a deep subject.

Option Explicit
Dim database as ADODB.Recordset

Private Sub Form_Load()
Set database = new ADODB.Recordset

database.MoveFirst
End Sub

I haven't tried the code. These are just quick notes to illustrate what you need to do. But if you're able to recognize what is proper syntax, I think you should have no problem figuring out how to properly declare and instantiate your own recordset variable objects.

But that's a good point. "database" isn't a very good name. And it may not even be allowed as a variable, if it's one of those words that are not allowed to be used.

Usually, you want to declare a Recordset Object Variable with something that begins with rst:

Dim rstCustomers as ADODB.recordset

Using your format and looping through to delete the database content may delete the tables which I do want to delete.

You said you wanted to delete contents.

There is a difference between a table and a recordset. You can have a table without a recordset. But you can't have a recordset wtihout a table.

In other words, your table will still be there with its fields. You just won't have any records.

A table is a database object You can delete a table object, but that would take different code. The code above is just for deleting one row of the table at …

hkdani 39 Posting Pro in Training

but still it will copy the info to the all the labels in frmsummary.

You need to change the data before you copy it into the new array. If you don't write code to change or update the data, it won't change by itself.

Hank

hkdani 39 Posting Pro in Training

hi venkat,
I am really sorry.I dont mean to irritate u.is func syntax something like this??
type def
App.Path = "E:\LATEST"
end type

App.Path is a built in value stemming from the prewritten function 'App.'

App.Path should be used on the right hand side of the '=' operator: not on the left hand side like you have it.

Dim strPath as string

strPath = App.Path

Your program should have a default installation path. Microsoft recommends using the 'Program Files' Directory and then the name of your program: e.g. c:\Program Files\My Application\

If you want to change the path your program uses, that type of information should go into your registry:

Option Explicit
Dim strStartUpPath as string
strStartUpPath = APP.path  
' Or
strStartUpPath = strMyChoice

Private Sub Form_Load()
strStartUpPath = GetSetting("MY APP", "Install Defaults", "StartUpPath", "C:\Program FIles\My App")


End sub
hkdani 39 Posting Pro in Training

I assume that you have some idea of how to work with Access databases in VB6. If not, let me know.

But I would use the End of File property (EOF) in a loop to delete the records in the database.

With MyDatabase
      .movefirst
      While not .EOF
        .delete
        .movenext  
      Wend
End with

And would probably use the same method to load them from database 'A' to database 'B'.
You could declare some variables to use to keep the values of the fields. This would allow for error checking. Or you could just transfer them directly

DatabaseB.MoveFirst
While DatabaseB.EOF <> True
DatabaseA.AddNew

DatabaseA.Field("Name") = DataBaseB.Field("Name")
......
......
...... etc,

DatbaseA.Update
DataBaseB.MoveNext
Wend

Hank

hkdani 39 Posting Pro in Training

what i want is there will be a msgbox that will tell theres already "MyName" on my table,

Don't really understand what you want?

If you already have accessed the data, you should already know that the MyName Field exists.

"MyNaMe" or "MYNAME" (have diff Uppercase and Lowercase charater)
is will still recognize it as a simple "MyName"

Microsoft doesn't care if you use Uppercase or Lower Case when referring to field names in a database. It just cares if the letters match.

Hank

hkdani 39 Posting Pro in Training

Well, you're making good progress. I can tell that you're exercising your brain.

You're right at the edge. Personally, I prefer to understand what I'm doing and not have someone do all the work for me.

Seems that people appreciate, in the long run--maybe not in the short run--, the feeling they receive when they have worked at a goal and through their own efforts (maybe with a little guidance) have achieved their goal.

frmsummary.lblfname(0) = frmWage.lblfirstname.Caption
frmsummary.lblsname(0) = frmWage.lbllastname.Caption
frmsummary.lblgsalary(0) = frmWage.lblGrossSalary.Caption
frmsummary.lblnwage(0) = frmWage.lblNetWage.Caption
ArrayCounter = ArrayCounter + 1
frmsummary.Show

You just need to place a variable in your array location: frmSummary.labelsname(ArrayCounter)

instead of frmSummary.lblfname(0)

As you have it, the only value of the array that will be filled is the first one: instead of frmSummary.labelsname(0)


frmSummary.labelsname(ArrayCounter)

Just as a matter of style. If you're working with a text box, it's good style to start the name of that text box with txt, labels --> lbl, etc. so that you're code will be easier read, if you have to go back to that code and edit it later.

Hank

hkdani 39 Posting Pro in Training
Dim lblfname (10) As String
Dim lblsname (10) as string
Dim lblgrosssalary (10) as Integer
Dim lblnetwage (10) as Integer

Yes, that will declare an array with 11 values (0 -10). But when you use Dim, the Array's scope is limited to the form. You can only use that variable within your form.

Use the Public declaration to make it available to other forma within your project

Option Explicit
Public lblsname(10) as String
....

Then you'll have to access it using the name of the form first like so:

frmInput.lblsname(0) = "MyInput"

You can avoid this if you add a module to your project and declare the Public Array in that module. Then you can access it without having to name the name of the form.

Hank

hkdani 39 Posting Pro in Training
Dim strFileName as string

strFileName = "c:\Documents and Settings\User\My Documents\hello.doc"

Shell "Winword.exe " & strFileName
hkdani 39 Posting Pro in Training

Well, you could just send us your code. And we would just send it back to you finished. But the whole point of these forums is to help the person.

If you find yourself stuck, you need to sweat a little. The brain is like other muscles in the sense that you need to use it before it can grow stronger.

You have reached an impasse. You need to sweat.

hkdani 39 Posting Pro in Training

You can use the Public type as a means of storage. You might want to add a regular module (not a class module) to your product to declare it in that section as I mentioned before. You could also declare a Public Variable ArrayCounter for your array in the same module.

But you need to change the Array Counter as new employee information is entered for each different employee. As long as you don't close your program down, the information will remain in memory. I don't know how you determine when your done collecting your information, but at that point, if you're using the Public type Array, you should enter that information at that time:

Your first input form (frmInput) will copy the info into the Array.

Private Sub Update_Array()
With MyEmployees(ArrayCounter)
   .FirstName = txtFirstName.text
   .SurName = txtSurName.text
   .HoursWorked = txtHoursWorked.text
   .SalaryRate = txtSalaryRate.text
End with
' Update the counter for the next employee
ArrayCounter= ArrayCounter + 1

Now you can use that info once its stored in the Public Type to copy into your other forms.

With MyEmployees(ArrayCounter)
  frmwagw.labelEmp1Name = .FirstName
  frmwagw.labelEmp1Surname = .SurName
  ' etc.
  frmummary.labelEmp1Name = .FirstName
  frmummary.labelEmp1SurName = .SurName
  ' etc
End with
hkdani 39 Posting Pro in Training

You have to update the Array.

MyEmployees(0) Would be your first employee

MyEmployees(1) Would be your second employee, etc.

Using the different values in the array, you have separate storage area for each employee. Once you've stored the values corresponding to one member, it can be later accessed by remembering the Array Value.

Or you can even search the Array until you find the Name you're looking for using a loop.

MyEmployees(1).Name


MyEmployees(2).Name

hkdani 39 Posting Pro in Training

The Property View

FORM1(Form1.frm)

What you see on the left side is the Name property of Form1.frm

What you see on the right side is the actual name of the file. Right Click and use the Save As to give it a different file name.

Hank

hkdani 39 Posting Pro in Training
Shell "WinWord.exe MyReport.doc", vbNormalFocus
hkdani 39 Posting Pro in Training

where i can find the library code of digitalpersona fingerprint scanner like DPSDKENGLIB,DPSDKOPLIB and DPSDKUSRLIB in vb.6 thanx.

I take it you where the dll or lib is that you're wanting to use.

Use the Dumpbin.exe execute utility

dumpbin.exe /exports dpsdkenglib


You should be able to what functions you can use and then you'll have to declare it like an API in one of your forms or modules.

Hank

hkdani 39 Posting Pro in Training

My problem is I want to check if any copy of these forms are open and those would have different names?

There are several collection objects that you can reference in your project in Visual Object: one is the forms collection.

Use the For Each with the Forms collection to cycle through the forms.

Try this in a sub routine.

Dim frm as form
For each frm in Forms
  debug.print frm.Name
next

I just accessed one property here. But you extract whatever property you would like during the For Each loop.

Hank

hkdani 39 Posting Pro in Training

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....

That's simply not the case. Declaring objects as variables saves Visual basic from having to go through the same code again. Once VB has it declared as a variable, it saves processing time.

Hank

hkdani 39 Posting Pro in Training

unfortunately, after crystal report 11 is installed in my computer, i can't find those 2 items in Project > components and Project > reference...

If you know the names of them, you can do a search for them using the standard search for file names that comes with Windows. Then just use the "Browse" button when adding your references to locate the file name you found.

If Crystal removed the older controls when it was updated, then you'll have to use the newer crystal ActiveX controls and rewrite your code--if Crystal does not allow two versions of the same control to co-exist.

You'll just have a more up to date report. Otherwise, you'll have to uninstall the newer crystal components and reinstall the original Crystal Controls that came with your original install of VB6.

Hope this helps!

Merry Christmas,

Hank

hkdani 39 Posting Pro in Training

I would declare a Public Array of your own type: You can declare the amount in the array to begin with or assign the amount dynamically with a Redim statement.

Option Explicit
Public Type Employee
   Salary As Currency
   FirstName As String
   SurName As String
   HoursWorked As Single
End Type
Dim MyEmployees(10) As Employee

Hank

hkdani 39 Posting Pro in Training

is there anyway i can get hold of Ocx for free....or can anyone just help me to make my own Ocx for video conferencing...plzzz rep.....am eager to find out...

Well, to answer your first question. Can I do it for free? Anyway you get it, it's going to cost you something. If you pay for it, it will cost you money. But you will be receiving a service. If you download and install a hacked copy, it will cost you your conscience and your sense of well being.

Are you really willing to sacrifice the permanent on the altar of the immediate? Are you really willing to throw away a chance to benefit the hard working coders of society and reward them for a job well done by finding a "free" alternative? Are you really willing to throw an opportunity to better yourself?

Well, I think you have potential. I sincerely believe that you can become a fantastic coder. You have the ability. And you have the desire. You have asked for help to develop your own ocx. So there must be hope.

Hence, I am willing to help. Don't know what good it will do. But I will try.

So, I'm starting with the premise that you have ambitions of greatness of being a fellow servant to the rest of mankind.

But the first thing to realize in your quest for being of service to others is that real rewards come from real effort …

Jishnu commented: good :) keep it up!! +3
hkdani 39 Posting Pro in Training

i want to know in VB6 what is forms is that classes or objects

Yes, a very good question. In short, a form is an object. According to Microsoft an object is encapsulated. That means it contains its own code and its own data. You don't have to program how to save its data. It's done for you. You set a property for a length, it saves the data for the length. Just fill in the properties box. In VB6 an object has properties, methods, and events.

Another interesting point is that you can use VB6 class modules to make your own objects. That is, with a class you can create your own class module with its own properties, methods, and events. And it can be instantiated or declared just like a regular form. In other words, your class module behaves like an object; because, in essence it fits the definition of an encapsulation: it contains its own code and data.

Option Explicit
Private MyScanner as cmScanner
Private MyCustomForm as CustomForm


Private Sub Form_Load()
' Instantiate the class just as you would a form
set MyScanner = New cmScanner
Set MyCustomForm = New CustomForm

End Sub
hkdani 39 Posting Pro in Training

why i m getting this error.

Your answer:

"Invalid DataSource"

Post a copy of your connectionsource property in the DEConnection section. And it probably wouldn't hurt to post the type of database you're connecting to: Access, MSSQL, FoxPro, etc.

Without that information, it's kind of difficult to help you?

hkdani 39 Posting Pro in Training

Thanks Alot, the Idea of placeing the Input to a textbox

Listbox. If your barcode is throwing in newline characters, then it will mess up a textbox. That's why I said Listbox. A listbox will take new lines.

If you don't have your MSDN Library CD's, you should get a copy. They have some excellent documentation on how to work with class modules and create your own events.

hkdani 39 Posting Pro in Training

Just a few general suggestions.

Sometimes VB6 has problems dealing with threads outside of its own code.

For instance, suppose you have code to access a database within a sub procedure. You have about 20 lines of code in that sub. At line 15 you access the database. The database is accessed; but you find that the following 5 lines in that sub routine were never executed.

Strange, but it is a documented problem with VB6 when accesing databases in the middle of a subroutine. The solution might be to end the sub at the end of the call to the database (line 15) and then make another sub routine to handle the next five lines.

So, try breaking up your code into smaller blocks. You have three calls to an excel spread sheet in the same subroutine. I guess that's what you have. FORTWICB, I'm guessing, is probably some function you have that returns a string.
I wouldn't stick all these in the same subroutine.

And I'm not too sure about your code for your conditional statements:

if lstPostcode = .....

You should break in the middle of your code while its running and see in the debug window if you can actually retrieve a value with the code the way you have it written.

--------------------------------------------------
Immediate
debug.print lstPostcode

Qpido commented: Helpful person +1
hkdani 39 Posting Pro in Training

Just include a barcode scan for an example. Throw it into Notepad or something. It should be all text characters. I can better tell you what you should do after seeing a scan.

And are you using Visual Basic for Applications (VBA) or are you using a regular Visual basic Form?

But really I would go through with my first recommendation of hiding a list box on the form and forcing the input to go there so you can deal with it there. The user wouldn't see the information, but you can process the information and deal with from there: e. g. save it in a database, set it in a label or textbox, etc.

Basically, you are dealing with an Event that Visual Basic does not deal with. So, you should declare your own Events in a class module to deal with the situation.

ClsModuleScanner

Public Event BarCodeScanned


Public Function ProcessBarCode(ByVal Scan as string) as string
  RaiseEvent BarCodeScanned
End function
hkdani 39 Posting Pro in Training

Just include a barcode scan for an example.

And are you using Visual Basic for Applications (VBA) or are you using a regular Visual basic Form?

hkdani 39 Posting Pro in Training

I really want to detect whether the physical mouse is tracking or not? Is there any ideals?

If that's all you want to do, then just put the cursor back inside a window where it can be tracked

Use the SetCursorPos API.

If your only objective is to get mouse tracking and you want to use the existing APIs, then using these 2 together should do the trick. Your only other choice is to design your own dll which fits within your goals.

Perhaps you've seen some of those programs that make the mouse move to the right of the screen when it reaches the far left side. They are using the GetCursorPos and the SetCursorPos together.

So, you're not a professional. You're just a development engineer?

hkdani 39 Posting Pro in Training

These are 2 codes I'm now using seperately, because if I put them together they won't do anything.

Looks like you're making it too hard.
Try sticking your second code inside of a timer that's disabled

' after your first code
' set the interval property to about 750
timer1.enabled

Private Sub Timer1_Timer()
'
Dim strListValue As String, sngPercentage As Single
   strListValue = lstDiesel.List(lstDiesel.ListIndex)
   ' Check for numeric value to avoid run time error
   If IsNumeric(strListValue) Then
      Text1 = ""
      Text1 = strListValue
    End If
    
If lstDiesel.SelCount = lstDiesel.ListCount Then
lstPrijs.Selected(Index) = 0
End If

Text3 = ""
'
timer1.enabled = false

End Sub
hkdani 39 Posting Pro in Training

v

Use the KeyPress Event.

The barcode scanner acts like a keyboard so use the KeyPress Event in the form.

Usually, these scanners have a few characters at the start that identify it as a barcode scan.

You can evaluate the ASCII value in the keyPress event to determine if the keyboard input is actually a BarCode scan. If so, you might want to hide a control on your form like a list box to capture the data.

But here's the PseudoLogic

If Ascii Value = BarCode then
   list1.setfocus
  ' remaining characters should then go into the listbox control.
  ' extract the list contents and do whatever you want with it.
  
else

End if

The regular Visual Basic Form--not VBA form--has a key preview feature which forces key input invents to go through the form first before any of the controls on the form. The VBA form does not have this feature.

hkdani 39 Posting Pro in Training

That's not c++. That's c.

You declare floats as double or single in VB, int as long or integer.

I would use text boxes for user input. And then I would suggest using code in a command button click event to draw the lines of your triangle.

You don't have to add any special math headers as in C, just use the cos, sin, tan, etc functions: they are already loaded.


All the logic shown in this simple c program can be performed using:

if ( ... conditional statements) then
' statements
else
' statements
EndIf


[object.]Line [(x1, y1)]–(x2, y2)[, color]
Will draw the lines of the triangle.

You can use the msgbox function to replace your printf functions. And you might use text input boxes to replace the use of the scanf function in C.

hkdani 39 Posting Pro in Training

But, X and Y positions are not change when the cursor arrive the boundary because X and Y are the location of screen. May be the code that is written by me is wrong.

That's because the GetCursorPos retrieves the position of the cursor on the screen. Again, The GetCursorPos API retrieves the X Y position of the mouse cursor relative to the screen coordinates. I believe all mouse positions of this API are relative to the screen. When the mouse hits the boundaries it ceases to move. And hence the cursor is not moving.

Is there any other API to detect mouse movement without using GetCursorPos API?

GetMouseMovePointsEx API Function: retrieves up to 64 previous positions based on screen coordinates.

Actually, I want to show the output when the mouse is moving where the cursor is. If mouse moving stops, the output will stop.

Apparently, nobody from among the Windows designers sensed a need to track a mouse where it can't be seen. And your statement is not fully correct: The mouse on the screen only moves when the cursor moves. The mouse on the screen will not move if its cursor position stays the same.

Your physical mouse may move, but that does not necessarily mean that the mouse on the screen will move. You would have to declare a RECT structure that is greater in size than the screen coordinates. I don't know if it's possible to create a RECT structure as you desire. …

hkdani 39 Posting Pro in Training

it dont' know whether the mouse is still moving

I would say you're right. The GetCursorPos just pulls the current position in relation to the screen.

I really would like to know how to sense the mouse is moving.

I would say you're also right about not using MouseMove for sensing mouse movement outside of the form.

So, I would recommend using static variables in the timer function. I would declare regular (e.g., Dim lngScreenX as long) variables to assign the values obtained from the GetCursorPos API. And then I would also declare a couple of Static variables inside the Timer function to use to compare with the values of Point.X and Point.Y. I would assign the static variables value at the end of the timer function code after assigning the variables declared with a Dim statement.

If either of the Static variable's value differs from the Dim Declared variables inside the timer function has changed, then the mouse has moved.

Is it related with GetWindowRect API?

The GetWindowRect API just pulls the top, left, bottom, and right coordinates of the form with the handle referenced in the API. These coordinates will be in relation to the computer monitor's screen pixels: 0,0 being the top left and the bottom right being 1023, 767 (if monitor resolution is set as 1024 x 768).

hkdani 39 Posting Pro in Training

But, I still can't detect it when the mouse pointer get the boundaries of the Screen although the mouse is moving.

If no handle is specified the GetCursorPos API only responds within the reference of the screen coordinates of your monitor:0,0 is your upper left hand corner of your monitor screen.'

You can change the area which the GetCursorPos API responds to by using the GetWindowRect API. Call that API and then call the GetCursorPos API.

If you want to show areas outside of the window whose handle the GetCursorPos API is using, you can declare static variables in the MouseMove Event to give values outside of the window. You'll have to determine the size of your screen first, however.

If your screen is at a resolution of 1024 x 768, then you can use those values as a reference in the MouseMove, MouseUp, and MouseDown events to programatically give you the value you desire.

Though why in the world you would want to know where your mouse isn't is beyond me.

Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Static StaticLongPos as long
'
If X = 0 then 
  StaticLongPos = StaticLongPos - 1
elseif X > 0 then
  StaticLongPos = 0
EndIf

This only deals with a mouse movement to the left: when the X value is 0 the mouse is moving left; so, you subtract a value.

You should use the same logic to deal with the …

hkdani 39 Posting Pro in Training

The two APIs you're looking for are the following:

(1) QueryPerformanceFrequency

(2) QueryPerformanceCounter

The first API retrieves the timing resolution that your system is capable of: depends on your CPU. The Second API retrieves the actual time. VB6's timer's are not that accurate. These are the API's you're looking for.
The QueryPerformanceFrequency will tell you how many counts in a second your system is capable of. You use the second at the start and end of the events you wish to time. That will give you the counts that have have passed.

You'll need to do some investigation in the Platform SDK concerning more details.

Private Type LARGE_INTEGER
    LowPart As Long
    HighPart As Long
End Type
Private Declare Function QueryPerformanceCounter Lib "kernel32" (lpPerformanceCount As LARGE_INTEGER) As Long
Private Declare Function QueryPerformanceFrequency Lib "kernel32" (lpFrequency As LARGE_INTEGER) As Long
hkdani 39 Posting Pro in Training

So the Visual Basic Programm communicates with the microcontroler on the circuit board. I'm able to change some settings and so on... ocer the RS232.

If you are controlling the Communications Port (RS232) with the Microsoft Comm Control--which I take it you are since you're using Visual Basic 6.0--then you should code your program to raise events in the MsComm1_OnComm1 event.

Private Sub MSComm1_OnComm()

End Sub

A good way to do this is to design a class module and declare an event: this example's code is from class module named clsMicroController

Option Explicit
Public Event AudioFrequencyReceived(ByVal Hertz As Long)

Public Function ChangeColor(Hertz_Received As Long)
   RaiseEvent AudioFrequencyReceived(Hertz_Received)
End Function

And then you need to declare the event in your main form with the class module as follows:

Option Explicit
Private WithEvents MyRS232 As clsMicroController
Private Const RED = 100
Private Const BLUE = 75
Private Const YELLOW = 50

And then I imagine you already have some code in your ONCOMM event that you can use to determine what Hertz you've sent. Use that section to use the event you declared in your class module

Private Sub MSComm1_OnComm()
   Dim lngHertz As Long, Value_Received As Long
   lngHertz = Value_Received
   ' Raise your event
   MyRS232.ChangeColor (lngHertz)
   
End Sub

At this point the ChangeColor event is fired from your class module and you should see the event in the main form:

Private Sub MyRS232_AudioFrequencyReceived(ByVal Hertz As Long)
   Static Current_Color As Integer
   ' Code to turn on/off your lights
   Select …
hkdani 39 Posting Pro in Training

how to use sdk in vb.6

Api-Guide has a free download you can use with some actual examples.

You can download their free program of VB6 examples. http://allapi.mentalis.org/downloads/apiguide/agsetup.exe

But basically an Application Programming Interface (API) is a program written in C/C++ that you can reference in Visual Basic by translating the variables and including the libraries in a format that can be recognized in Visual Basic 6.0. The Software Development Kit (SDK) is now at Windows 2003 R2 and can be used in the VB6 environment.

Most of Windows is built on these APIs and when you wish to expand the capabilities of Visual Basic you can leverage the APIs in your application.

Check out the recently posted Sensing the Mouse's Movement Thread which I posted. It should be a good example of how to track the mouse position outside of a VB6 form using one of the SDK's APIs: GetCursorPos.

VB6 comes with an API Viewer with some prewritten or translated APIs for use in VB6: It has declarations (functions), Constants, and Types (structs in C) already translated and ready for use in VB6.

Hank

hkdani 39 Posting Pro in Training

Use the GetCursorPos API

Option Explicit
Private type POINTAPI
    X as Long
    Y as Long
End Type

Private declare function GetCursorPos lib "User32" (lpPoint as POINTAPI) as long

You can use the function inside of a Timer Control. You need to make sure the timer control is enabled and set the interval at which you want the timer control event to fire. The interval property is measured in milliseconds; so, 1000 for the interval property would equal 1 second.

Private Sub Timer1_Timer()
dim Point as POINTAPI
dim lngReturn as long
dim lngScreenX as Long
dim lngScreenY as Long
lngReturn = GetCursorPos(Point)
lngScreenX = Point.X
lngScreenY = Point.Y
' Enter Code to whatever you want with the results
'  
debug.print "X-pos: " & lngScreenX & " , Y-pos: " & lngScreenY
End sub
hkdani 39 Posting Pro in Training

how to save a visual basic form in any file format such a jpeg??

Okay, I'm confused. What do you really want to do: (1) take a screenshot of your form and save it in jpeg?, or (2) save an image to be used on your form?

hkdani 39 Posting Pro in Training

The matching results are sorted out of the rest.

I take it you mean you want to remove the list entries that don't match what you've typed in?

Your first step might be to save the complete list in some sort of array.

Option Explicit
Dim strPeople() As String
Dim intListCount As Integer

Private Sub Form_Load()
Dim IntCounter As Integer
intListCount = List1.ListCount
ReDim strPeople(intListCount - 1)
'
For IntCounter = 0 To (intListCount - 1)
   strPeople(IntCounter) = List1.List(IntCounter)
Next
'
End Sub

Use this a master list to fill the combo box as you type. I wouldn't suggest filling the combo box to start with, but build your list first using your values from Access.

Use the KeyPress Event in the Combo Box to use with string search functions to fill your list as the user types.

But in essence each time he types, put code in the KeyPress Event to build the list for the combo box.

Hank

hkdani 39 Posting Pro in Training

The mouse's positions is determined by the handle of the window that is active. Once you go outside of a vb form, then you need to use other means to trace the mouse. This calls for a couple of Windows APIs. I'll look into it.

Hank

hkdani 39 Posting Pro in Training

I have seen products that will DECOMPILE anything and give you the source. I am confused!

That's what Obfuscators are for: to foil the decompilers. A lot of programmers don't bother with obfuscating their compiled program.

In deployment, you deploy certain files to be accessed over the intranet, internet, etc. The client uses an installer which is programmed to download the files that it needs it needs on the client side. A lot of these are precompiled files for the most part. These are the files that you want to obfuscate: your own controls, components, executables, etc.

client side who does it?

Who does what? Do you mean protect your compiled files that the client is using?

If you're concerned about piracy, Microsoft has published several articles on what the programmer can do to protect his program.

Use their encryption and decryption APIs from the SDK. Program checks in the program based on binary values from files instead of text. It's really hard to make any sense from a bunch of 1s and 0s. But give a pirate some text files from compiled files, and he's off to the races.

These are just a few hints. READ the MSDN documentation.