Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Menu Structure


Hi,I'm writing a program in VB6. I want to show the application's menu structure in a TreeView window. Pls show me how to do. Thanks very much.Tuan Nguyen




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Make A Menu Structure From Collection - Any Ideas?
I want to create a popup menu on the fly, that will containe items from a collection... any idea?

Read Menu Structure From VB Executable Program
I have create a add-in (Menu Creator) to make advanced menu (with subclassing).
Now I add a 'capture' feature to capture a menu from other programs, thus I can to clone the entire menu.

The code work fine if the menu is captured from a EXE file (i.e. Notepad.exe),
but not if the menu is captured from EXE compiled with VB 6.0 (and from VB.EXE, too).

The call GetMenu(hWnd) return always '0'

Anyone can help me to find where and how?

Thank in advanced

gibra

Enumerate Favorites Folder And Create A Menu Structure
Hi.

I am creating a browser program that I wish to use myself. There are a number of custom features that I particularly need when I am researching something.

I would very much like to include a menu of the same type as the Favorites menu in IE, which would be generated at run time.

I have found several snippets of code that allow me to add my favorites to a treeview, which I have done, however, adding them to a menu seems impossible since I am unable to create the submenus at runtime.

I have a great many categorized items in my favorites folder, sometimes several folders deep.

Is there a way to enumerate these and add them to a menu?
If not is there some kind of workaround or control that can be used to do this?
Is there a way to bolt the IE favorites menu into my app?

Any help would be greatly received.

Thanks

Kazim


How To Initialize A Structure In VB And How To Create An Instance Of The Structure Th
Hi.

I have 2 programs which are: a DLL in C and a VB application that uses DLL functions.

Flow: The VB application calls the functions in the C DLL and also VB aplication passes some arguments to the functions of the C DLL.

My Query:

I have a structure whose pointer has to be passed as an argument to the DLL function.How can we initialize a structure in VB.

Is there any way to pass the instance of the structure(for example in C we pass the pointer to the function to access all the members of the structure)

Eagerly waiting for the reply.

Thanks in Advance

Adding Menu Controls To Menu Without Using Menu Editor
I am trying to make a Visual Basic program that connects to an Access database and searches for its menu options! If there are any menu options that are added to the access database, then the program will automatically display them on the form after it searches for all the records within the database. Is there a thread that already exists that explains how to do this with VB Code? Is the following thread - something I can use in this regard:

http://www.xtremevbtalk.com/show...u+items+editor
on thinker's reply about using a resource file?

I wasn't sure...

Thanks,

Stephen

How Do You Create A Menu Under A Menu Under A Menu And So On.. ? Confused?
Ok right now im using a custom control to display my favorites in the menu at the top. I made the code but the control has a different way of featuring a fake menu at the top of the program that makes it easier to create sub items off of menu items. I want to know how would I go about creating multiple menu's under menus..

Like in the favorites of Internet Exploerer you have Favorites --> VisualBasic --> VB Sites --> VB World

Something like that... So you would click on Favorites and then on Visual Basic and then on VbSites and under vb sites is the link to VB world..I know you can create a menu array but that only does one level. I dont know how to do multiple levels. I do think there is a way to add menu items with api..Any help?

BOM Structure
I need help on where to find code to write a BOM structure for searching subfolders to match subassemblies to the main part. Any help would be appreciated.

Structure
how to declare a structure/class in vb?

Wpl Structure?
this is a sample wpl file

Code:
<?wpl version="1.0"?>
<smil>
<head>
<meta name="Generator" content="Microsoft Windows Media Player -- 9.0.0.3349"/>
<author/>
<title>Sample</title>
</head>
<body>
<seq>
<media src="F:MuziekAArctic Monkeys - A Certain Romance.mp3" tid="{A8E9964A-12E2-4812-A0EE-DBFC53345C55}"/>
<media src="F:MuziekAArctic Monkeys - Dancing Shoes.mp3" tid="{F5382CF2-DEC2-4753-B63B-804EE48E5BAD}"/>
<media src="F:MuziekAArctic Monkeys - Fake Tales Of San Fransisco.mp3" tid="{0A6FA79A-7D7F-4D0C-AD4D-1FC391FD12D5}"/>
<media src="F:MuziekAArctic Monkeys - From The Ritz To The Rubble.mp3" tid="{2F448BE4-3B8D-4A37-8C3B-9C6654FB9778}"/>
<media src="F:MuziekAArctic Monkeys - I Bet You Look Good On The Dancefloor.mp3" tid="{E6337358-9EA1-4449-ABFD-AB67B17C5622}"/>
<media src="F:MuziekAArctic Monkeys - Mardy Bum.mp3" tid="{49D858D9-64F0-4177-A6E1-D5D654CB40E5}"/>
<media src="F:MuziekAArctic Monkeys - Perhaps Vampires Is a Bit Strong But....mp3" tid="{2EE4020F-037F-43AA-826B-2992806ACD83}"/>
<media src="F:MuziekAArctic Monkeys - Red Light Indicates Doors Are Secured.mp3" tid="{8F3AFBC2-679C-4D88-954B-DE37C3004324}"/>
<media src="F:MuziekAArctic Monkeys - Riot Van.mp3" tid="{3FC27498-2ABE-4C8C-90BC-6DC2564F5A65}"/>
<media src="F:MuziekAArctic Monkeys - Still Take You Home.mp3" tid="{30287325-3401-4A27-B8C0-7993F027E0F1}"/>
<media src="F:MuziekAArctic Monkeys - The View From The Afternoon.mp3" tid="{E29FA33E-9884-4145-AC29-DECD8A65A818}"/>
<media src="F:MuziekAArctic Monkeys - When The Sun Goes Down.mp3" tid="{7D942F6F-1F54-4077-9278-4181AB082B99}"/>
<media src="F:MuziekAArctic Monkeys - You Probably Couldn&apos;t See For The Lights But You Were Staring Straight At Me.mp3" tid="{5754590A-9BAF-4055-861B-29862735ACF4}"/>
</seq>
</body>
</smil>

