Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all 21916 articles
Browse latest View live

Different approaches to create a snapshot file of a folder tree

$
0
0
I'm looking to take a snapshot of a folder tree. It should contain name/size/timestamps/attributes of each file system object in the tree and its location within the tree hierarchy. I should be able to recreate the folder tree from the snapshot file.

I can come up with ways to do this but I'm wondering what the fastest and most memory efficient way to do this would be. What are some approaches you would all consider using for this task? I've got the folder tree data already in my internal structures (WIN32_FIND_DATA from FindFirstFile/FindNextFile APIs) so I'm mostly interested in the storage of the data in a single file.

Thanks in advance.

closing excel problem

$
0
0
I have a vb6 program that opens a csv file, extracts data from it and then adds that data to a spreadsheet and updates a chart with the added data.
The essence of the program is:

Code:

Sub main()
Dim XL As Excel.Application
'start excel
    Set XL = CreateObject("Excel.Application")
' open csv file
    Workbooks.Open FileName:=xlFilename
    sheetName = ActiveSheet.Name
    Worksheets(sheetName).Activate
' extract data
' close csv file
    ActiveWorkbook.Close savechanges:=True
    XL.Quit
'start excel again
    Set XL = CreateObject("Excel.Application")
' open xlsm
    Workbooks.Open FileName:=xlFilename
    sheetName = ActiveSheet.Name
' write data to xlms
    '.......
    'update a chart
            ActiveSheet.ChartObjects("Chart 1").Activate
            ActiveChart.SeriesCollection(1).Values = "=Summary!$D$2:$D$" & lastrow + 1
            ActiveChart.SeriesCollection(2).Values = "=Summary!$B$2:$B$" & lastrow + 1
            ActiveChart.SeriesCollection(2).XValues = "=Summary!$A$2:$A$" & lastrow + 1
' close xlsm and save changes
    ActiveWorkbook.Close savechanges:=True
End Sub

The problem I have is that, although the program does exactly what I want, when the program closes, sometimes an instance of excel is left running. I can only see this instance in Task Manager and I have to end this process before I can run the program again.

I admit that the way I open and close the excel application could probably be done much more effectively but I have tried all sorts of variations and cannot get the right way. This version works most of the time but as I said only sometimes it does not close excel on exit. I have noticed that if I delete the 4 lines re the chart, the program ends properly (ie no instance of excel left running) more often than when I update the chart.

Can anyone offer a reason why the program acts differently on exit sometimes?

Also, if there are better ways to open and close excel than I am doing, I would appreciate knowing them.
Thanks

textbox show just show "false" when I choose list on datalist vb6

$
0
0
How do I fix this error. I am setting a datalist like this: data list screenshot here

And I have table like this:

+-------------------+
|---ID----|---NAME--|
+-------------------+
|---101---|---CNN---|
|---102---|---BBM---|
+-------------------+
On the datalist I am using ID for listfield. I want show the name directly in the textbox when i choose ID list from listfield.
e.g. : i choose ID 101 in datalist then show CNN in textboxname

Private Sub DataList1_Click()
Txtnama.Text = DataList1.ListField = "nama"
End Sub
Problem: the textbox just shows "false". How do I fix this code. please help me
thanks

vb6

[RESOLVED] Request for Non-US Res File

$
0
0
Question about resource files and VB...

I attempted to add a non-US unicode name (i.e, Chinese, Russian, etc) to a resource bitmap. For example, instead of 101 for the bitmap resource name, used: Добро пожаловать

The resource file was valid, though VB couldn't display it properly. I then compiled a test app with that resource & VB did so without errors, but changed the bitmap's res name to all ? characters when viewed in NotePad/WordPad. From what I've read is that MultiByteToWideChar calls are performed on those strings during compilation, which would explain what I'm seeing. If you are curious, I was able to do this by manually creating the resource file.

So, out of curiosity, for those that typically work in non-US locale while using VB, could answer a couple questions?

1) Does VB even let you use non-US character set when renaming a res file item?

