mrmike 1 Light Poster

just create a shortcut to the file and save it on your desktop

remember to ensure that the client pc you are running from has the relevant dll's installed

mrmike 1 Light Poster

check the win32api.txt file and search for 'windows network support'

everything is listed in that section regarding the functions you need

i know how to do it under delphi, but ain't converted it to vb yet

mrmike 1 Light Poster
mrmike 1 Light Poster

yes as long as you know the password

need to use the following

Sheets("sheettounprotect").Unprotect ("password")

rest of code

Sheets("sheettoprotectagain").Protect ("password")

mrmike 1 Light Poster

I do have a delphi routine, that I wrote inconjunction with a friend a while back that can take an ini file and convert it to a .dat file format and encrypts the data (simple encryption)

when run it checks for an ini file which may contain any new or updated information and then modifies the dat file accordingly. if the ini file is not found it just uses the dat file.

it doesn't have the ability to update the records at moment, but could possibly be modified to do that

each record in the ini file is '~' delimitated

let me know if need some code snippet

mrmike 1 Light Poster

forgot to mention this is with delphi 6

mrmike 1 Light Poster

I've mad a small program to log events to the event logs, but have come across an issue

I can log to both Application and System, but unable to log to the security log

does anyone know if you can log to the security log or not

thanks
mrmike

mrmike 1 Light Poster

A bit more info on what you are attempting to do, and what the problem is with the code you already have

mrmike 1 Light Poster

as would say if this is for college work to help you get your graduation, then surely you should be looking at writing the whole program yourself, and not using someone elses and passing it off as your own

users can give you help and guidance, but not give you the full code

mrmike 1 Light Poster

this is because you have a 'repeat' without an 'until' and a 2nd 'begin' with out an 'end'

ie

Repeat
do this statement
do this statement
Until endresult=certainvalue or condition

before the last end add another end

regards
mrmike

mrmike 1 Light Poster

i couldn't get vb or delphi under xp home - work fine under xp pro though

mrmike 1 Light Poster

create a form with 2 richtextboxes and one command button on it.

next try the following code

Private Sub Command1_Click()
Dim lvStart As Integer
Dim lvEnd As Integer

Randomize (Timer)
lvStart = 1
lvOld = 1
RichTextBox2.Text = ""
RichTextBox2.Refresh
RichTextBox1.Text = Replace(RichTextBox1.Text, "  ", " ")
Do
 lvStart = InStr(lvOld, RichTextBox1.Text, " ")
 If lvStart > 0 Then
  RichTextBox2.Text = RichTextBox2.Text + Scramble(Mid$(RichTextBox1.Text, lvOld, lvStart - lvOld)) + " "
  lvOld = lvStart + Len(" ")
 End If
 If lvStart = 0 And lvOld < Len(RichTextBox1.Text) Then
  RichTextBox2.Text = RichTextBox2.Text + Scramble(Mid$(RichTextBox1.Text, lvOld, Len(RichTextBox1.Text) - lvOld + 1)) + " "
 End If
Loop Until lvStart = 0
End Sub

Function Scramble(tempstr As String) As String
Dim myloop As Integer
Dim mystring As String
Dim MyValue
MyValue = 0
If Len(tempstr) < 4 Then
 Scramble = tempstr
 Exit Function
End If
mystring = ""
myloop = 0
 While Len(tempstr) > 0
  While MyValue = 0 And Len(tempstr) <> 0
   MyValue = Int((Len(tempstr) * Rnd) + 1)
  Wend
  mychar = Mid$(tempstr, MyValue, 1)
  mystring = mystring + mychar
  tempstr = Mid(tempstr, 1, MyValue - 1) + Mid(tempstr, MyValue + 1, Len(tempstr))
  MyValue = 0
 Wend
Scramble = mystring
End Function

as you can see the above does exactly what you want in less code, you'll just have to modify it for characters you don't want moving about

if loading the text in just load it straight to the box