I understand most of this, but what's the 'tid'?

(btw: what is a better forum section for this question?)

COM Structure Need
Hi,
We are developing a massenger and want to develop through COM and want the Class structure for COM implementation.
If some one can help me We wanna be very thankful to him.

Structure :C++ &lt;--&gt; VB?
Hi,

My Vb app needs to call Standard DLL(using C++). I get confused with structure data type conversion. Here are two questions:

Q(1): Structure in C++:

struct User
{
WORD Id;
BYTE Spare[2];
WCHAR Name[64];
}

How to convert to VB type?why need Spare here?

(2) structure in Vb:

Type Product
Id as byte
Name as String
End type

How to define this structure in C++?

Wainting for your instructions. thanks.

Structure (in C Dll) To Udt (in Vb)
hi there,
I'am having troubles with accessing a VC++ dll from VB. The dll should
return an array of udt's but it seems to return an array of bytes. I have
tried already with changing the api declaration from byte to Any , but that
didn't work. Is there a way to translate the bytearray to a vbUDT? If not,
are there any other ways to fix this problem??? Thanks in advance.

I'm quite desperate on solving this:

This is my udt:

Public Type Fieldinit
name As String * 16
row As Long
col As Long
style As Long
flags As Long
size As Long
len As Long
data As String * 16
ptype As Long
psize As Long
plen As Long
pattern As String * 16
End Type

this is the declaration of the function that I have to call

Public Declare Function TwTsxLoadPageFieldsFromFile Lib "TSDKVC.DLL" (ByVal
filename As String, ByVal PageName As String, ByRef pagefields As Byte,
ByVal asize As Long) As Long


This is how I call it:

-------
Public Sub FieldTest()
Dim fields() As Byte
ReDim fields(0 To (Me.NumberOfFields * 200))

rvErr.rv = TwTsxLoadPageFieldsFromFile(App.Path & "" &
gSettings.ScreenFile, Me.PageName, fields(0), UBound(fields))

End Sub

I want to get this in an Array of UDT's somehow like this:

Public Sub FieldTest()
Dim fields() As FIELDINIT
ReDim fields(0 To Me.NumberOfFields)

rvErr.rv = TwTsxLoadPageFieldsFromFile(App.Path & "" &
gSettings.ScreenFile, Me.PageName, fields(0), UBound(fields))

End Sub

-------

When I look in the sourcecode of the DLL i find this:

------
/* page/screen initial data */

struct tsxfieldinit {
char8 *name; /* field name */
int32 row; /* row number */
int32 col; /* column number */
int32 style; /* field style */
int32 flags; /* field flags */
int32 size; /* field size */
int32 len; /* length of current field data */
char8 *data; /* pointer to field data */
int32 ptype; /* pattern type (0=no pattern,1=visible,2=hidden) */
int32 psize; /* pattern size */
int32 plen; /* length of the current pattern */
char8 *pattern; /* pointer to pattern */
};
typedef struct tsxfieldinit TSXFIELDINIT;


-------
and this is the function I try to call:


/*--------------------------------------------------------------------------
--*/

/*
* TwTsxLoadPageFieldsFromFile Wrapper for TsxLoadPageFieldsFromFile().
*
* filename = input file name (TSE format)
* pagename = name of an allocated page
* pagefields = array of bytes to receive the TSXFIELDINIT structure
* asize = size of array pointed by pagefields
*
* return = TSX_SUCCESS or error code
*/