2) If above question's answer is yes, then could you be so kind as to add a simple bitmap to a new res file, rename the bitmap from 101 to non-US characters and upload it here? I'd like to review it. I know I could probably do this by changing my system's regional settings, but fear it could be a flawed test if I did something incorrectly.

Note: I am not talking about string tables

Additional question for those far more knowledgeable than I. For US-locales, I noticed that VB forces upper case res item names when using string vs. integer names. I was able to use mixed case res names and both VB and APIs had no problems. Is this documented somewhere?

Edited: Mixed case is not applicable. After reviewing a compiled exe, in NotePad, with a res name using mixed case, the name was changed to all upper case. I think that whatever VB uses to compile resource files (rc.exe? something else?) into an app is doing these conversions. The conversions are only applicable to the app, not the original res file which still contains the mixed case & unicode names I'm playing with.

Regarding the unicode name I tried, VB actually loaded (and displayed the bitmap) from the res item fine, but APIs reported "resource not found" error when passing it the name I used. Thinking VB did a MultiByteToWideChar conversion which located the resource item, while passing the string pointer directly to APIs no conversion performed and APIs couldn't find it, because the name was converted to all ? characters when I compiled the app.

Error 3420 object invalid or no longer set

$
0
0
Hi im using a win server and i have many systems on win 7 which is 32 bits im getting this error very often where i need to reset the server pls help

Vb6 ide

$
0
0
I want to download the ide for windows 10 but not getting a link

VB6 fails, or Win7 fails, or my setup fails?

$
0
0
try to do this.

New project

setup a timer with 1000ms

in timer code

form1.width = 500

in form1_resize event write a BEEP



now RUN!


what happens?, If I manually resize the window dragging the border, the code will resize back it to 500 width.

but the BEEP sounds like 5 FIVE seconds later!!!!!!!!!!!!!!!

FIVE ....... seconds later.


WHY? I am using the VB6 SP6 and everyhing...

It does that in compile time, and in design time.


my setup win7 ultimate x64. AMD, SSD and 4GB ddr2 800 (it is a notebook ACER) QL-64 2.1Ghz (and nobody is interested in stealing it, not an apple logo, nop, ah just let it alone), ideal to code in coffe shops! ;)

CPU USAGE 99% free.

[RESOLVED] PDF Picture Extraction

$
0
0
I have a PDF document (which I did not create) with about 120 pictures (all the same size). I was able to use Word and convert it successfully to MS Word format and also see each picture; and then I can click on each and save it as an image elsewhere. But, that is time consuming. What I'd like to develop is a VB6 program to extract every image (picture) (could save them as numeric names so I can loop/use later in another program I already have that uses images.) The program I already wrote is a Directory for my Church and the images are members.

I have Googled and found third party add-ins that the companies say work fine with VB6, but I don't necessarily like to download these if I don't have to do so.

Any idea where to start? Some API?

Sam

vb6 and crystal report question

$
0
0
I am not sure if this question should be in here cause it involves vb6 code and crystal report or sql query.

I have this record for example group of subjects and grade per student. I will print this record on half paper. I would like to appear each subject with corresponding grades separately in each half size paper. so like math and algebra would be shown on one paper since they belong to same group and english on another paper and so on.

I have group id assigned to each subject.

Its like, they are page 1, its the math and algebra then page 2 its english and so on.

How will i do that?

[RESOLVED] closing excel problem

$
0
0
I have a vb6 program that opens a csv file, extracts data from it and then adds that data to a spreadsheet and updates a chart with the added data.
The essence of the program is:

Code:

Sub main()
Dim XL As Excel.Application
'start excel
    Set XL = CreateObject("Excel.Application")
' open csv file
    Workbooks.Open FileName:=xlFilename
    sheetName = ActiveSheet.Name
    Worksheets(sheetName).Activate
' extract data
' close csv file
    ActiveWorkbook.Close savechanges:=True
    XL.Quit
'start excel again
    Set XL = CreateObject("Excel.Application")
' open xlsm
    Workbooks.Open FileName:=xlFilename
    sheetName = ActiveSheet.Name