regards
mrmike

mrmike 1 Light Poster

r u sure they not running XP Pro, as XP Home has a lot of features missing, this is why a lot of programming languages won't work under XP Home.

My advice is to install XP Pro

regards
mrmike

mrmike 1 Light Poster

What is the error cos the above code is ok

if enters Admin sets the editbox to readonly
if enters 1234 shows form2

if neither above are true then shows 'Incorrect username and password'

mrmike 1 Light Poster

if need the actual code let me know and i'll try to knock something up

mrmike 1 Light Poster

if you need some code let me know and i'll try to get something knocked up

mrmike 1 Light Poster

set a flag to be true
use a for next loop to check all editboxes and ensure if something is entered
if a box has nothing in it set the flag to be false
when exit loop, check if flag is true/false, if true save details, if false flash message on screen

mrmike 1 Light Poster

easiest solution would be to find the count of the number of members currently listed, add 1 when new user is created, then use the format command to format the string with leading zero's

mrmike 1 Light Poster

set the OnEnter event for each editbox to point to the EditClick

regards
mrmike

mrmike 1 Light Poster

use the following and set the OnCloseQuery event to call it

procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
application.Messagebox('Sorry you are unable to terminate this application','Close Request Received');
CanClose:=False;
end;

regards
mrmike

mrmike 1 Light Poster

thanks

i'll check it out - mainly using the registry to read values using TRegistry, and check fileversion numbers of particular files

mrmike 1 Light Poster

fails straight away with kernel32.dll error on windows 2000 - but not sure why as on certain win2000 machines it will work

it has to work on all versions of windows ideally

mrmike 1 Light Poster

The labels are not required, but were used for testing, as you change from the editbox to the button, the editbox will lose focus, and the button will become focused, thus giving you an issue if using more than one edit box.

The procedure ButtonPressed uses the TAG option to assign the ascii codes for each button pressed to be displayed in the correct edit box, which is obtained from the EditClick procedure. Remember to set the OnClick event for each of the corresponding buttons.

procedure ButtonPressed(Sender: TObject);
var
index   :Integer;
result  :Integer;
begin
result:=0;
for index:=0 to ControlCount -1 do
 begin
 if (Controls[index] is TButton) and TButton(Controls[index]).Focused then
 result:=index;
end;
    Label2.Caption:='Button Active '+Char(TButton(Controls[result]).Tag);
    TEdit(Controls[cureditbox]).Text:=TEdit(Controls[cureditbox]).Text+Char(TButton(Controls[result]).Tag);
end;

As the focus will change from the editbox selected to the button being pressed, the following procedure will handle which box will be updated when pressing button. You will need to set the OnClick event for each edit box to point to this procedure.

procedure EditClick(Sender: TObject);
var
 loop :integer;
begin
 cureditbox:=1;
for loop:=0 to ControlCount -1 do
begin
 if (Controls[loop] is TEdit) and TEdit(Controls[loop]).Focused then
  cureditbox:=loop;
end;
Label1.Caption:='Edit Box Active '+Char(TEdit(Controls[cureditbox]).Tag+48);
end;

regards
mrmike

mrmike 1 Light Poster

to hide taskbar

Link to hide taskbar @ dancemammal.com

regards
mrmike

mrmike 1 Light Poster

you could create a popmenu and then use the mousemove event to display it, not sure how to get it to hide though when movemouse off the control in question

you could also try looking at http://www.dancemammal.com

regards
mrmike

mrmike 1 Light Poster

if using an edit box then don't need to use writeln

for each button give it a tag number corresponding to the ascii value you want it to display (ie 0 = 48, 1 = 49, 2 = 50, etc)

create the following procedure