fint32 TwTsxLoadPageFieldsFromFile( char8 *filename, char8 *pagename,
TSXFIELDINIT *pagefields, int32 asize )
{
TSXFIELDINIT *ptr;
int32 rv,alen;

/* load page fields in work space */
rv = TsxLoadPageFieldsFromFile( filename, pagename, &ptr );
if( rv != TSX_SUCCESS )
return rv;

/* overflow check */
alen = (TsxNrFields(ptr)+1)*sizeof(TSXFIELDINIT);
if( alen > asize ) {
TusFree( ptr );
return (TSX_ERR_ASIZE);
}

/* move structure to byte array */
memcpy( pagefields, ptr, (size_t)alen );

/* free work space */
TusFree( ptr );

/* successfull return */
return (TSX_SUCCESS);
}


Any help is very appreciated.

Thanks in advance

Structure
I have several apps here at work in use.
My current directory structure is a folder with the name of the project and then all the files go in there.

when I start working on adding features that are requested I just work on the existing code.

is this how most people do it?

For my largest project I made a copy of the folder and changed its name to MyApp V2
I then added the postfix of V2 to all files in the directory.

When I opened the "new" project I got some errors.
These were simple fixes to point to the new named files.

What I did works.
I am the only VB programmer here so I have complete control over the file structure.

If you could develop a file structure how would you do it?
Or, how does the industry do it?
thank you for your time and have a good day

Structure In VB
I am trying to define my own data type in VB. As we can define it in the form of structure in C, what is the way in VB to make user define data type ? is it Collection ? or anyething else ?

Dir Structure
How would i go about getting all the subdirectories within a specified directory e.g.

parent - c:
sub c:windows
sub c:program files
.....etc.

i just want a directory listing

thanks in advance
jeff

Structure And API
Hello.

I use these API functions in my application. Both need to pass the structure NETRESOUCE. I've got an examles for these functions from the web.
But the NETRESOUCE struct. is defined differently for each function. The pointers to strings are defined as string or as long.



Code:
Private Declare Function WNetAddConnection2 Lib "mpr.dll" _
   Alias "WNetAddConnection2A" _
  (lpNetResource As NETRESOURCE_1, _
   ByVal lpPassword As String, _
   ByVal lpUserName As String, _
   ByVal dwFlags As Long) As Long

Public Declare Function WNetEnumResource Lib "mpr.dll" _
   Alias "WNetEnumResourceA" _
  (ByVal hEnum As Long, _
   lpcCount As Long, _
   lpBuffer As Any, _
   lpBufferSize As Long) As Long


Public Type NETRESOURCE_1
  dwScope As Long
  dwType As Long
  dwDisplayType As Long
  dwUsage As Long
  lpLocalName As String
  lpRemoteName As String
  lpComment As String
  lpProvider As String
End Type

Public Type NETRESOURCE_2
  dwScope As Long
  dwType As Long
  dwDisplayType As Long
  dwUsage As Long
  lpLocalName As Long
  lpRemoteName As Long
  lpComment As Long
  lpProvider As Long
End Type


'Calling functions:
  Dim NETR As NETRESOURCE_1
  Dim errInfo As Long
  Dim testDrv As String
  Dim sUser As String
  Dim sPasswd As String
  ...
  ...
    With NETR
      .dwScope = RESOURCE_GLOBALNET
      .dwType = RESOURCETYPE_DISK
      .dwDisplayType = RESOURCEDISPLAYTYPE_SHARE
      .dwUsage = RESOURCEUSAGE_CONNECTABLE
      .lpRemoteName = ServerPath
      .lpLocalName = testDrv
    End With
    errInfo = WNetAddConnection2(NETR, sPasswd, sUser, 0)
  
'---------------------------------------------------------------------
  Dim hEnum As Long
  Dim bufptr As Long
  Dim dwBuffSize As Long
  Dim nStructSize As Long
  Dim dwEntries As Long
  Dim success As Long
  Dim netres() As NETRESOURCE_2
  ...
  ...
  ...
  dwEntries = 1024
  ReDim netres(0 To dwEntries - 1) As NETRESOURCE_2
    
  nStructSize = LenB(netres(0))
  dwBuffSize = 1024& * nStructSize
    
  success = WNetEnumResource(hEnum, _
                               dwEntries, _
                               netres(0), _
                               dwBuffSize)



Is it possible to have just one NETRESOUCE structure? To have one for both API functions? I've tried it but if I use the 2nd (string as long) I'll get an error in the assignment string to long. And if I use the 1st WNetEnumResource returns 487 (ERROR_INVALID_ADDRESS - Attempt to access invalid address.)
In the WNetEnumResource API call the netres(0) is an output parameter and in the WNetAddConnection2 NETR is an Input parameter.

Thanks for any help.

What Is Structure
Hi

what is structure in VB means what is type that we use in with API function and why and where it is to be used in program

Help me
Thanx a lot

