|
We have an Access database that is used here at my company. We have references to Microsoft Word and Excel. The problem is that not everyone here at the company has the same version of Word and Excel. Everyone has been told that they should not be doing developing work in the database, but people still are because the references to the libraries keep getting updated to different versions. We already have people entering in a log in, is there any way that I can detect (using code) when references get changed? Then I could link it back to the user and find out who is developing when they should not be. Thanks for your help!
Kogorman
|
|
|
|
|
No, your best best is to Code using "Late Binding" methods. All you have to do is get rid of your References when you are sure that the Code works, then Change every Variable to Type "Object". This way it will work no matter what Version of MS Office plus you can trap Errors to determine if Office is not installed.
For example:
On Error Goto ErrHandler
Dim xlApp As Excel.Application 'Error will Occur here when not installed
Set xlApp = New Excel.Application
ErrHandler:
If (Err.Number <> 0) Then
'Of course, determine the Correct Error Number for this...
MsgBox "Excel is not Installed!"
End If
Now, change it to this after removing all References to Excel:
On Error Goto ErrHandler
Dim xlApp As Object
Set xlApp = CreateObject("Excel.Application") 'Error will Occur here when not installed
ErrHandler:
If (Err.Number <> 0) Then
'Of course, determine the Correct Error Number for this...
MsgBox "Excel is not Installed!"
End If
|
|
|
|
|
I all,
I want to convert a structure from VB to VB.NET and I don´t know how specify the max length of an string...
Sample VB 6.0:
------------------------------------
Public Type YY
XX As String * 10
End Type
-------------------------------------
Code in VB 7.0:
------------------------------------
Structure YY
XX As String '<--- ¿How could I do it?
End Structure
-------------------------------------
Thanks all
"On the 8th day, God started debugging"
|
|
|
|
|
Private Structure Test
<VBFixedString(25)> Dim MyString As String
End Structure
|
|
|
|
|
Ok, that didn't Format correctly at all! Try this:
Private Structure Test
<VBFixedString(25)> Dim MyString As String
End Structure
|
|
|
|
|
Ok thanks Mikasa, I found it in MSDN.
Regards
"On the 8th day, God started debugging"
|
|
|
|
|
How can i use a dll in VB which is written in VC++ ???
please help me as soon as possible.
thanks
el hombre es libre cada vez que elige y eso es lo que lo hace libre
|
|
|
|
|
Hello,
Add a declaration of functions which has public scope(those which you want to use in your VB project). Or you can add the reference of your DLL in Project/Reference by choosing it.
Have fun.;)
Regards,
Vilas Shewale
|
|
|
|
|
Firstly, Thanks for your fast reply.
I´m a beginner in both lenguages, VB and English too.
So, i tried by the Reference method ,but i couldn´t do , because when i select the DLL VB show me a message :"Can´t add the reference to the specified File "
The DLL isn´t registred, Can be the problem?
how can i do the declaration?
el hombre es libre cada vez que elige y eso es lo que lo hace libre
|
|
|
|
|
Hi
You are using a simple dll, not a COM dll. When you are trying import a basic dll wihtout interface, you can´t reference using your VB tool development.
You need inport it by code.
VB.NET sample:
--------------------------------
<dllimport("libraryname.dll")> _
Public Shared Function FunctionName(ByRef Param1 As Integer, _
ByRef Param2 As String, _
ByVal Param3 As Integer) As Long
End Function
--------------------------------
Regards
"On the 8th day, God started debugging"
|
|
|
|
|
i´m using VB6, and It don´t have "Shared".
I only want use a simple DLL from this example :http://www.codeproject.com/dll/BeginnerDLL.asp
But I don´t know how import the dll, and where i have to copy the dll (because i don´t want registrer it )
i´m so confused
el hombre es libre cada vez que elige y eso es lo que lo hace libre
|
|
|
|
|
Martin_Viet wrote:
But I don´t know how import the dll, and where i have to copy the dll (because i don´t want registrer it )
You can place the .dll in whatever directory you want it in, however you do need to register the .dll. Go to a command prompt and change the directory to the location of the .dll. Once there type (where myFile is the name of the .dll):
regsvr32 myFile.dll
-Nick Parker
|
|
|
|
|
But I found it:
If you do not specify a path for libname, Visual Basic will search for the file in the following order:
1)Directory containing the .exe file
2)Current directory Windows system directory (often but not necessarily Windows\System)
3)Windows directory (not necessarily \Windows)
4)Path environment variable " [Visual Studio 6.0 Help]
So i´m trying to do this :
Public Declare Function SayHello Lib "MyDLL.dll" () As Boolean
But a message error appeared
el hombre es libre cada vez que elige y eso es lo que lo hace libre
|
|
|
|
|
Hi
I´ll explain in spanish, becase I think, you'll understand better the explanation:
1.Necesitas registrar la dll en el sistema, para ello copia la dll al winnt\system32 y desde ahí ejecuta "regsvr32 TuLibreria.dll"
2.Una vez registrado abre el VB y en el menu busca "Proyecto/Referencias"
que abrira una ventana donde puedes examinar y seleccionar la dll.
3.Una vez referenciada, solo has de instanciarla por codigo, como por ejemplo:
Dim ObjDLL As New PuntoDeEntradaDeLaDLL()
Regards and good luck.
"On the 8th day, God started debugging"
|
|
|
|
|
Martin_Viet wrote:
So i´m trying to do this :
Public Declare Function SayHello Lib "MyDLL.dll" () As Boolean
But a message error appeared
The .dll still needs to be registered, then just specify the path to the file. Just by specifying the file's path does not mean you have registered the file, these are two different things.
-Nick Parker
|
|
|
|
|
Hello,
You can try this. Register your DLL with regsvr32 utility.
1> Goto Start Menu. Press run. Type regsvr32 "path of DLL". And just press Ok. You will get the message of registration by Windows.
2> Or, Double Click on the DLL. It will ask you about the program to be open. Choose the regsvr32.exe from Windows directory. Press ok. Windows will register your DLL automatically.
Make sure that you have to place your DLL in the directory which has your project through which you are accessing the DLL code.
Regards,
Vilas Shewale
|
|
|
|
|
very I am pleaced
It has been eassier on this way, which determines that I am going to have to continue practicing languages both (English and VB )thanks and greetings
el hombre es libre cada vez que elige y eso es lo que lo hace libre
|
|
|
|
|
This is kind of lengthy... but this is how i do it.
First, create a dll project in vcc. Select MFC AppWizard(DLL).
Select Regular DLL. Does'nt matter whether MFC is static
or shared.
Create a .cpp file for your function you want to call. You
will have to create "C" style function because you cannot do
external linkage to vb with C++ classes.
This example is a function called Function123. It takes a string you can modify and returns a UINT.
prototype:
extern "C" UINT __stdcall Function123 (LPSTR lpszBenefits);
the body looks like this:
extern "C" UINT __stdcall Function123(LPSTR lpszBenefits) {
AFX_MANAGE_STATE(AfxGetStaticModuleState()); // This line is important!!!
// do something
return someUINT;
}
Now find the .def file that vc created. It should be under
source files where the rest of the cpp files are.
Add the following entry to the file:
Function123 @1
The @1 indicates that this is function #1 to be exported. If you add
more functions then they should be as @2,@3 etc.
Compile your project and produce the DLL.
Now, in VB:
Add this line at the top of a module file:
Private Declare Function vbfunctionname Lib "EChartPatients.dll" Alias "Function123" (ByVal strName As String) As Long
Now in your module to use this function:
...
dim x as integer
dim y as string
x= vbfunctionname(y)
...
The DLL you created does not have to be linked to the vb exe in any way except that it has to be in the executable path, or, you have to hardcode the path + name in the vb declare statement.
Warning: Initialize your vb string to the max length required prior to sending it into the dll.
|
|
|
|
|
Hello Everybody,
I am developing a Module in which I suppose to use Web Browser control which acts as Windows Explorer. I am tried most of the functionality with SendMessage API with different parameters like IDM_SHVIEW_LARGEICON, IDM_SHVIEW_SELECTALL etc.
But now I want to create a New Folder in the exact way Windows Explorer allows user. For consideration, let's say we will click a button & New Folder functionality should work. All the mention parameters are working with SendMessage API except IDM_SHVIEW_NEWFOLDER.
'Declaration
Private Const IDM_SHVIEW_NEWFOLDER = &H7261
'In command button
SendMessage(hwndSHView, WM_COMMAND, IDM_SHVIEW_NEWFOLDER, 0)
' hwndSH = handle of the SysTreeView32
' WM_COMMAND = message
' IDM_SHVIEW_NEWFOLDER = lParam for action to be performed
' 0 = wParam
I cross check the window's handle value. Also assigned handle the default value (which I got from SPY++).
Please help me out from this problem.
Regards,
Vilas
|
|
|
|
|
|
Hello,
Thank you for your early help. I had gone through that web page earlier. But i don't think so it will help me in solving my problem. Could you suggest me another solution?
Regards,
Vilas Shewale
|
|
|
|
|
Is there anyway to edit the standard printpreview dialog in VB.Net? If no, is there anyone whos got a better PrintPreview dialog than the standard one, and if so, were do I get my hands on it
/Fleischen
|
|
|
|
|
Please forgive me, I am new to Visual Basic. I am teaching myself by reading through a book. In one of the examples of the book, it states to add a new reference that you right click on the references of the project and select add new reference. It then brings up an add reference dialog and I am supposed to go to the third tab (projects). I go there and select the project that I want to add, and it gives me an error that "an assembly must have a .dll extension in order to be referenced." Nowhere in the example program does it say that I need to change the extension of the module. Do I need to change the extension or should I be able to just add the project? Thanks for your help!
Kogorman
|
|
|
|
|
Hello,
You do not have to change your module or project from .Bas to .Dll. If you want to add a reference in VB, then those should be either standard or third party .DLL or .OCX etc. When you have these components with you, you can add the reference of that component in your project.
You can see the standard 3 DLL's checked in the window of the reference(which provides standard functionality to your project without adding any new reference). If you want to use third party DLL then you have choose it from the folder in which it is placed.
So have fun & enjoy the coding.
Regards,
Vilas Shewale
|
|
|
|
|
1) You can onlt reference assemblies that are libraryies of functions (files that have a .dll extension) I don't think you can make a reference to a project that is used to build an exe file.
2) You need to make sure that the assembly project you are referenceing has been built at least once so there is a dll file to reference. Try right clicking on the project and building it before you add the reference.
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Unknown wrote:
"I love long walks, especialy taken by those that annoy me."
Paraphrased from TMNT:
"Cricket? You have to know what a crumpet is to understand Cricket."
|
|
|
|