hkdani 39 Posting Pro in Training

You just need to build a string to enter in the first parametere of the Visual Basic Shell function.

If you have two text boxes, and the user has entered the appropriate numbers, just use the entered values to build your string for the first parameter of the Shell function.

lngReturn = Shell("c:\cfiles\cfile.exe " & txtNo1.text & " " & txtNo2.text, vbNormalFocus)

Your C++ program should be able to handle the arguments using GetCommandLine(), if using the GUI or argv[] if using a console application.

AndreRet commented: Nice answer. +12
hkdani 39 Posting Pro in Training

You can use the File System Object with its Drives collection object to find the serial number of a hard drive. Finding serial numbers on RAM and Motherboards is more complicated and involves being able to access the BIOS and accessing different areas of memory not normally accessible through visual basic commands or even Windows APIs. A knowledge of how to use the C programming language along with assembly language may be necessary to extract the information you wish for memory modules and CPU information.

Some of the information about the CPU can be determined using the GetSystemInfo API
with the SYSTEM_INFO structure.

Option Explicit
Private Declare Sub GetSystemInfo Lib "kernel32" Alias "GetSystemInfo" (lpSystemInfo As SYSTEM_INFO)
Private Type SYSTEM_INFO
        dwOemID As Long
        dwPageSize As Long
        lpMinimumApplicationAddress As Long
        lpMaximumApplicationAddress As Long
        dwActiveProcessorMask As Long
        dwNumberOrfProcessors As Long
        dwProcessorType As Long
        dwAllocationGranularity As Long
        dwReserved As Long
End Type

Dim fso As FileSystemObject

Private Sub Form_Load()
    On Error GoTo DriveError
    Dim drv As Drive
    Set fso = New FileSystemObject
    For Each drv In fso.Drives
        Debug.Print Hex$(drv.SerialNumber)
    Next
    Exit Sub
DriveError:
    Resume Next
End Sub
hkdani 39 Posting Pro in Training
Dim lngReturn As Long
lngReturn = Shell("c:\MyProgams\cfile.exe", vbNormalFocus)
hkdani 39 Posting Pro in Training

Wouldn't it be nice to have a sizable command button in VB6? Face it. In the hidden recesses of your mind you have always wanted to be able to resize that command button in VB6--after the program is running that is. It's just that VB6 has not provided you with a control you could just drop, double click, or paste onto your form that allows you that capability.

Well, this tutorial should show you how to have your own sizable command button. You can resize it. And that's cool, But you'll have to do further modifications, if you want to respond to click events, down states, up states, etc. If the response on this short tutorial is sufficient, I plan to post a tutorial on how to add those events to your VB6 program.

Option Explicit
Private Const WS_THICKFRAME = &H40000
Private Const WS_CHILD = &H40000000
Private Const WS_VISIBLE = &H10000000
Private Const BS_PUSHBUTTON = &H0&
Private Const WS_SIZEBOX = WS_THICKFRAME

Private lngSizeButton As Long

Private Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" _
    (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, _
    ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, _
    ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, _
    ByVal hInstance As Long, lpParam As Any) As Long
    