procedure TForm1.ButtonPressed(Sender: TObject);
var
index   :Integer;
begin
for index:=0 to ControlCount -1 do
begin
 if Controls[index] is TWinControl then
  if (Controls[index] as TWinControl).Focused then
   Edit1.Text:=Edit1.Text+Char(((Controls[index] as TWinControl).Tag)
end;
end;

and then set the OnClick event for each button to go to ButtonPressed

hope this helps
mrmike

mrmike 1 Light Poster

i would assume each button will be set up individually

if so then name it button, and use onclick to display value

mrmike 1 Light Poster

I've been creating a small program, thats work fine under windows xp, but fails on windows 2000 pro/server, and also windows 98.

I need the software to work on also windows versions, etc 95 and ME.

I can't install it as it is a check to ensure that various software has been installed before shipping out to customer, so having to run directly by floppy and usb.

any ideas? I'm using Delphi 6 at moment

thanks
mrmike

mrmike 1 Light Poster

the easiest way of adding into array and increasing at same time is as follows

var
 myarray :array of integer;
 lastrecord: integer;

begin
 lastrecord:=0;

while lastrecord<20 do
 begin
  setlength(myarray,lastrecord+1);
  myarray[lastrecord]:=input_value;
  lastrecord:=lastrecord+1;
 end;
mrmike 1 Light Poster

Sorry comatose,

thought if shown the delphi code, may have been able to convert it to vb code.

mrmike 1 Light Poster

i've never done this under VB but did write a routine that could map drives under delphi.

the following code is how it works under delphi, you could see if can change to work with VB.

function ConnectDrive(_drvLetter: String; _netPath: String; _password: String; _username: String; _showError: Boolean; _reconnect: Boolean; _interactive: Boolean): DWORD;
var
 nRes            :TNetResource;
 dwFlags         :DWORD;
 errCode         :DWORD;
begin
 FillChar(NRes,SizeOf(NRes),#0);
 nRes.dwType:=RESOURCETYPE_DISK;
 nRes.lpLocalName:=PChar(_drvLetter);
 nRes.lpRemoteName:=PChar(_netPath);
 nRes.dwScope:=RESOURCE_GLOBALNET;
 dwFlags:=0;
 If _reconnect then dwFlags:=CONNECT_UPDATE_PROFILE;
 If _reconnect and _interactive then dwFlags:=CONNECT_UPDATE_PROFILE and CONNECT_INTERACTIVE;
 Result:=WNetAddConnection3(form1.Handle,nRes,PChar(_password),PChar(_username),dwFlags);
 end;

function DisConnectDrive(_drvLetter: String; _showError: Boolean; _force: Boolean; _save: Boolean): DWORD;
var
 nRes           :TNetResource;
 dwFlags        :DWORD;
 errCode        :DWORD;
begin
if _save then
 dwFlags:=CONNECT_UPDATE_PROFILE
else
 dwFlags:=0;
 errCode:=WNetCancelConnection2(PChar(_drvLetter),dwFlags,_force);
if (errCode<>NO_ERROR) and (_showError) then
 begin
  Application.MessageBox(PChar(SysErrorMessage(GetLastError)),
  'Error Disconnecting Drive',
  MB_OK);
 end;
 Result:=errCode; {NO_ERROR}
end;

You could have a couple of text inputs on the form, with a command button. When clicking on this after filling the info in, you could connect the drive. When the program closes you could get it to call the disconnect feature to ensure properly disconnected.

If need further help, I'll try to get it converted to a VB app, but due to workload can be sometime before I get it done.

Good Luck

Mike

mrmike 1 Light Poster

delphi isn't too bad..

there are a lot of differences between the 2

mrmike 1 Light Poster

best solution I can give is to try socketwrench from catalsyt.

this was mentioned to me by comatose as I was having problems with a project I was doing, and found that it helped me do what i want it to do.

http://www.catalyst.com

the addin is also free and you can download a help document on it as well

mrmike 1 Light Poster

Hi Comatose,

Sorry for delay in responding to this but been very busy.

But first thanks for the help :cool:

Well the news is I've managed to do what I need it to do.

I've used the socketwrench control due to the timeout parameter.

I store a list of ports to be scanned in an ini file which is loaded everytime the program is run. You can add or remove ports and this will also change the listview box settings.

It then asks for a file with the list of ip's to scan, and loads those into an array. Then goes about checking the ports required on each ip, and writes the results to a csv file, as well as displaying on the screen


regards
mrmike

mrmike 1 Light Poster

hi and welcome

the progress bar can be used under vb6 as well as .net

not sure what you know of progressbars but they are very simply to use

progressbar.min=minimum_value
porgressbar.max=maximum_value
progressbar.value=current_value

it will probably depend on how far indept you have to go for the project. but some basic forms would have to hold staff details/times, stock levels/costs, lists of suppliers, budget, invoicing, etc, etc

I'm sorry I haven't any forms for you to look at

Comatose commented: Good Job +1
mrmike 1 Light Poster

thanks for the info I will give that a try and let you know how it works out

i had set the loop count to 1 just for routine for testing as noticed the combobox list actually pulls the scanlist.txt file in at start index of 1 and not 0.

I did also notice that unlike delphi you can't use combobox1.clear which resets a combobox and then allows you to load data starting ar point 0.

mrmike 1 Light Poster

Thanks,

looked at TTPScan and gets error loading cswsk32.ocx on loading into vb.

I still loaded at had a look, seems to be doing exactly same as I'm trying, but if I add under

/* If We Are NOT Scanning Just Well Known Hosts */

the following

For myloop = 1 To ScannedList.Count

Text1.Text = ScannedList.Item(myloop)

and place a Next before the End Sub, I get exactly the same error I get in my code

Run-time error '40020':
Invalid operation at current state

If I close the port after connecting or not then when goes to next ip in list, it doesn't display info for the first ip.

As we're going to put this on one of servers, which we use to update our customers with, I need it to go through a list, of ip's and connect to each, check 10 ports, and then create a report to be sent to the managers listing any problems found.

mrmike 1 Light Poster

I'm busy writing an application for work which needs to connect to a list of our servers and check some ports to ensure the correct ones we require are open and ones we don't use are closed.

I'm using winsock and checking for a connection and the results are being written out to a csv file so we can then filter various settings.

if I use a single ip i am fine the program works without a problem, the issues arise when I incorperate a loop to cycle through and only if i use them same sockets repeatedly.

ie: I'm looking at 10 ports on 50 servers

i've set my portlist up and loadup the sockets, then assign the relevant values to winsock then connect. If I connect or not I then close the socket so I can then use on next ip. But it only seems to pull through the last ip in the list, and not the others.

How can I delay the loop long enough for it to do each ip correctly, instead of skipping them

mrmike 1 Light Poster

thanks for the info

changed the function to

Function mydata(ByVal item as integer, ParamArray valuelist() as variant)

and this works fine

mrmike 1 Light Poster

Just got a quick question

I know how to assign arrays using the DIM command, but I want to give the array a set of constant figures that will never change

Under Delphi I would use the following when declaring the array at startup

var
myarray :array[0..8] of integer = (value1, value2, value3, etc, etc)

how can I do this under VB6, I have looked at the MSDN help but it only shows on how to create the DIM array, and nothing about assigning a particular list.

I have set the line as

Dim myarray(8) as integer

but if I add '= (value1, value2, value3, etc, etc) it reports an error

does this mean I have to set each item individually on each line as follows

myarray(0)=value1
myarray(1)=value2
myarray(2)=value3

or is there an easier solution

thanks

mrmike 1 Light Poster

this is just a quick message to say hi to everyone on these forums.

even though I am more involved with hardware and diagnostics, i've been dabbling a bit with delphi and written a few applications for the company i work for, but due to how it works i'm now trying my hand at visual basic.

I have done programming before but many years ago on the (BBC Micro (assembler) and Atari ST (Highsoft Basic)), so hopefully shouldn't be too hard to pick up again.

hopefully i can pick up some good tips from these forums

mrmike