Structure
I have a app that allows the user to add classifications, status and sources using text boxes for each and inserting the data entered into individual listboxes.
I need to store the information in a text file. And allow the user to click an object in the listbox and have the information that was previousy entered appear. What I have tried to do is design a structure for each frame (each are on different frames, classification, status,etc....) I know I will need to have an array to read the information from but I am lost as to how to do it. Could someone please help!!!

This is how i did the structures for each frame:

Type ClassStructure
strclassification As String * 20
End Type

Type SourceStructure
strSource As String * 20
End Type

Type ProspstatusStructure
strProspect As String * 20
End Type

Type saleprodStructure
strprodname As String * 20
strgather As String * 10
strflatempsale As String * 20
strflatreferrer As String * 20
strflatunit As String * 20
strflatgroup As String * 20
str1000sale As String * 20
str1000unit As String * 20
str1000group As String * 20
str1000referrer As String * 20
strrefnoncontact As String * 20
strrefcontact As String * 20
End Type

Structure
Hi,

Can I make a structure in VB?

Array Structure
Hi

I know there's a simple answer to this but it's driving me mad. I've only been doing VB a few months and I have a project to complete writing a student testing program. I have to use a sequential file to store all the test data.

I want to open the specified file and read the data into an array - aryTest(). The file will consist of a question, 5 answer options and a reason as to why each answer is either correct or incorrect.

Can somebody tell me the structure my array should have to make it easy to read the data back? I was trying aryTest(idx,9) where idx is the question number and the 9 is all the answers and reasons stored together. Not sure this woprks properly though.

Hope this is all clear!

Cheers

What's Wrong With My Structure ?
I want to fill a combobox with data from a recordset. Here is my code :
Private Type InfoJeu
idJeu As Integer
RefInterne As String * 15
nomJeu As String * 25
nomAire As String * 40
End Type
Private TabJeu() As InfoJeu
Private FormatinfoJeu As String * 80
.......................
TabJeu(I).idJeu = Rst!idJeux
TabJeu(I).nomJeu = Rst!nomJeux
TabJeu(I).RefInterne = Rst!RefInterne
TabJeu(I).nomAire = Rst!nomAire
FormatinfoJeu = TabJeu(I).RefInterne + TabJeu(I).nomJeu + TabJeu(I).nomAire

Combo1.AddItem (FormatinfoJeu)
This works but the result is varying depends on recordset. I mean i get this :
"VP001 John Smith"
"VP63287 Elisabeth Williams"
And i would like this :
"VP001 John Smith "
"VP63287 Elisabeth Williams"
How can i get a fixed structure (string15 + string25 + string40) whatever datas in it ?

File Structure
I'm trying to decipher the structure of a simple data file. The file is an audit file written by a network encryption device. The software provided for viewing the file info is less than convenient to use and I would like to write a friendlier application in VB.

Code:
00 00 00 00 A7 00 0E 21 48-75 7C 43 49 4B 20 45 78 ......!Hu|CIK Ex
10 74 72 61 63 74 65 64 00-00 00 00 00 00 00 00 00 tracted.........
Above is a smple record. What I have figured out so far:

1. The first 4 bytes are a long integer giving the record number.
2. Beginning at offset 11 is a text string of variable length which can extend to the end of the 32 byte record.

Fact 2 is based on looking at other records and seeing the field completely filled with readable ASCII text.

Also, apparently, there is embedded in this record is a time and date and the name of the device based on the info displayed by the software which displays the audit file info [example below for the data record above].

FCTCP3 2004/10/08 14:43:56 CIK has been removed Rec: 00167 Msg: CIK Extracted

What I am trying to determine is if there is a format of date and time that fits a 4-byte or 6-byte format. From looking at API functions relating to dates and times, it seems those are all 8-byte formats [two 4-byte segments].

If anyone is familiar with a format that might be the one I'm dealing with here, I'd appreciate some insight.

Structure Unclear
db structure unclear

Hello, now my database structure is very very unclear, any good idea can easy join and change it.

only line-by-line edit and save , can auto batch match and changed ?

my database is use "|" CSV format
NAME|COUNTRY|PHONE|||||




Code:
'OLD DB this is very unclear
|Anthony|USA||803-2242423||||
|SAM|CHINA|204-2022424|||||
|||PETER||JAPAN||523-2234523|
|||||DAVID||UK|2004221
|MARY|||||JAPAN|2234235|
||JOHN||UK|20332|||


'I hope this...
|Anthony|USA|803-2242423|||||
|SAM|CHINA|204-2022424|||||
|PETER|JAPAN|523-2234523|||||
|DAVID|UK|2004221|||||
|MARY|JAPAN|2234235|||||
|JOHN|UK|20332|||||


many thanks!

Looping Through Dir Structure
i need a good recursive algrarithm for looping though a directory tree.

Data Structure Help
I've made a huge data structure that holds all the info of player characters. The problem I have is that I can't seem to get the info into a second form (I have the main form, and a character stats form).

