473,396 Members | 2,121 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Include

Hi all,

is there anyone who knows of a way in VB6 to have include-files (like in C:
include <include.h>) ?

thanks!
Henk
Jul 17 '05 #1
6 13616
On Tue, 14 Oct 2003 22:25:05 +0200, "Henk ten Bos" <he******@xs4all.nl>
wrote:
Hi all,

is there anyone who knows of a way in VB6 to have include-files (like in C:
include <include.h>) ?

thanks!
Henk


Totally unnecessary. If you add a file to a project the normal way (or
manually add it to the project file), it's automatically included
everywhere. (If you really want, you can always write modules and give
them an extension of .bi - that's the old QuickBasic extension for
"Basic Include" - but you'll still have to add them in normally.)
--
auric "underscore" "underscore" "at" hotmail "dot" com
*****
I'd love to, but I left my body in my other clothes.
Jul 17 '05 #2
Well.... I do have a valid reason to want some sort of an include file.
I'd like to have a number of language dependent constants in my project and
(to avoid having to declare them globally) would like to include them using
a language-file.

Example for the same function using English and Dutch:

Public Sub Message()
Private Const cText as String = "This is a message"
........
Call MsgBox(cText)
End Sub

And

Public Sub Message()
Private Const cText as String = "Dit is een melding"
........
Call MsgBox(cText)
End Sub

I would like to implement this using:

Public Sub Message()
<<include language.h>>
........
Call MsgBox(cText)
End Sub

So I can compile two versions of the software, just by replacing language.h
with the appropriate file.

I know I can just include one or more files in my project, but then I would
have to make all the constants global, right. That's not what i want!

thanks,
Henk
"Auric__" <no*********@email.address> wrote in message
news:jl********************************@4ax.com...
On Tue, 14 Oct 2003 22:25:05 +0200, "Henk ten Bos" <he******@xs4all.nl>
wrote:
Hi all,

is there anyone who knows of a way in VB6 to have include-files (like in C:include <include.h>) ?

thanks!
Henk


Totally unnecessary. If you add a file to a project the normal way (or
manually add it to the project file), it's automatically included
everywhere. (If you really want, you can always write modules and give
them an extension of .bi - that's the old QuickBasic extension for
"Basic Include" - but you'll still have to add them in normally.)
--
auric "underscore" "underscore" "at" hotmail "dot" com
*****
I'd love to, but I left my body in my other clothes.

Jul 17 '05 #3
You should look into resource strings. You use the function
LoadResString(StringID) to return strings from a resource file. Resource files
can be "internationalized", that is, they can have different language versions
for each string. The appropriate one is selected based on the "locale", that is,
the language setting of the computer the program is running on.

Use the Add In Manager to load the VB 6 Resource Editor, then click on Tools,
Resource Editor. You can then build string tables for as many languages as you
like. You can use the strings for messages, and also for menus and captions if
you want.

"Henk ten Bos" <he******@xs4all.nl> wrote in message
news:3f***********************@news.xs4all.nl...
Well.... I do have a valid reason to want some sort of an include file.
I'd like to have a number of language dependent constants in my project and
(to avoid having to declare them globally) would like to include them using
a language-file.

Example for the same function using English and Dutch:

Public Sub Message()
Private Const cText as String = "This is a message"
.......
Call MsgBox(cText)
End Sub

And

Public Sub Message()
Private Const cText as String = "Dit is een melding"
.......
Call MsgBox(cText)
End Sub

I would like to implement this using:

Public Sub Message()
<<include language.h>>
.......
Call MsgBox(cText)
End Sub

So I can compile two versions of the software, just by replacing language.h
with the appropriate file.

I know I can just include one or more files in my project, but then I would
have to make all the constants global, right. That's not what i want!

thanks,
Henk

Jul 17 '05 #4
ok, thanks. I looked at this solution, but "hoped" that there was a more
simple one (like include-files). To add and maintain the strings with
resource files is a bit tedious.

thanks !
Henk

"Steve Gerrard" <no*************@comcast.net> wrote in message
news:Sq********************@comcast.com...
You should look into resource strings. You use the function
LoadResString(StringID) to return strings from a resource file. Resource files can be "internationalized", that is, they can have different language versions for each string. The appropriate one is selected based on the "locale", that is, the language setting of the computer the program is running on.

Use the Add In Manager to load the VB 6 Resource Editor, then click on Tools, Resource Editor. You can then build string tables for as many languages as you like. You can use the strings for messages, and also for menus and captions if you want.

"Henk ten Bos" <he******@xs4all.nl> wrote in message
news:3f***********************@news.xs4all.nl...
Well.... I do have a valid reason to want some sort of an include file.
I'd like to have a number of language dependent constants in my project and (to avoid having to declare them globally) would like to include them using a language-file.

Example for the same function using English and Dutch:

Public Sub Message()
Private Const cText as String = "This is a message"
.......
Call MsgBox(cText)
End Sub

And

Public Sub Message()
Private Const cText as String = "Dit is een melding"
.......
Call MsgBox(cText)
End Sub

I would like to implement this using:

Public Sub Message()
<<include language.h>>
.......
Call MsgBox(cText)
End Sub

So I can compile two versions of the software, just by replacing language.h with the appropriate file.

I know I can just include one or more files in my project, but then I would have to make all the constants global, right. That's not what i want!

thanks,
Henk


Jul 17 '05 #5
On Thu, 16 Oct 2003 09:35:21 +0200, "Henk ten Bos"
<he******@xs4all.nl> wrote:
ok, thanks. I looked at this solution, but "hoped" that there was a more
simple one (like include-files). To add and maintain the strings with
resource files is a bit tedious.

There are several ways of skinning this cat

One that has worked well for me is to have a sort of INI file for each
language that contains a 'Lexicon'

Command1.Caption = Lex( "Click Here" )

Lex() is a function that looks for :-

Click Here=Druck Hier

If it does *not* find the English then it adds the English to the Lex
file and returns ... the English

If it is there then it returns the 'other language'

I also provided an editor, so users could do their own translation

If you do not fancy having files hanging around, then I guess you
could append the data to the EXE - or use Resource Strings for release
- in which case you just have one string to read

Another alternative is to write a small App to tinker with the
contents of your .VBP file

Yet another is to have ALL the files in your App but to use
Conditional Compilation eg:

#Const Flag = False

Private Sub Command1_Click()
#If Flag Then
Me.Print "Hullo"
#Else
Me.Print "No Way"
#End If
End Sub

Personally I am not that keen on Conditional Compilation.

Yet another way is to have (say) two Classes that contain the data

Dim L as cLex
Select Case Language
Case enEnglish : Set L = New clexEnglish
Case enGerman : Set L = New clexGerman
....
End Select

Command1.Caption = L.Click_Me

For this you will need to look at the 'Implements' key word

Personally I would go for the Lexicon in a file approach, as I prefer
to be able to read my own code
- and the 'file' can be stored in the EXE for release versions
Jul 17 '05 #6
On Thu, 16 Oct 2003 09:35:21 +0200, "Henk ten Bos" <he******@xs4all.nl>
wrote:
ok, thanks. I looked at this solution, but "hoped" that there was a more
simple one (like include-files). To add and maintain the strings with
resource files is a bit tedious.

thanks !
Henk


How about something like this?
Sub loadStrings()
#Const english = True
#Const dutch = False
#If english Then
Open "english" For Input As 1
#Else
Open "dutch" For Input As 1
#End If
' code to read in your strings here
Close 1
End Sub

This way you can have separate files with your language strings
contained within, and just write code to input the strings from whatever
file gets opened.
--
auric "underscore" "underscore" "at" hotmail "dot" com
*****
Capital Punishment: the income tax.
Jul 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

43
by: steve | last post by:
I am quite frustrated with php’s include, as I have spent a ton of time on it already... anyone can tell me why it was designed like this (or something I don’t get)? The path in include is...
0
by: Tom Lee | last post by:
Hi, I'm new to .NET 2003 compiler. When I tried to compile my program using DEBUG mode, I got the following errors in the C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xdebug...
60
by: Derrick Coetzee | last post by:
It seems like, in every C source file I've ever seen, there has been a very definite include order, as follows: - include system headers - include application headers - include the header...
9
by: zolli | last post by:
Hi, I've been banging my head against this for a while now. Hoping someone here can shed some light on what's going on. On including stdlib.h in a file, I'm seeing the following errors: ...
5
by: David Mathog | last post by:
One thing that can make porting C code from one platform to another miserable is #include. In particular, the need to either place the path to an included file within the #include statement or to...
1
by: Minh | last post by:
I've just installed VS.NET 2003 on my Athlon XP 1800+. However I couldn't get any project with STL includes to compile even if I create a new empty project (and added #include <string>). It gave me...
1
by: ya man | last post by:
when i use #include <iostream.h> in some files i get lots of error messages of the kind 'ambiguous symbol this is solved when i use #include <iostream why is that ? and can i use #include...
3
by: Arpi Jakab | last post by:
I have a main project that depends on projects A and B. The main project's additional include directories list is: ...\ProjectA\Dist\Include ...\ProjectB\Dist\Include Each of the include...
14
by: Jon Rea | last post by:
I am currently cleaning up an application which was origainlly hashed together with speed of coding in mind and therefore contains quite a few "hacky" shortcuts. As part of this "revamping"...
7
by: Giancarlo Bassi | last post by:
Please, what are here the 11 include files (found over the internet)? */mozzarella.c /* #include #include #include #include #include #include
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.