|
Hi,
the answer to your question is YES.
But not good in setting up candidate..in my case can u walk me through it so I can adapt myself..
Thanks.
|
|
|
|
|
I have an MDI Application that I am developing using Visual Basic 2008
One of the forms that the application calls in inside a DLL. This works great
Imports articleSearch
Dim frm As New DocumentSearch("Broker", Me)
frm.MdiParent = Me
frm.Show()
My problem is that form spawn another form from the DLL depending on the user action i.e. documents to view.
For Each dgRow As DataGridViewRow In DataGridView1.SelectedRows
'MessageBox.Show(dgRow.Cells(3).Value)
Dim frm As New PDFViewer(Trim(dgRow.Cells(3).Value))
frm.MdiParent = _CallingApp
frm.Show()
Next
now if i use the frm.mdiparent = _CallingApp (where _callingApp is a reference to the form being called) then the form display is blank but if i omit that line it works as expected, but it is no longer a child window of the mdi app
any pointers?
Thanks
Simon
As barmey as a sack of badgers
|
|
|
|
|
Simon_Whale wrote: where _callingApp is a reference to the form being called
What do you mean with the 'form being called'?
I would either put a reference to the MDI form in a class and use that one.
Or just use me.parentform instead of _CallingApp
|
|
|
|
|
Sorry Tom,
In my App I have the main exe and a DLL.
In the DLL I have 2 forms a document search form and a PDF viewer.
each of these forms are called by the main App (MDI parent)
I can call the document search and that works ok, but then the user clicks on docs to view and click on the view selected button. But I want to get the PDF viewer as a page in the MDI Application, if I set the parent no document shows (just a blank screen). If i ignore the mdiparent setting it works as expected but the user gets 1 to many pdf's open.
My question is how can I get the PDF viewer screen to show up inside the MDI Application only.
As barmey as a sack of badgers
|
|
|
|
|
To get it to open inside the mdi application you have to set the mdiparent of the form.
So either the _CallingApp reference is wrong (not a reference to the mdi parent form or something in your pdf viewer is going wrong when called into a mdi container.
|
|
|
|
|
Hi all,
one of the tasks in my application is copying several thousand large picture files (12 MB). In order to make this perform to the maximum I tried to parallelize the copy process using the ThreadPool, so that every file is copied in a new thread if available. The idea behind was that, on the target system - which is equipped with several RAIDs - this might result in a remarkable performance gain.
On my development computer I have only 2 harddisks and also don't have the necessary amount of files available, so I simulated the copy process by using a dummy (thread.sleep(200) instead of copy). This worked fine, and it seemed like hundreds of files would copy within seconds while using up to 9 threads. On the other hand, a final test on my development system, without the dummy but with much lesser files, didn't result in any performance gain at all.
Since I don't have a lot of experience there's the doubt arising if the basic approach is correct and worth following, so that - before implementing everything on the target system - I wish to get some more experienced advice on that. Does this concept make sense at all so that it would be worth the effort, or am I on a wrong track? Btw I have to stay with .NET2.0 and can't use any of the VS2010 parallelism options... and I'm working with the VS2008 Express Version only.
Thanks for some guiding thoughts
Michael
|
|
|
|
|
Off the top of my head I'm not sure having so many threads buys you anything - unless you have several thousand processors each running one of them.
It looks to me that the main bottle neck will be the I/O performance rather than the CPU. So many threads is not likely to help.
Furthermore, each thread will come at a cost - there's the creation but also the cost of switching when a thread's time slice expires.
However, this is guesswork and there's no substitute for performance testing.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
The only valid measurement of code quality: WTFs/minute.
|
|
|
|
|
Hi David,
thanks for your opinion. The target system with the RAIDs is supposed to process up to 25 frames per second in HD (it's movie related, i.e. so a HD frame is a picture of 2048*1536) while Windows Explorer seems to copy only around 5 frames per second. That's why I thought triggering several parallel copy processes by several asynchonous threads could be "it" - my goal is to fully exploit the given I/O performance for the copy process.
Do you probably have another idea how I could reach that goal?
Thanks
Michael
|
|
|
|
|
Not really something I've dealt with but here's some thoughts.
Have you tried just having a loop that uses File.Copy - this is likely to be quicker than Explorer copying.
Would using XCopy from the shell do the job?
Would using CopyFileEx in the Win32 API improve things - I've found that sometimes using the Win32 API has improved performance.
Multiple threads may be faster but I don't think one per file would help. Especially if there is a large number of files. Only one thread per processor can be running at any time. So you just end up with a large queue of threads - that costs in terms of thread scheduling.
There's more than one level of RAID - some of them don't improve IO performance. What level is actually implemented? It may be that the disk controller proves to be a bottleneck.
When performance has been an issue I've found the only sure way to improve it is by profiling the app - guesses as to where the delays are often turn out wrong.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
The only valid measurement of code quality: WTFs/minute.
|
|
|
|
|
Michael,
This is quite a good article on Toms Hardware, addressing network copy operations; http://www.tomshardware.com/reviews/gigabit-ethernet-bandwidth,2321.html[^]
If you are going to be doing this large volume transfer regularly, i think the first thing to do would be to improve your network infrastructure in attempt to get upto the theoretical limits of the interconnect. e.g. do both ends and any switches in between support jumbo frames etc.
I use RDII Disk Benchmark 2 by Ives Heymans, using unbuffered IO to test my PC to QNAP TS509 Pro Raid Box. search the net for it, it is free software. The software uses varying block sizes, and allows you to try varying things to get a consistent test.
You will also want to make sure that your hard disks are defrag'd, so the read head is not have jump around all over the place and is reading from a contiguous block.
Reading the Toms hardware article, you will see they maximised the io by transferring from Ram to Ram over the network. You may want to look at using 1 thread to transfer files into a ram disk, and the other thread to move from the ram disk out to the network, this is keeping all your subsystems occupied, but without sharing on the slowest part, the hard disk.
|
|
|
|
|
Thank you, guys.
Testing the copy tool on the target system was a slap in the face Copying 1018 selected files took 667 seconds, while copying the same fileset with Windows Explorer took only 135 seconds.
I don't know if the overhead of my operations can slow down the copy process so much, or if it's the other big difference in the benchmark setup, that the filelist I copy contains selected (probably fragmented) files from a large directory while for the Explorer copy test I just copied the resulting folder.
Nevertheless, it seems I have to think a little more about the approach (codewise) in order to reach at least the speed that Explorer does. An effort like setting up RAM-Disks etc. doesn't make sense comparing it to the benefit. Being more or less a hobbyist it might take me months... and I'm not even paid for it
Michael
|
|
|
|
|
If you think Explorer can copy faster, you can Involve explorer to copy from your program. I did it before. I faced the problem like you. Actually that was faster than explorer but that need to keep file info manually. To avoid this problem i set the list of file names into clipboard then call an API function
ShellExecuteEX to Involve explorer to copy. That is working perfectly.
|
|
|
|
|
Thank you, I'll check that out!
|
|
|
|
|
You can do it very easy way following this codes:
Open an project in vb6 and paste this codes:
Option Explicit
Private Sub Command1_Click()
Dim Files() As String 'contains the list of folders or files
'if more 1 file/folder then chage it
ReDim Preserve Files(0) As String
Files(0) = Text1.Text
'Example of multiple folder/files
'With Me.ListView1
'For i = 1 To .ListItems.Count
'If .ListItems.Item(i).Selected Then
'ReDim Preserve FS(j) As String
'FS(j) = CRDIR & .ListItems.Item(i).Text
'j = j + 1
'End If
'Next i
ClipBoard.clipCopyFiles Files
End Sub
Private Sub Command2_Click()
Dim PasteOn As String
PasteOn = Text2.Text
On Error Resume Next
' Handle your destinition folder. if not exist then create
MkDir PasteOn
Dim R As Long
R = ShellEx(PasteOn, 0, "Paste")
If R <= 32 Then MsgBox "Error"
End Sub
Add a module named clipboard and paste this code:
Option Explicit
Private Type POINTAPI
x As Long
Y As Long
End Type
Private Declare Function EmptyClipboard Lib "user32" () As Long
Private Declare Function OpenClipboard Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function CloseClipboard Lib "user32" () As Long
Private Declare Function SetClipboardData Lib "user32" (ByVal wFormat As Long, ByVal hMem As Long) As Long
Private Declare Function GetClipboardData Lib "user32" (ByVal wFormat As Long) As Long
Private Declare Function IsClipboardFormatAvailable Lib "user32" (ByVal wFormat As Long) As Long
Private Declare Function DragQueryFile Lib "shell32.dll" Alias "DragQueryFileA" (ByVal hDrop As Long, ByVal UINT As Long, ByVal lpStr As String, ByVal ch As Long) As Long
Private Declare Function DragQueryPoint Lib "shell32.dll" (ByVal hDrop As Long, lpPoint As POINTAPI) As Long
Private Declare Function GlobalAlloc Lib "Kernel32" (ByVal wFlags As Long, ByVal dwBytes As Long) As Long
Private Declare Function GlobalFree Lib "Kernel32" (ByVal hMem As Long) As Long
Private Declare Function GlobalLock Lib "Kernel32" (ByVal hMem As Long) As Long
Private Declare Function GlobalUnlock Lib "Kernel32" (ByVal hMem As Long) As Long
Private Declare Sub CopyMem Lib "Kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Private Const CF_TEXT = 1
Private Const CF_BITMAP = 2
Private Const CF_METAFILEPICT = 3
Private Const CF_SYLK = 4
Private Const CF_DIF = 5
Private Const CF_TIFF = 6
Private Const CF_OEMTEXT = 7
Private Const CF_DIB = 8
Private Const CF_PALETTE = 9
Private Const CF_PENDATA = 10
Private Const CF_RIFF = 11
Private Const CF_WAVE = 12
Private Const CF_UNICODETEXT = 13
Private Const CF_ENHMETAFILE = 14
Private Const CF_HDROP = 15
Private Const CF_LOCALE = 16
Private Const CF_MAX = 17
Private Const CFSTR_SHELLIDLIST As String = "Shell IDList Array"
Private Const CFSTR_SHELLIDLISTOFFSET As String = "Shell Object Offsets"
Private Const CFSTR_NETRESOURCES As String = "Net Resource"
Private Const CFSTR_FILEDESCRIPTOR As String = "FileGroupDescriptor"
Private Const CFSTR_FILECONTENTS As String = "FileContents"
Private Const CFSTR_FILENAME As String = "FileName"
Private Const CFSTR_PRINTERGROUP As String = "PrinterFriendlyName"
Private Const CFSTR_FILENAMEMAP As String = "FileNameMap"
Private Const GMEM_FIXED = &H0
Private Const GMEM_MOVEABLE = &H2
Private Const GMEM_NOCOMPACT = &H10
Private Const GMEM_NODISCARD = &H20
Private Const GMEM_ZEROINIT = &H40
Private Const GMEM_MODIFY = &H80
Private Const GMEM_DISCARDABLE = &H100
Private Const GMEM_NOT_BANKED = &H1000
Private Const GMEM_SHARE = &H2000
Private Const GMEM_DDESHARE = &H2000
Private Const GMEM_NOTIFY = &H4000
Private Const GMEM_LOWER = GMEM_NOT_BANKED
Private Const GMEM_VALID_FLAGS = &H7F72
Private Const GMEM_INVALID_HANDLE = &H8000
Private Const GHND = (GMEM_MOVEABLE Or GMEM_ZEROINIT)
Private Const GPTR = (GMEM_FIXED Or GMEM_ZEROINIT)
Private Type DROPFILES
pFiles As Long
pt As POINTAPI
fNC As Long
fWide As Long
End Type
''''''
Public Const FO_MOVE As Long = &H1
Public Const FO_COPY As Long = &H2
Public Const FO_DELETE As Long = &H3
Public Const FO_RENAME As Long = &H4
Public Const FOF_MULTIDESTFILES As Long = &H1
Public Const FOF_CONFIRMMOUSE As Long = &H2
Public Const FOF_SILENT As Long = &H4
Public Const FOF_RENAMEONCOLLISION As Long = &H8
Public Const FOF_NOCONFIRMATION As Long = &H10
Public Const FOF_WANTMAPPINGHANDLE As Long = &H20
Public Const FOF_CREATEPROGRESSDLG As Long = &H0
Public Const FOF_ALLOWUNDO As Long = &H40
Public Const FOF_FILESONLY As Long = &H80
Public Const FOF_SIMPLEPROGRESS As Long = &H100
Public Const FOF_NOCONFIRMMKDIR As Long = &H200
Type SHFILEOPSTRUCT
hWnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Long
fAnyOperationsAborted As Long
hNameMappings As Long
lpszProgressTitle As String
End Type
Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
'''''''''''''''''''''SHELL
Private Type SHELLEXECUTEINFO
cbSize As Long
fMask As Long
hWnd As Long
lpVerb As String
lpFile As String
lpParameters As String
lpDirectory As String
nShow As Long
hInstApp As Long
lpIDList As Long
lpClass As String
hkeyClass As Long
dwHotKey As Long
hIcon As Long
hProcess As Long
End Type
Private Const WM_PASTE = &H302
Private Const SEE_MASK_INVOKEIDLIST = &HC
Private Const SEE_MASK_NOCLOSEPROCESS = &H40
Private Const SEE_MASK_FLAG_NO_UI = &H400
Declare Function ShellExecuteEX Lib "shell32.dll" Alias "ShellExecuteEx" (SEI As SHELLEXECUTEINFO) As Long
Public Function ShellEx(FileName As String, OwnerhWnd As Long, ByVal Operation$) As Long
Dim SEI As SHELLEXECUTEINFO
With SEI
.cbSize = Len(SEI)
.fMask = SEE_MASK_NOCLOSEPROCESS Or SEE_MASK_INVOKEIDLIST Or SEE_MASK_FLAG_NO_UI
.hWnd = OwnerhWnd
.lpVerb = Operation
.lpFile = FileName
.lpParameters = vbNullChar
.lpDirectory = vbNullChar
.nShow = 0
.hInstApp = 0
.lpIDList = 0
End With
ShellExecuteEX SEI
ShellEx = SEI.hInstApp
End Function
'''''''''''''''''SHELL END--------------------------------------
'Public FL As New EnumFiles, DS As New Iqbal
'''''''''
Public Function clipCopyFiles(Files() As String) As Boolean
Dim Data As String
Dim df As DROPFILES
Dim hGlobal As Long
Dim lpGlobal As Long
Dim i As Long
If OpenClipboard(0&) Then
Call EmptyClipboard
For i = LBound(Files) To UBound(Files)
Data = Data & Files(i) & vbNullChar
Next i
Data = Data & vbNullChar
hGlobal = GlobalAlloc(GHND, Len(df) + Len(Data))
If hGlobal Then
lpGlobal = GlobalLock(hGlobal)
df.pFiles = Len(df)
Call CopyMem(ByVal lpGlobal, df, Len(df))
Call CopyMem(ByVal (lpGlobal + Len(df)), ByVal Data, Len(Data))
Call GlobalUnlock(hGlobal)
If SetClipboardData(CF_HDROP, hGlobal) Then
clipCopyFiles = True
End If
End If
Call CloseClipboard
End If
End Function
Public Function clipPasteFiles(Files() As String) As Long
Dim hDrop As Long
Dim nFiles As Long
Dim i As Long
Dim desc As String
Dim FileName As String
Dim pt As POINTAPI
Const MAX_PATH As Long = 260
If IsClipboardFormatAvailable(CF_HDROP) Then
If OpenClipboard(0&) Then
hDrop = GetClipboardData(CF_HDROP)
nFiles = DragQueryFile(hDrop, -1&, "", 0)
ReDim Files(0 To nFiles - 1) As String
FileName = Space(MAX_PATH)
For i = 0 To nFiles - 1
Call DragQueryFile(hDrop, i, FileName, Len(FileName))
Files(i) = TrimNULL(FileName)
Next i
Call CloseClipboard
End If
clipPasteFiles = nFiles
Else ''not copy
Files = Split("")
clipPasteFiles = -1
End If
End Function
Public Function clipPasteble() As Boolean
If IsClipboardFormatAvailable(CF_HDROP) Then
clipPasteble = True
Call CloseClipboard
Else ''not copy
clipPasteble = False
End If
End Function
Function TrimNULL(ByVal StrIn As String) As String
Dim nul As Long
nul = InStr(StrIn, vbNullChar)
Select Case nul
Case Is > 1
TrimNULL = Left(StrIn, nul - 1)
Case 1
TrimNULL = ""
Case 0
TrimNULL = Trim(StrIn)
End Select
End Function
You will see a copy progress window as like you copy using explorer.exe. It copyes all sub foldes and files as explorer does.
You have every thing you need.
|
|
|
|
|
|
Thank you, Dave, I'll check that out!
|
|
|
|
|
Hi
I want to save multiple records form the datagrid into the database using dataset, please help.
|
|
|
|
|
|
can any one tell me please how can i set the timer control on splash control.
|
|
|
|
|
Don't start a new thread if you want to add a smiley - thats just irritating.
Read the guidelines, I know they suggest you do some research before asking a question.
Try this tool[^] it is excellent for research where you can find literally 100s of bits of helpful information.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi there
To run a splashscreen for 5 seconds and then load the main form you need to add some code in the SplashScreen_Load event that declares a new timer, add a handler to an event that fires when the timer expires, set the timer interval, and the call Timer1.Start() like so:
Dim Timer1 As New Timer
AddHandler Timer1.Tick, AddressOf Tick
Timer1.Interval = 5000
Timer1.Start()
Then you need to add a procedure that will fire when the timer expires like this:
Private Sub Tick(ByVal sender As Object, ByVal e As EventArgs)
Dim newMain As New Form1
newMain.Show()
Me.Close()
End Sub
You must not forget to set the splashscreen as your StartUp form , and also to set the ShutDown mode to When last form closes
Hope this helps
Happy Coding
|
|
|
|
|
Hi
Thanks for the previous solutions
I am using dataset control for crystal reports inside the dataset i type tables and then pass it to thte crystal report.
Using this way i have a feeling that if i have 300 reports the dataset control will definately become heavy and the application will get slow.
My question is:
1) Is there any other way of doing it using untyped data set without using the typed dataset?
2) Is there a way i can use it without a dataset control?
please help
Regards
|
|
|
|
|
Hi
I'm sorry, but I do not use either Crystal Reports or DataSets in my apps, and so am not the best person to ask.
Happy Coding
|
|
|
|
|
no worries, i will sort it out, thanks for the help.
regards
|
|
|
|
|
how can i save multiple values from datagrid into database.
|
|
|
|