So I have:

dim char() as character

and char(0) has all it's info set.

This is inside form1... I need to get all the info into form2. I figured out that I need to use a class module, so I got all my code updated, so now I have:

dim char() as class1

then in form1 I have:

redim char(0)
set char(0) = new class1
char(0).name = txtName.text
(so on and so fourth)

I set all the info for char(0), and made a sub in form2 that SHOULD recieve the data:

public sub send(temp as class1)

so when the user clicks the "Character Stats" button...:

load form2
form2.send(char(0))
form2.show vbmodal
unload form2

It just says "Object doesn't support this property or method". I'm new with class modules, so I'm completely in the dark here... Any ideas what I'm doing wrong?

P.S. all the variables inside class1 are public, and work just fine, I just can't seem to send the whole class1 into the sub.

Lighting Structure
Now, I am running a fullscreen game, and I need to create a 2D Lighting using DirectX7 not 8, I've been trying overlaying a circular mask and makes it like a Line-Of-View, but I rather want it so I can see one circular area lit-up and then the rest is darker, but you can still see whats going on.

Hard to explain, but all help is wanted.

Structure Of My Application
Hello,

I am writing a game and so far I have structure as follows:

Sub Main () - Where the game is run and the global variables are declared eg Direct3DDevice, People, Guns

3DEngine Class - Handles all setup, initialisation, render initialisation and cleanup, FPS

3DObject Class ... Handles all 3d Objects
Person Class
Gun Class
Physics Engine Class

.. And about 5 or 6 other classes that I wont bore you with.

Anyway, I was happy with the structure until I wanted to allow multiple games to be played at once. The problem is, I can't create another instance of Sub Main for each game the user is playing, and if I create a 'game' class I can't make any of the variables global which need to be for the other classes to work. I could go to ridiculous lengths to pass all relevant variables from class to subclass etc, but given the lack of inheritance in VB this is a huge task..

Does anyone have an idea how I could structure this better? I am open to any suggestions.

Thanks in advance

[vb6] What Is The Structure English Of VB 6?
Code:
Private Sub cmdCalc_Click()
On Error GoTo help
Dim Prices As Double

Prices = (CCur(txtConsPrice) * (1 + (fColor + fWood))) + (CCur(txtFloorPrice) * (100 * fFloor)) + CCur(txtHardPrice) + CCur(txtGlassPrice)
txtCost.Text = Format(Prices, "Currency")
Exit Sub
help:
MsgBox "Please Make Sure All Of Prices Are Filled!"
End Sub

Can someone show me the Structure English of these code?

thanks

Copy PST Structure
Hi,
In our company we create a new PST (Personal Folders) for each user every year(to avoid the 2 GB size problems).
Is there a way(using VBA or any other method) to copy only the folder structure of a PST to another PST without the emails????

The users dont want to change the PST , coz that means that they have to recreate the whole folder structure in the new PST.

Thanks

Problem In If Then Structure
i need to convert a text file
it has to put some lines in it i give you an example


Code:
this is what i get

X0 Y0
X0 Y10
X0 Y10
X10 Y10
X10 Y10
X10 Y0
X10 Y0
X0 Y0
X5 Y5
X15 Y15

Code:
this is what i have now

Z1
X0 Y0
Z0
X0 Y10
Z1
X0 Y10
Z0
X10 Y10
Z1
X10 Y10
Z0
X10 Y0
Z1
X10 Y0
Z0
X0 Y0
Z1
X5 Y5
Z0
X15 Y15
Z1

Code:
this is what is has to be
Z1
X0 Y0
Z0
X0 Y10
X10 Y10
X10 Y0
X0 Y0
Z1
X5 Y5
Z0
X15 Y15
Z1

Which Data Structure To Use
Maybe it's too early in the morning and my brain is not working, but someone please suggest a data structure to use for this scenario...

Before runtime I know a computer's model number, and all the submodels that are associated with it. There are several possible model numbers, each with unique submodels. At runtime my program determines the computer's submodel number and I want to figure out which model it is.

I've tossed around the idea of a linked list. Each node on the list would contain the model and submodel information. The problem I see with this is the duplication of information, but using separate linked lists for each model compliates the process. Especially if you don't know how many lists you could have.

Data Structure
Hi,
I am trying to create an array of arrays. In order to understand the exact data structure which I am trying to create, I have attached it in the file below. Can anyone give me an idea of how to create such a datastructure.

Folder Structure
Hi Guys

I have a MS Access database called Test and one table called FilePlan,it looks like

cid file_no subject parentfile_id
3 1 STATUTORY AND REGULATORY NULL
4 1/1 Legislation3
5 1/1/1 Bills4
6 1/1/1/1 Bills DRAFTED by the dti 5
7 1/1/1/1/1 Co-operatives Bill 6
8 1/1/1/1/1/R Routine Enquiries 7
______________________________________________________________