' write data to xlms
    '.......
    'update a chart
            ActiveSheet.ChartObjects("Chart 1").Activate
            ActiveChart.SeriesCollection(1).Values = "=Summary!$D$2:$D$" & lastrow + 1
            ActiveChart.SeriesCollection(2).Values = "=Summary!$B$2:$B$" & lastrow + 1
            ActiveChart.SeriesCollection(2).XValues = "=Summary!$A$2:$A$" & lastrow + 1
' close xlsm and save changes
    ActiveWorkbook.Close savechanges:=True
End Sub

The problem I have is that, although the program does exactly what I want, when the program closes, sometimes an instance of excel is left running. I can only see this instance in Task Manager and I have to end this process before I can run the program again.

I admit that the way I open and close the excel application could probably be done much more effectively but I have tried all sorts of variations and cannot get the right way. This version works most of the time but as I said only sometimes it does not close excel on exit. I have noticed that if I delete the 4 lines re the chart, the program ends properly (ie no instance of excel left running) more often than when I update the chart.

Can anyone offer a reason why the program acts differently on exit sometimes?

Also, if there are better ways to open and close excel than I am doing, I would appreciate knowing them.
Thanks

[RESOLVED] VB6 fails, or Win7 fails, or my setup fails?

$
0
0
try to do this.

New project

setup a timer with 1000ms

in timer code

form1.width = 500

in form1_resize event write a BEEP



now RUN!


what happens?, If I manually resize the window dragging the border, the code will resize back it to 500 width.

but the BEEP sounds like 5 FIVE seconds later!!!!!!!!!!!!!!!

FIVE ....... seconds later.


WHY? I am using the VB6 SP6 and everyhing...

It does that in compile time, and in design time.


my setup win7 ultimate x64. AMD, SSD and 4GB ddr2 800 (it is a notebook ACER) QL-64 2.1Ghz (and nobody is interested in stealing it, not an apple logo, nop, ah just let it alone), ideal to code in coffe shops! ;)

CPU USAGE 99% free.

How to make Screen.width / height, always return the size of the screen?

$
0
0
I have a screen blocker form which is suppose to cover all the screen.


But, reading, Screen.Width or Screen.Height, not always returns the size of the only one screen in the system.

When?

When a game was running, lets say, a 1024x768 game.

Then the program kills the game process, so it is shutdown not by normal ways.

something in the Windows or drivers, resize the screen to 1920x1080.

But the VB6 app, still reading the old game resolution from the Screen object.

So, running.

form1.top=0
form1.left=0
form1.width=screen.width
form1.height=screen.height

will cover half the screen.

So, how to read the actual screen size?




PD: and this is why I was investigating the form_resize event in the other thread.

How to find out the current Window Viewable Height and Width of the WebBrowser Window

$
0
0
Hello me again, I am ThEiMp and I need to know how to find out the current Web Browser window Me.Width and also the Me.Height, even if it changes, like a resize too at that at the point of Compile Time access...

!! Thanks in advance !!

wanting to learn xml

$
0
0
Hi, I know there are lots of info in google and I have done that however, I dont understand those reading.

I would like to ask for simple codes for read, write, delete, update. I hope you can show us.

Automating Bing-Dict program

$
0
0
I need to use Bing-Dict frequently. I want to send English words from my VB application to the Bing-Dict window and let Bing-Dict translate the word automatically.

Bing-Dict.exe is a windows desktop program, but all of its UI are WebPage. In other words, I need to send keys to the WebPage, and trigger Enter, Select-All and Copy operations. But I found that the SetFocus API and FindWindow API are not valid for WebPage elements. What should I do? Thanks in advance.

Bing-Dict download address:
https://bingdict.chinacloudsites.cn/
Attached Images
 

Modal Form Issue

$
0
0
I am having an issue using a modal form. When Form1 activates modal Form2, I minimize Form1 and show Form2.
Code:

        Form1.WindowState = 1
        Form2.Show 1

It works like a charm in the IDE, but when the compiled program is run, Form2 doesn't have the focus.

Any ideas?

J.A. Coutts

[RESOLVED] Modal Form Issue

$
0
0
I am having an issue using a modal form. When Form1 activates modal Form2, I minimize Form1 and show Form2.
Code:

        Form1.WindowState = 1
        Form2.Show 1

