|
Uhhhh...whatever...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Can anyone suggest the right approach for the below mentioned issue/combination:
we have 3tier architecture application in vb and we r migrating it to vb.net in horizontal approach
first we r converting at server side(com+) vb dlls to vb.net we done it well
1). using .NET dll as part of server (MTS, COM+)
2). VB as front end
3). VB client (interfaces) is on one machine and server is on the other machine.
4). Using UDT (User Defined Type) for passing the info to SERVER from CLIENT and visa versa.
but our problem :
In the above mentioned combination, connecting from Client to the Server machine, in the client side we need to have LIBRARY, which creates UDTs (User Defined Type) and passing the info to the server DLL as argument. Here can the UDT be built on VB or .NET framework (as we understood that both can be allowed) ?, but we want the best approach for MARSHALLBYVAL. Please suggest us.
|
|
|
|
|
I have a simple VB6 function that loads a nominated DLL in another process using the CreateRemoteThread method - this is described elsewhere, and involves using CRT to trigger a LoadLibrary call in the target process.
I've never had it fail (assuming the loaded dll is well-behaved, of course), but now I have found that there is one type of DLL for which it fails!
It refuses to work with my customised VB6 dll's, by which I mean DLL's produced by changing the VB6 compile-time LINK command options to substitute my VB DLLMAIN procedure, and including a DEF file to export my VB functions.
When I try to inject one of these dll's, I simply get an exit code of zero, indicating the LoadLibrary call failed, I assume, but without the GetLastError code from the target process of course I have no idea why it failed.
I will try further tests to see if I can retrieve that error code in the target program.
Meanwhile, I'd be grateful for any suggestions....
I can provide a trivial 1-function DLL produced this way, if anybody thinks the problem might be spottable by loading it and having a peek. It simply refuses to be injected (with CRT, anyway).
Thanks
Dr Memory
MathImagics Software Engineering
Cutmill, Surrey, UK
Algorithms`R`Us
|
|
|
|
|
In trying alternative ways to achieve my objective, I discovered this problem is not specific to my customised DLL's.
I inject a non-VB dll, which in its DLLMAIN tries to create an object provided by a conventional ActiveX DLL.
This is a common and easy thing to do, I built an import/export table modifier using it...
But it just won't work if the dll is injected with CreateRemoteThread! The attempt to create the object instance fails.
Load the dll yourself though, and it works like a charm!
|
|
|
|
|
i want to search for 2 words or more but i must be able to search the words in the same sentance, same paragraph and same page.. in a word doc file..
i'm now usind the indexing service and connect to sqlServer..
i can search words between up 8 words by using "NEAR()" any one can help in search on a sentance and on a paragrah???
|
|
|
|
|
Something like this..........
Dim oExcel as object
Dim oWorkbook as object
Dim oWorkSheet as object
Dim strFilename as string
Set oExcel = CreateObject("Excel.Application")
Set oWorkbook = oExcel.Workbooks.Open(PathtoASpreadSheet)
strFilename = "Filename" & Date & "Filename" & ".xls"
oExcel.DisplayAlerts = True
oWorkbook.SaveAs strFilename
Set oWorkSheet = oWorkbook.worksheets("Sheet1")
You can then access the cells in the worksheet directly using various methods
like.........
'hide a column
oWorkSheet.Columns("P").Hidden = True
'Set a value of a cell
oWorkSheet.Cells(1, "A") = "Hello World"
'change interior colour
oWorkSheet.Range(oWorkSheet.Cells(1, "A"), oWorkSheet.Cells(1, "H")).Interior.Color = &H80FFFF
'save and close
oWorkbook.Save
oWorkbook.Close
oExcel.Quit
'terminate excel
Set oworkbook = nothing
Set oworksheet = nothing
Set oExcel = nothing
Bear in mind that to access excel constants they will need to be declared
like........
Const xlNumberAsText = 3
Const xlContinuous = 1
Const xlCellValue = 1
Const xlEqual = 3
Const xlBetween = 1
Const xlNotBetween = 2
Const xlValidateDate = 4
Const xlValidAlertStop = 1
Const xlGreater = 5
Const xlValidateList = 3
Example of use
oWorkSheet.Range(oWorkSheet.Cells(1, "A"), oWorkSheet.Cells(1, "H")).Borders.LineStyle = xlContinuous
Hope that helps
Purple Monk
"I am what i am, and i do what i do, but sometimes i do, what you want me to do, but only after much wining."
|
|
|
|
|
How can I open/modify/write/close an .xls spread-sheet from VB6? I tried DAO and ADO but didn´t seem to work (most often error was 'ISAM object not insertable', or some insanity of the like) Thanks in advance.
Pablo.Ar
|
|
|
|
|
Hi,
Yeah... It is simple to delete an existing file... But what I need an implementation for the following algorithm. I will explain with a small example. I have an .exe file and execute it manually and I have a program which deletes a file. I run the program to delete the file which is currently executing. What I want is loop the following bit until the file is released i.e., until the program has ended.
Does anyone know this how to do it.
Thanks in Advance. The following is a general algorithm.
For WaitTime As Int16 = 0 To 220<br />
System.Threading.Thread.Sleep(1000)<br />
' Delete temporary file as soon as possible after it is freed.<br />
Try<br />
If DeleteFile(ToFile)=True Then<br />
'File Deleted<br />
Exit For<br />
End If<br />
Catch ex As Exception<br />
<br />
End Try<br />
Next ' Otherwise, loop again and keep waiting...
Prabhu Ram Prasath
prabhuram@dsrc.co.in
|
|
|
|
|
if i understand your question you can try to put this code in a Sub (Function) and than if DeleteFile(ToFile) returns False you can just recursively call the Sub (function) again. it could be something like this:
Public Sub Del_File(ToFile)<br />
For WaitTime As Int16 = 0 To 220<br />
System.Threading.Thread.Sleep(1000)<br />
' Delete temporary file as soon as possible after it is freed.<br />
Try<br />
If DeleteFile(ToFile)=True Then<br />
'File Deleted<br />
Exit For<br />
Else<br />
Del_File(ToFile)<br />
End If<br />
Catch ex As Exception<br />
'<br />
End Try<br />
Next<br />
End Sub
you can also declare WaitTime variable as Static (in VB .Net) so you do not start counting from the beginning every time
sony speed
|
|
|
|
|
Recursively calling the sub over and over is not necessary and, if called enough, will actually eat up the stack, resulting in a Stack Overflow failure and crashing your app.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Your code should look something like this if you want to specify a Timeout value. It's up to you wheather or not to throw an Exception when the Timeout expires. You could return a False value meaning that the file was NOT deleted because of the Timeout and True meaning that it was, or you could throw some kind of Exception. It's up to you...
Private Function DeleteTempFile(ByVal timeOut As TimeSpan, byval filePath As String) As Boolean
Dim endTime As DateTime = DateTime.Now().Add( timeOut )
While DateTime.Compare( DateTime.Now(), endTime ) < 0
Try
' File class members are static. You don't need an instance to call them.
' The Delete method doesn't return a value, so you have to watch for Exceptions
' using a Try/Catch block.
File.Delete( filePath )
' This next statement will only execute if the Delete was successfull.
Return True
Catch
' Do nothing since we don't care what the error was.
End Try
' This line was added AFTER the original post.
' Avoid hogging the CPU so our application can respond to outside messages, like
' repainting our window.
Application.DoEvents()
End While
' If we get to this point, it means that our Timeout expired. Return False to show that
' the file was NOT deleted.
Return False
End Function
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
You got to be joking!
and what if he never manages to delete the file he can possibly display a Message Box and tell the user Please delete the file manually
sony speed
|
|
|
|
|
sony speed wrote:
You got to be joking!
About what? Do you want to be a little more specific, or should I say constructive?
sony speed wrote:
and what if he never manages to delete the file
That's what the Timeout value is for! After a specified time, the function returns a value specifying if the delete was successfull or not.
sony speed wrote:
he can possibly display a Message Box and tell the user Please delete the file m
That's not what this function is about. The function very specifically is used to try and delete a file for a specified time. The UI for putting up a MessageBox should be handled by the code that calls this function, or something higher up the call chain. It's called "modular code". This function can be used in another app without modification and without any regard to the type of application or library that it's in. It could be used in a .DLL project, class library, Windows Service app, Windows CE app, Windows Forms, Web Forms, or even in a Mono app running under Linux. But once you add the MessageBox code, it becomes usable ONLY in a Windows Forms or Windows CE app.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Is your temp file created at run time by the first application?
Do you create/name temp file?
If so you can put a FileSystemWatcher control in your second app and implemnt a simpel code like this
Private Sub FileSystemWatcher1_Changed(ByVal sender As System.Object, ByVal e As System.IO.FileSystemEventArgs) Handles FileSystemWatcher1.Changed<br />
Try<br />
File.Delete(FileSystemWatcher1.Path & "\" & FileSystemWatcher1.Filter)<br />
Catch ex As Exception<br />
'<br />
End Try<br />
End Sub
FileSystemWatcher1.Path = the path of your temp file
FileSystemWatcher1.Filter = the name of your temp file
and this will work just fine
sony speed
|
|
|
|
|
I run multiple instances of a vb6 app from desktop PCs. The apps run crystal reports (v8). The .rpt files are on a shared folder.
Problem is, if the folder allows 8 connections, running reports 9times leads to a no-access error (see below). It seems setting the report and application objects to nothing does not unlock the report.
Users have to unlock it in Admin Tools\Comp Mnagement\Shared Folders\Open Folders. Exiting the app also unlocks the reports.
How can I unlock a report after using it in code?
Error occurs at line
Dim crystalreport As New Report
Dim crystalApplication As New Application
..
Set crystalreport = crystalApplication.OpenReport(strReportPathName)
The error is:
'Error in File UNKNOWN.RPT: Access to report file denied. Another program may be using it'
1fm1fu
|
|
|
|
|
It would appear that the underlying file handles to open and read the report in the OpenReport method are not being released when you drop the objects out of scope. I can't remember the old version of Crystal Reports objects, but is there a Close method to go along with the OpenReport method on the Application object? You might want to try that and if it doesn't exist, try visiting BuisnessObjects.com and see if there is an update to the Crystal Reports package your using.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
also, to add to what dave mentioned...
i don't recall if it existed in the older crystal libraries, but i know that it does in cr.net & cr 9. when you open your report you have the option of how you wish to open that report:
OpenReportByDefault or OpenReportByTempCopy
Open report by temp copy actually makes a temporary copy in the same folder as the original report template. then uses this temporary copy rather than the original allowing it to be accessed by other processes... which will hopefully also open by temp copy.
again, not sure if it will be available to you from the com version of the libraries, but if not you can always check out the possibility of creating a com wrapper of the crystal .net assemblies if you think this option is worth checking out.
hope this helps.
-jim
|
|
|
|
|
Thanx Dave n jmatthew.
Appears if i pass the OpenMethod optional parameter a 1 in OpenReport method i can open multiple instances. There is no close method for the Crystal Application class though.
I'll do with the workaround for now...
1fm1fu
|
|
|
|
|
I am having a hard time getting the getChanges to retrieve the changes that were performed on the last row of the data, since nothing really happens when the hit the enter key on the last line (it doesn't go to the next line since there isn't one.
Has anyone found a way around this?
|
|
|
|
|
why don't you just try writing a line of code like this one
Me.BindingContext(Me.Dataset11, "authors").Position += 1
just before you call the GetChanges() method it will most probably work
sony speed
|
|
|
|
|
this does work in most scenarios, but i've had problems with doing it this way.
say for instance you only have one row displayed in the datagrid? you can't change the position and therefore the data doesn't get saved.
the proper way of handling this situation is manually calling EndEdit() for the datagrid, or the underlying datasource.
hope this helps.
-jim
|
|
|
|
|
How can I open/modify/write/close an existing .xml file from vb? I tried DAO and ADO, but couldn´t get to nothing (some errors mentioned 'ISAM object not listable', or some insanity of the like)
Well, any help is welcome.
Pablo.Ar
|
|
|
|
|
Have you tried "Microsoft XMl V3.0" ?
|
|
|
|
|
Sorry, I got confused and made a terrible mistake. It wasn´t xml!!! it was .xls!!!!!!!!!!!!!!!!!!! sorry, and a 1G of thanks!
Pablo.Ar
|
|
|
|
|
Sorry,but i have seen some code in c++ which is using Microsoft Excel Driver(think in CP itself).But don't know much about it.
|
|
|
|