cid is an automatic number created,parentfile_id is the reference to the cid,e.g For the subject "Legislation",its parentfile_id = 3 meaning that it is a child folder of 'STATUTORY AND REGULATORY',so on and so on.Now from this table,I want to create a TreeView / Folder Structure using these data from my database,May someone please HELP!! I need this structure to run in two hours Please,I like VB but I don't know everything cause I new to it.Write me a code that can do these,that I will really appriciate.

Thanx in advance

Regards

Ka Mavungu

Modular Structure
Does anyone know of any literature I could read up on or give me push in the right direction towards making a modular program?

ie - I want an EXE file that's basically like control panel, only with other DLL files for the content of the app. This is so that basically I can install modules on some machines and not on others. I know there are easier ways of doing so, but I would just like the knowledge

Could I do this with Add-Ins?

Best Class Structure?
I am writing an application that basically processes variosu file formats to extract data out of them. The way I have set it all up is to have an initial class with a .ProcessFile method, that kicks off the file processing. It identifies the format, then invokes several other classes that each extract data from various sections of the file, passing the file format to the other class. I basically did it this way so that I could wrap all the processing up (as far as the client is concerned) via the first class.

Initially I only had a couple of file formats, so each of the subsequent classes processed that data based on select case statements. Not great, but fit-for-purpose.

As I add more file formats, code maintenance becomes a bit more difficult.... That's when I hit on the idea of creating an interface class using 'implements' => I can simply call a .ProcessFile method through the interface class, and then have a different class that is invoked for each file format. Adding new file formats just requires different child classes, and the inteface doesn't need to change.

My question is: What is the best way of handling this interface?

Is the preferred method to identify the file format 'outside', then based on the file format set the interface class to be whatever the appropriate child class is? Or can the interface class somehow include code to do this and set the reference automatically?

Data Structure Help
I'm trying to develop logic that is similar to the follwing data structure:

In MS Exchange, it is possible to create email groups that contain individual groups of email addresses. It is possible to create new groups that contain a combination of additional groups and/or individual email address.

I want to be able to develop the same type of logic. The end result is that I'll be able to specify a group or individual and create a list of individual email addresses.

Any ideas on how I should design this?

Thanks!

BillSoo Structure
BillSoo,

Why you say I should have FIXED LENTH strings, not dynamic (Dim String) in the data structure?
Sorry i bug you so much...


Would this work?
Private Type struc
Dim IPFRom as string
Dim IPTo as STring
Dim Message as String

End Type.

Also you said use a header structure followed by the message??

Thanks alot man.
After this I will start actually implementing something. Most likely i'll stick to using the Mid and Instr functions.

Suggestions,

Thanks,

j dogg

Program Structure
I need a examble af a visual basic program structure.
If I start a project, It looks like the main code is in the form.
Then I like to have a modul with all my sub and global variables.

Is there anybody who have a example of a program with optimal program structure.

thanks

Big Problem With If Then Else Structure
Hi!!!!!

I'm going to cut my head off!! I don't know what to do!

I have the next code sequence

Private Sub Command1_Click()
Dim element(500)
For i = 1 To Form1.dxDBGrid2.Dataset.RecordCount

Form1.dxDBGrid2.Dataset.RecNo = i
TheDate = Form1.dxDBGrid2.Columns.ColumnByFieldName("data").Value
plata = Form1.dxDBGrid2.Columns.ColumnByFieldName("data_platii").Value
difdata = DateDiff("d", TheDate, plata)
If difdata > 10 And Form1.dxDBGrid2.Columns.ColumnByFieldName("val_achit").Value = 0 Then
element(i) = Form1.dxDBGrid2.Columns.ColumnByFieldName("clientid").Value

j = j + 1
End If
Next i
Form1.dxDBGrid1.Dataset.Edit
For x = 1 To Form1.dxDBGrid1.Dataset.RecordCount
Form1.dxDBGrid1.Dataset.RecNo = x
pro.Value = x

For y = 0 To j
Text1.Text = element(y)
Text2.Text = Form1.dxDBGrid1.Columns.ColumnByFieldName("clientid").Value
If element(y) = Form1.dxDBGrid1.Columns.ColumnByFieldName("clientid").Value Then

Form1.dxDBGrid1.Columns.ColumnByFieldName("activ").Value = 0

End If
Next y
Next x


End Sub

the problem is that every time that I run the prg the last sequence is not true also it should be. I verified with some text boxes

Pleaseee take a look!!!
Thank you

Am I realy stupid ?

Data Structure
If I have a data type such as this, how do I access the data member?

TYPE MYDATA
ID as integer
Name as String
Age as integer
END TYPE

temp as MYDATA


