473,799 Members | 3,229 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 13671
On Tue, 14 Oct 2003 22:25:05 +0200, "Henk ten Bos" <he******@xs4al l.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*********@em ail.address> wrote in message
news:jl******** *************** *********@4ax.c om...
On Tue, 14 Oct 2003 22:25:05 +0200, "Henk ten Bos" <he******@xs4al l.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(S tringID) to return strings from a resource file. Resource files
can be "internationali zed", 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******@xs4al l.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******** ************@co mcast.com...
You should look into resource strings. You use the function
LoadResString(S tringID) to return strings from a resource file. Resource files can be "internationali zed", 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******@xs4al l.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******@xs4al l.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.Captio n = 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.Captio n = 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******@xs4al l.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
5131
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 relative NOT to the immediate script that is including it, but is relative to the top-level calling script. In practice, this means that you have to constantly worry and adjust paths in includes, based on the startup scripts that call these...
0
6144
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 file as folows. I need help to resolve them ASAP: cl /c /nologo /MDd /W3 /Od /GR /GM /Zi /GX /D "_DEBUG" /D " WIN32" /D "_W INDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_MBCS" /D "_USRDLL" /
60
8324
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 associated with this source file For example, in a file hello.c: #include <stdio.h>
9
6418
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: ----BEGIN ERRORS---- gcc -g3 -DUSE_LIBC -Wall -c -I../mm -I../include -I/usr/include -I/usr/include/linux -o mm_tree_test.o mm_tree_test.c
5
2512
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 very carefully define the order in which paths are searched with command line options on the compiler. Both can cause problems, especially when dealing with complex software distributions. It occurs ot me that by extending the C include...
1
7505
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 a bunch of "missing ;" errors. I did reinstall the whole thing a few times but it didn't work. Anyone have any idea? Thanks c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\xutility(862) :
1
4573
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 <iostream.h> in some way examples to the error messages c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\streamb.h(90): error C2872: 'ios' : ambiguous symbo c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\streamb.h(90): error C2872:...
3
2712
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 directories contain a file named "cppfile1.h". In my main project I #include "cppfile1.h". I rely on the order of paths in additional include directories list to get file cppfile1.h from ProjectA and
14
6707
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" process I am introducing namespaces to properly compartmentalise sections of the code into logical units. What I am speciffically trying to get right is the dependency tree for header files to reduce compile time and simplify the code structure. On...
7
2927
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
9687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10482
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10225
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10027
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9072
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7564
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4139
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.