vb6

Does VB6 have a #pragma pack equivalent?

I am developing a TCP/IP client that has to deal with a proprietary binary protocol. I was considering using user-defined types to represent the protocol headers, and using CopyMemory to shuffle data to and from the UDT and a byte array. However, it appears that VB6 adds padding bytes to align user-defined types. Is there any way to forc...

Visual Studio 6 tips and tricks

Some of us would invariably have to support 'legacy' code using Microsoft's Visual Studio 6.0 IDEs which - although opinions would differ - are generally regarded to be less user friendly compared to the later incarnations of the Visual Studio series of IDEs. So I'd like to hear about some of your favourite hidden/poorly documented IDE ...

How do you write the end of a file opened with FILE_FLAG_NO_BUFFERING?

I am using VB6 and the Win32 API to write data to a file, this functionality is for the export of data, therefore write performance to the disk is the key factor in my considerations. As such I am using the FILE_FLAG_NO_BUFFERING and FILE_FLAG_WRITE_THROUGH options when opening the file with a call to CreateFile. FILE_FLAG_NO_BUFFERING ...

VBA array sort function?

I'm looking for a decent sort implementation for arrays in VBA. A Quicksort would be preferred. Or any other sort algorithm other than bubble or merge would suffice. Please note that this is to work with MS Project 2003, so should avoid any of the Excel native functions and anything .net related. ...

Microsoft JET SQL Query Logging or "How do I debug my customer's program?"

The problem: We use a program written by our biggest customer to receive orders, book tranports and do other order-related stuff. We have no other chance but to use the program and the customer is very unsupportive when it comes to problems with their program. We just have to live with the program. Now this program is most of the time ...

How to set working directory when debugging VB6 app?

I am debugging a VB6 executable. The executable loads dlls and files from it's current directory, when running. When run in debugger, the current directory seems to be VB6's dir. How do I set working directory for VB6? ...

Cancelling a long running process in VB6.0 without DoEvents?

Is it possible to cancel out of a long running process in VB6.0 without using DoEvents? For example: for i = 1 to someVeryHighNumber ' Do some work here ' ... if cancel then exit for end if next Sub btnCancel_Click() cancel = true End Sub I assume I need a "DoEvents" before the "if cancel then..." is the...

Borderless Taskbar items: Using a right click menu (VB6)

Even when BorderStyle is set to 0, it is possible to force a window to show up on the taskbar either by turning on the ShowInTaskbar property or by using the windows api directly: SetWindowLong Me.hwnd, GWL_EXSTYLE, GetWindowLong(Me.hwnd, Win.GWL_EXSTYLE) Or Win.WS_EX_APPWINDOW. However, such taskbar entries lack a right-click menu in ...

VB6 Integration with MSBuild

Hi Everyone, So this is a question for anyone who has had to integrate the building/compilation of legacy projects/code in a Team Build/MSBuild environment - specifically, Visual Basic 6 applications/projects. Outside of writing a custom build Task (which I am not against) does anyone have any suggestions on how best to integrate comp...

Prevent Enter key from firing button click even in vb6

I have a form with a progress bar and a cancel button which is displayed as a process runs. The buttons "Cancel" property is set to true so pressing escape, cancels the process. But, as the button is the only control on the form capable of taking the focus, should the user inadvertently press enter (or space bar) while the process is ru...

Prevent Legacy Function Calls In VB.NET

Within Visual Studio 2008, what would be the easiest way to prevent usage of certain functions from being allowed? Specifically, I'm trying to prevent other developers from using "old school" VB6-style commands such as: Len LCase UCase Instr InstrRev Trim Right Left Mid etc., etc., etc.... The list goes on and on. I can usually ca...

Using ini-files with VB 6.0

I must be getting daft, but I can't seem to find how to read old-fashioned ini files with VB 6.0. All I can seem to find is about reading from and writing to the registry. Can someone push me in the right direction? Mind you, I am not a programmer, just a hobbyist trying to have some harmless fun with his computer, so please don't be to ...

Learning VB6

I'm moving from Java Development to a MSFT environment. The app is currently written in VB6 and while its going to go to VB.NET/C# in the future, I need to find a way to pick up VB6 now. I'm told its old, and there will be no books on it available these days. Any tips? Sites? ...

Architecture for easy update of application

I have a system in place which applies calculations to a set of numbers (the specifics aren't really relevant). There are a number of sets of calculations which can be applied by the system users and new sets are added frequently. Currently when a new set of calculations need to be added to the system they are added in to the code base a...

Is there a way to prevent the VB6 compiler from shuffling the contents of files?

For reasons unknown, the VB6 compiler often likes to reorder the contents of .vbp files and the control descriptor block at the top of .frm files (The code that describes the properties of controls on the form. Code that you don't see in the IDE but you do see in a text editor and when doing diffs against the previous revision in versio...

Helper functions for safe conversion from strings

Back in VB6, I wrote a few functions that would let me code without having to care about the difference between null and '' for strings, null and 0 for numbers, etc. Nothing kills my productivity more when coding than having to add special case code for dealing with data that might cause some irrelevant error; 9999/10000 if something I'...

Comparing VB6.exes

Hi, We're going through a massive migration project at the minute and trying to validate the code that is deployed to the live estate matches the code we have in source control. Obviously the .net code is easy to compare because we can disassemble. I don't believe this is possible in vb6 exes because of the manner of compilation. Does...

How do I integrate VSS 6 so that VB 6 automatically checks out when editing?

I'm using Visual Studio 6.0 and Visual Basic 6.0. I have them integrated but when I check out a Project and then try to edit a module in that project it's locked and I have to manually right-click on it and do a Check Out to unlock it. I thought there was a way to have VSS automatically check out the file for editing. Any suggestions?...

Using app.config with Interop Controls

I have a .net project (MySolution.Common) that uses the app.config. I am using the project MySolution.Common in an InteropUserControl project called MySolution.InteropCtrl. MySolution.InteropCtrl is embedded into a VB6 project. When the MySolution.InteropCtrl is in the VB6 project, It cannot find the app.config file. Everything in the In...

How can I modify a CSS file programatically?

I have a legacy application that I needed to implement a configuration page for to change text colors, fonts, etc. This applications output is also replicated with a PHP web application, where the fonts, colors, etc. are configured in a style sheet. I've not worked with CSS previously. Is there a programatic way to modify the CSS and ...