For example to read the ID, what should I do?
temp.ID ??
Suddenly realised I have been to familiar with C that I don know how to access using VB. Please help.

Passing UDT Structure To Dll
Hi,

Need help from the "old birds" again

I am trying to do the following :

1) Compile some window manipulation functions into an activeX.dll library.
2) Pass UDT data to the dll to get it to copy a line from the screen of a certain application using mouse.
3) I have a "ByRef argument type mismatch" error. My question is can I actually pass a UDT data to a dll file, and if yes, how could I get it right?
4) The actual program is much more complex, but I have simplified it as follows. (I may have over-simplified.... )

I am a new bird to VB, and any help from the old birds is most thankful

Thanks

DLL Codes called cScreenFunction

Option Explicit

(API....)

Type POINTAPI
X As Long
Y As Long
End Type

Type RECTSIZE
Dx As Long
Dy As Long
End Type

Public Type ScreenUDT
Left As POINTAPI
Right As POINTAPI
Size As RECTSIZE
Centre As POINTAPI
End Type



'****************************************
Public Function GetWindowScreen(ByVal WindowClass As String) As ScreenUDT
'****************************************

Dim lHandle As Long
Dim WindowClientRect As RECT

GetClientRect lHandle, WindowClientRect


With GetWindowScreen

.Left.X = 0
.Right.X = WindowClientRect.Right
.Size.Dx = .Right.X - .Left.X
.Centre.X = .Size.Dx / 2

.Left.Y = GetSystemMetrics(SM_CYCAPTION)
.Right.Y = .Left.Y + WindowClientRect.Bottom
.Size.Dy = WindowClientRect.Bottom
.Centre.Y = .Size.Dy / 2

End With


End Function


'****************************************
Public Function CopyLine(ByVal LineNumber As Long, ByRef WindowScreen As ScreenUDT) As String
'****************************************


Dim MousePosStart As POINTAPI
Dim MousePosStop As POINTAPI

MousePosStart.X = WindowScreen.Left.X / 2
MousePosStart.Y = WindowScreen.Left.Y

MousePosStop.X = WindowScreen.Right.X
MousePosStop.Y = MousePosStart.Y

SetCursorPos MousePosStart.X, MousePosStart.Y
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
SetCursorPos MousePosStop.X, MousePosStop.Y
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
TimeDelay (500)
CopyLine = Clipboard.GetText
TimeDelay (500)


End Function


Main Program
Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type


Sub Main()

Dim WorkingScreen As ScreenUDT
Dim Working As cScreenFunction
Dim WorkingScreenline As String

Set Working = New cScreenFunction

WorkingScreen = Working.GetWindowScreen("Wcpwinclass")
'This line is working OK
WorkingScreenLine = Working.CopyLine(5, WorkingScreen)
'This line generates a "byRef argument type mismatch error"
End Sub

Getting Database Structure
Hello folks!

How can I get the tablenames of an Access-database?
Once I have the tablenames, I want to get the column-names.

So that I first know only the database-name, and afterwards I know that there are for example 2 tables named "tblCustomer" and "tblWorker", "tblCustomer" has the columns "FirstName", "LastName", "Address", ...

plz help!!

TIA

How Do I Structure This Query?
Hi!

I have a program that is linked to an Access database. I use ADO recordset to access the database and I use sql queries to retrieve the data.

I have a function that retrieves data that follows a certain pattern and I use 'Like' in my Select query. For example if I want to retrieve data that have the patter DBxxxxx where x are numbers, I would use:
Select * FROM table WHERE table.field LIKE 'DB%'

However, I have a set of data that has the pattern DBAxxxxx so these data would also be retrieved by the query.

My question is how can I structure the query so that it would retrieve only DBxxxxx and not include DBAxxxxx?

Thank for the help....

Database Structure
I want to create a search form that will access a database. I will be the intial user but eventually it will be given to outside people. I know I can connect it to an access database thru VB. But how should it be setup if the next user does not have access installed on their computer. What the next user will have is a CD containing the database and the search form. I have been told XML would be the way to set it up. Can someone advise. Thanks.

HSTMT Structure
Hi all,
I need to know the structure of HSTMT, I'm writing a special ODBC driver that when executing the query the result will be in file so I need to know how to deal with the structure of HSTMT..

Thanks,
Hiba

Sql Table Structure
Hi Guyz,

How do i retrieve the table structure of sql server 2000

For an example, in oracle, i use the desc command

desc <tablename>

But im not sure how to do it in sql server 2000

Thx in advance

Table Structure..
hi to all,

i as basically creating a payroll database, wherein a certain table consists of fields that are related to a payroll transaction. I was wondering if I would store the computation of an employee's net pay in a table, which of course is necessary for reports, (of course, a certain employee would want to see his/her net pay during the payday!). Btw, Net Pay = (gross salary - total deductions).