Private Sub Form_Load()
    lngSizeButton = CreateWindowEx(0, "Button", "&Sizeable Button", WS_SIZEBOX Or BS_PUSHBUTTON Or WS_CHILD _
        Or WS_VISIBLE, 10, 10, 200, 100, Me.hWnd, …
hkdani 39 Posting Pro in Training

I would say that you need to test for what the user has done. Not for what he hasn't done. The functions that use stdin take care of initializing the stdin buffer. Your job is to check what the user has put into the buffer after your function calls for use to stdin.

If you really want to know what's going on, find the source code for getchar() or whatever function you're calling to check the input from stdin. That should show you what takes place before you prompt the user for information from the keyboard.

There's no need to reinvent the wheel, if you have one already.

vedro-compota commented: ++++++++ +3
hkdani 39 Posting Pro in Training

I would recommend VB over C for working with Access database files. Writing code for C is more complex for working with Access Databases. Of course, a typical C programmer likes things more complex, anyway.

But Visual Basic 5, 6 was basically built to run Access databases and is fairly easy to implement. You may have finer control in a C program, but I'll doubt you'll need it or want the headaches of having to figure it out in C.

I've been programming for years. But for Rapid Application Development, I would say you just can't beat VB.

Argh. The C programmers are going to tell me to stay on the VB forum again.

hkdani 39 Posting Pro in Training

You don't need to initialize the array at first.

But you should define an array after

int main(void) // use void, don't leave it blank
// declare your array to your previously defined struct here.
// I'm not going to do it for you.
int i ;

for (i = 0; i <12; i++)
{
     // Fill in the values for your *struct here.
}

That should get you going along the right direction. If I would do more, I should probably sign up for your class and receive credit.

minimi commented: Thank you! +2
hkdani 39 Posting Pro in Training
#include <direct.h>
#include <stdlib.h>
#include <stdio.h>

int main( void )
{
   char* buffer;
   buffer = (char*)malloc(sizeof(char)*MAX_PATH) ;
   // Get the current working directory: 
   if( (buffer = _getcwd( NULL, 0 )) == NULL )
      // code to deal with error
   else
   {
      printf( "%s\n",buffer );
      free(buffer);
   }
}

Adapt it to your needs. But use the getcwd function.

hkdani 39 Posting Pro in Training

You can dynamically load a label, but you must have at least one on the form to begin with.

What you probably want to do is load the values into your combo box and assign the label value at the same time within your given Do loop. You will also have to add code--if you want to dynamically add labels--to position the labels so that you can see them. If you want to make it simpler, create and place an array of 8 labels on the form to begin with.

If you are going to use the same labels for each search, then you'll have to initialize the labels to a vbNullString value before entering your Do Loop so that you won't have any left over data from a previous query.

Dim i as Integer 
i = 0

' Clear Label values
for i = 0 to 7
   label1(i).Caption = vbNullString
next i

Do Until Data1.Recordset.EOF 'Stops when there are no more records to be added
CmbProduct.AddItem Data1.Recordset("Product Name") 'Loads all the Products from the database and adds them to the combo box
label1(i).Caption = CmbProduct.Text
Data1.Recordset.MoveNext 'Moves onto the next record after the previous has been added
i = i + 1
Loop
hkdani 39 Posting Pro in Training

You could do something like the following. This would prompt for good data. The
variable strAnswer will store the answer from the user. You might want to code
to validate the user's answer, though. This is just a general idea.

Private Sub CheckData()
Dim strAnswer As String
    If Combo1.Text = vbNullString Then
        strAnswer = InputBox("Please, enter proper data", "Data Error", "0")
        If strAnswer = "0" Then
            Exit Sub
        Else
            SaveData strAnswer
        End If
    End If
End Sub

Private Sub SaveData(ByVal GoodData as String)

End Sub
hkdani 39 Posting Pro in Training

Your first step should be to find the start or the end point.

You need to cycle through the matrix of given points until a start or end point has been found. At that point in your program, you can proceed to the next phase in your search. I presume you will start your search in one of the four corners of the matrix.

You probably should declare a two dimensional array to contain the values of the points on the matrix. I'm also assuming that the state for each point has already been supplied in some manner.

The values for the array declaration will depend on the size of your matrix. int MYPOINTS[100][100] ;

hkdani 39 Posting Pro in Training

Try running this outside the VB6 environment by isolating the web function with a call to the ShellExecute function.
If the problem persists, the problem should stem from the VB6 environment.
Make sure you have service pack 6 installed.

Option Explicit
' Windows Function ShellExecute
' Windows C Language Function, references the shell32 dynamic link library
'
' "HINSTANCE ShellExecute(
'    HWND hwnd,
'    LPCTSTR lpOperation,
'    LPCTSTR lpFile,
'    LPCTSTR lpParameters,
'    LPCTSTR lpDirectory,
'    INT nShowCmd
' );
' Opens or prints a specified file.
' Returns a value greater than 32 if successful, or an error value
' that is less than or equal to 32 otherwise. The following table
' lists the error values. The return value is cast as an HINSTANCE
' for backward compatibility with 16-bit Windows applications." (Visual Studio 6: MSDN)

' -----------------------------------------------------
' Windows Platform Software Development Kit (PSDK) Functions
Private Declare Function ShellExecute Lib "shell32" Alias "ShellExecuteA" (ByVal hWnd As Long, _
    ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, _
    ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

' ------------------------------------------------------
' Windows PSDK Constants
Private Const SW_MAXIMIZE = 3
Private Const SW_NORMAL = 1
Private Const SW_SHOWNORMAL = 1
Private Const SW_SHOWMAXIMIZED = 3
Private Const ERROR_FILE_NOT_FOUND = 2&
Private Const ERROR_PATH_NOT_FOUND = 3&
Private Const SE_ERR_NOASSOC = 31
Private Const SE_ERR_ACCESSDENIED = 5


Private Sub Form_Load()
    On Error GoTo LOAD_ERR
    Dim lngReturn As Long
    lngReturn = ShellExecute(Me.hWnd, "open", "iexplore.exe", "
       
hkdani 39 Posting Pro in Training

"Item cannot be found in the collection corresponding to the requested name or ordinal"

That usually shows up because the field name isn't spelled right or does not exist in the field names of the recordset.

hkdani 39 Posting Pro in Training

Try using something like the following for loading the control without a popup.

It works for password protected ftp sites: e.g. ftp://username:password@ftp.website.com

http://username:password@webaddress

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

thanks. but, dear tell me about my computer. it works with control panel.

Press the Power Button. That's a good one :) I like that one. Well, you weren't very explicit.

But I think this is what you want.

Add the Shell Controls and Automation reference in the Projects/Reference Menu by clicking on that item.

dim MyShell as Shell

Private sub form_load()
set MyShell = New Shell
     MyShell.Explore &H11 '  For My Computer
     MyShell.Explore &H3  '  For Control Panel
end sub

Private sub form_unload()
Set MyShell = Nothing
end sub()

Hopefully, that's enough to get you going. You can take the code from the form_load event and stick it in the appropriate Command Button.

Comatose commented: Very Good Work Here. +12
hkdani 39 Posting Pro in Training

("SELECT * from tblLecture where arlNumber = '" & lblLECNUM & "' ")

SELECT * from tblLecture WHERE alrNumber=" & cstr(lblLECNUM)

Don't think that will make much difference. But it's a little clearer.

there's my code, im having a error "DATA TYPE MISMATCH IN CRITERIA EXPRESSION "
but i cnt and no idea where it is.... and im still finding it

That particular error usually pops up when you have a NULL value coming from your form. Try using an error checking code before you run the SEQUEL statement.

If lblLECNUM.Caption <> vbNullString then
    ' Execute Code for Database
Else
    ' Do not execute Code for Database
Endif
hawisme000 commented: thx for helping =) +1
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

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