It works like a charm in the IDE, but when the compiled program is run, Form2 doesn't have the focus.

Any ideas?

J.A. Coutts

Serial string not coming in full

$
0
0
Guys,
I'm new here... and stuck with arduino and VB6.

My arduino is a temperature controller. VB is for front end monitoring station.

Arduino sends this over serial:
Code:

$27;27;0;6;0xC1;0xF1;0xD0;0xA0;
here $ is just to understand the starting of a transmission.

Arduino gives so many output as a debug:
Code:

0xC0 Compressor status OFF
0xF0 Indoor Fan status OFF
0xD0 Defrost Status OFF

Type 'conf t' in 4 seconds to enter config mode

Indoor Sensor ADDR = 28 40 88 41 6 0 0 20
Indoor Sensor Data = 1 B4 1 4B 46 7F FF C 10 8E Indoor Sensor CRC=8E
Fins Sensor ADDR = 28 4C B2 41 6 0 0 64
Fins Sensor Data = 1 B2 1 4B 46 7F FF E 10 8C Fins Sensor CRC=8C
No Outdoor Sensor

Entering Normal Operation Mode

$0;0;0;6;0xC0;0xF0;0xD0;0xA0;
Room Temperature = 27
Fins Temperature = 27
Out Door Temperature = 0
0xF1 Indoor fan ON
0xC1 Compressor ON

Now, I need to strip out the line with $ and seperate the items. I know how to do it, but it's not working. Here is my MSCOMM EVENT.

Code:

Private Sub MSComm1_OnComm()
    InBuffer = ""
    InBuffer = MSComm1.Input
    If MSComm1.CommEvent = comEvReceive Then
        txtDebug.Text = txtDebug.Text + InBuffer '+ Chr(10) + Chr(13)
        rcvdString() = Split(InBuffer, ";")
        lblStatus.Caption = InBuffer
    End If
   
    txtDebug.SelStart = Len(txtDebug.Text)
   

End Sub

When via serial i send a command "ping" it makes the "pong" for me and sends... the $ value string... but then in debug window I get everything fine, but if try to see the rcvdString, or inbuffer or whatever, i get partials... Hope I'm able to make you guys understand where i'm stuck... If i can get a full string recovered, I can make the arrays and then can put them in different fields on demand... also, now the whole thing is coming. I just need to take the one sentence with $ and the ; deliminated and then strip each field from ; and then put them in appropriate lables for display.Name:  Untitled.jpg
Views: 54
Size:  29.9 KB

Please help...

Mishu~
Attached Images
 

Guidelines and Steps for Proper Installation of Visual Basic 6.0 and AV6.0 SP6 on Win

$
0
0
Question
Sign in to vote
0
Sign in to vote
I need guidelines and steps to install Visual Basic 6.0 and Visual Basic6.0 Service Pack6.

I have installed VB6.0 on Win7 Machine but while installing Service Pack 6.0 it says:

"Because Setup did not detect any Visual Studio 6.0 products on your system, the service pack will not be installed."
Name:  VBSP6installationError.jpg
Views: 26
Size:  13.2 KB

However, VB6 is installed on machine verified from control panel and Program Files(32 & 64)
Name:  controlPanelVB6.jpg
Views: 28
Size:  23.9 KB

I have tried my all possibilities, Please help here to install VB6 with SP6 on Win7.


Thanks,

Chandrakant
Attached Images
  

Can Not Load Imagelist from mscomctl.ocx

$
0
0
I've got a VB6 app that I maintain. One site that runs this program is still on XP and another is on an old copy of Windows 7 that had Windows update turned off.

When the customer got my latest and greatest both of them got a message saying "Can not load Imagelist from mscomctl.ocx".

After tons of research it looks like there was a bug introduced at some point in Windows affecting a few different components. For Windows 7, just turning on Windows Update and getting Windows all updated solves the problem.

Not an option for XP users.

Eventually I found one icon I had added to my Imagelist. It was a 32x32 .ico. I removed that icon, converted it to GIF and all was well.

So hopefully this helps someone else.
Viewing all 21916 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>