Is it a good idea to store/save the computation value in the table itself? So that when producing reports, I would just have to query the payroll, ex:

Code:
(Select * from payroll)
so that all fields would be displayed on the report. How about computing the net pay value as you query the records? Ex:

Code:
]Select gross salary, total deductions (gross salary - total deductions) AS NetPay
.

Besides I am using crystal reports 10 as my reporting tool and crystal reports has its aggregate functions and computations that you can create. Also, if ever I want to view to payroll record again, all I have to do is just compute it in vb itself. Which of the two is the better way?

tnx and god bless

KBDLLHOOKSTRUCT Structure
Hi all,

Anyone familiar with KBDLLHOOKSTRUCT? For those who dont, please refer here.

I'm a bit confuse on the flag member type and it values. It will always return 0 for a keypress down and 128 for a keypress up. So what does the following means?


flags
Specifies the extended-key flag, event-injected flag, context code, and transition-state flag. This member is specified as follows. An application can use the following values to test the keystroke flags.

LLKHF_EXTENDED - Test the extended-key flag.
LLKHF_INJECTED - Test the event-injected flag.
LLKHF_ALTDOWN - Test the context code.
LLKHF_UP - Test the transition-state flag

0
Specifies whether the key is an extended key, such as a function key or a key on the numeric keypad. The value is 1 if the key is an extended key; otherwise, it is 0.

1-3
Reserved

4
Specifies whether the event was injected. The value is 1 if the event was injected; otherwise, it is 0.

and so on... and so on...

(excerpt taken from MSDN).

I'm new to API so I'm sorry if this Q is too 'newbie'.

Declaring A C Structure And DLL In VB
I am having difficulties (Dr. Watson) declaring the following DLL's. Can someone please tell me what I am doing wrong. The Arrows indicate the area I believe the problem is in.

This is the C code from a .h include file for the DLL.

Code:
struct REFERENCE
{
unsigned char board_select;
unsigned char access;
};

struct dpc1_error
{
unsigned char Error_Decode;
unsigned char Error_Code_1;
unsigned char Error_Code_2;
unsigned short Error_Class;
unsigned short Error_Code;
};


struct dpc1_read_rb
{
// in
unsigned long C_Ref;
unsigned char Slot_Number;
unsigned char Index;
// out
unsigned char Length_s;
unsigned char *Data_s; <====================
struct dpc1_error error;
};


struct dpc1_write_rb
{
// in
unsigned long C_Ref;
unsigned char Slot_Number;
unsigned char Index;
unsigned char Length_m;
unsigned char *Data_m; <==================
// out
struct dpc1_error error;
};


extern CT W32EXPORT_C1 unsigned short CLV_C1 dpc1_read (unsigned short orderid,
struct dpc1_read_rb *request_ptr);

extern CT W32EXPORT_C1 unsigned short CLV_C1 dpc1_write (unsigned short orderid,
struct dpc1_write_rb *request_ptr);

extern CT W32EXPORT_C1 unsigned long CLV_C1 dpc1_get_cref (struct REFERENCE *ref_ptr, unsigned char slv_adr);
This is my attempt at the VB equivilent.


Code:
Type dpn_reference
board_select As Byte
Access As Byte
End Type

Type TY_DPC1_Error
Error_Decode As Byte
Error_Code_1 As Byte
Error_code_2 As Byte
Error_Class As Integer
error_code As Integer
End Type

Type TY_DPC1_Read_RB
C_Ref As Long
Slot_Number As Byte
Index As Byte
Length_s As Byte
Data_s As Long
Error As TY_DPC1_Error
End Type

Type TY_DPC1_Write_RB
C_Ref As Long
Slot_Number As Byte
Index As Byte
Length_m As Byte
Data_m As Long
Error As TY_DPC1_Error
End Type

Declare Function dpc1_read Lib "dplib" (ByVal OrderID As Integer, ByRef Request_Ptr As TY_DPC1_Read_RB) As Integer
Declare Function dpc1_write Lib "dplib" (ByVal OrderID As Integer, ByRef Request_Ptr As TY_DPC1_Write_RB) As Integer
Declare Function dpc1_get_cref Lib "dplib" (ByRef Ref_Ptr As dpn_reference, ByVal Slv_Adr As Byte) As Long
The have a problem understanding what to put in the C Structure where there seems to be a pointer to the Data_s or Data_m variable. I used a long integer that I filled with the VarPtr of my Data Buffer.

In VB there is a "hole" in memory where the three bytes between the two longs are. There is also a "hole" in the dpc1_Error structure after the first three bytes.

I don't understand how C arranges the variable in the structure well enough to write the VB equivilent.

Thank You in Advance.

P.S. I don't know what happened to the spaces that formatted the VB code nicer when I pasted it in, so it is a little difficult to read. Sorry.

Copyright 2005-08 www.BigResource.com, All rights reserved