|
|
|
Maybe a BAT file?
|
|
|
|
|
hmmmm,a BAT file...
Is there a way to store file(s) inside a BAT, which we can extract during execution? Plus I have to check conditions on a local machine which will be much difficult in from a BAT file from my understanding.
If possible, i would like to use .NET applications...
|
|
|
|
|
Perhaps Powershell then, if supported on the target machines, to check the local machine and invoke a net app.
I know the language. I've read a book. - _Madmatt
modified on Monday, August 22, 2011 8:39 AM
|
|
|
|
|
A BAT file is just a text file with DOS commands in it. There is no way to store anything else in it.
|
|
|
|
|
Create an SFX that contains two files: An exe and a zip file (which contains all your files). The exe does the system checking and decides which files to extract and uses a zip utility to extract specific files from the zip archive.
"Don't confuse experts with facts" - Eric_V
|
|
|
|
|
If you can accept two files to send to the target machine your requirements could be met by
1) An application that allows the user to select files and store them into a resource only assembly (dll)
2) An application to do the checks on the target machine, read the resources and write them out as files.
The resource only assembly is created by invoking the C# compiler, csc.exe, and the following command line will create resourcelib.dll containing two files FileInfo.txt and Help-Aug2011.chm
<br />
csc /out:resourcelib.dll /target:library /resource:FileInfo.txt /resource:Help-Aug2011.chm<br />
The code needed to read the resources from the assembly and convert them back into files is fairly simple
private void CreateFilesFromResources() {
Assembly a = Assembly.LoadFile(@"E:\VC\Projects\CodingTests\BinaryResource\bin\Debug\resourcelib.dll");
foreach (String filename in a.GetManifestResourceNames()) {
Console.WriteLine("Resource name {0}", filename);
using (Stream rs = a.GetManifestResourceStream(filename)) {
using (FileStream fs = File.Create(filename)) {
Byte[] buff = new Byte[8192];
Int32 read;
while ((read = rs.Read(buff, 0, buff.Length)) > 0) {
fs.Write(buff, 0, read);
}
}
}
}
}
Hope that helps and has given you a few ideas.
Alan.
|
|
|
|
|
Don't you think embedding all files in a dll will bloat it? I would say a zip file is a better alternative.
"Don't confuse experts with facts" - Eric_V
|
|
|
|
|
You're right, it is uncompressed and the dll size will be the sum of the individual files plus a small overhead. I have found a limit of the technique when attempting to create a dll with some large files as somewhere between 400 and 600MB when the compiler gave up.
Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.3053
for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.error CS0016: Could not write to output file 'e:\VC\Projects\CodingTests\BinaryResource\resourcelib.dll' -- 'Not enough storage is available to complete this operation. '
Alan.
|
|
|
|
|
To me it sounds like your best bet is to manually create an installer. You'll have to use the resource API, and file management functions, such as CreateFile. Those two sets of libraries should help you accomplish your goal.
This isn't for the purpose of executable security (File integrity) or Intellectual Property protection, is it? If so, I would recommend looking into obfuscation, using techniques such as code virtualization and runtime integrity checks.
|
|
|
|
|
We all know that DataTables can't be passed through a webservice because it is not serializable.
Then how typeof(DataTable).IsSerializable is true?
|
|
|
|
|
typeof(DataTable).IsSerializable is true because it's marked with the SerializableAttribute[^]
The SerializableAttribute tells the serializer to use default serialization, but the serializer will throw an exception if it encounters a type which isn't marked with the SerializableAttribute. The DataTable Columns property is of the type DataColumnCollection[^] which is not marked with the attribute and thus DataTable cannot be serialized.
But DataSet can be serialized and it contains DataTable 's!
The reason DataSet can be serialized is because it implements the ISerializable interface[^] and thus custom serialization logic.
|
|
|
|
|
dews turner wrote: We all know that DataTables can't be passed through a webservice
I don't know that; I've never tried it.
|
|
|
|
|
Well now you do, so maybe now we all know it
|
|
|
|
|
I don't know it until I try it myself; I don't just believe spurious rumors on the 'Net.
|
|
|
|
|
I had no idea! I never actually tried. It's been years since I used webservices, but I think I remember using DataSets.
Learn something every day, thanks!
|
|
|
|
|
I m trying to fire click event of two dynamic tabcontrols. i am not able to fire click event in the first asign tabcontrol. (without array)
Public Class Form1
Friend WithEvents MaxTab As DevExpress.XtraTab.XtraTabControl
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
MaxTab = New DevExpress.XtraTab.XtraTabControl
MaxTab.Name = "tabd"
MaxTab.Top = 1
MaxTab.Size = New System.Drawing.Size(Me.Width - 15, Me.Height - 80)
MaxTab.TabPages.Add("dTAB1")
MaxTab.TabPages.Add("dTAB2")
AddHandler MaxTab.Click, AddressOf MaxTab_Click
Me.Controls.Add(MaxTab)
MaxTab = New DevExpress.XtraTab.XtraTabControl
MaxTab.Name = "tabr"
MaxTab.Top = 1
MaxTab.Size = New System.Drawing.Size(Me.Width - 15, Me.Height - 80)
MaxTab.TabPages.Add("rTAB1")
MaxTab.TabPages.Add("rTAB2")
AddHandler MaxTab.Click, AddressOf MaxTab_Click
Me.Controls.Add(MaxTab)
Me.Controls("tabr").Visible = False
Me.MaxTab.Refresh()
End Sub
Private Sub MaxTab_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MaxTab.Click
MessageBox.Show(MaxTab.SelectedTabPage.Text)
End Sub
End Class
|
|
|
|
|
You are mixing different ways of event handling here.
To avoid confusion, now and later on, remove the MaxTab variable altogether, use AddHandler to register for events, and do not use the Handles statement.
So:
Public Class Form1
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim TabCtrl As DevExpress.XtraTab.XtraTabControl
TabCtrl = New DevExpress.XtraTab.XtraTabControl
TabCtrl.Name = "tabd"
TabCtrl.Top = 1
TabCtrl.Size = New System.Drawing.Size(Me.Width - 15, Me.Height - 80)
TabCtrl.TabPages.Add("dTAB1")
TabCtrl.TabPages.Add("dTAB2")
AddHandler TabCtrl.Click, AddressOf MaxTab_Click
Me.Controls.Add(TabCtrl)
TabCtrl = New DevExpress.XtraTab.XtraTabControl
TabCtrl.Name = "tabr"
TabCtrl.Top = 1
TabCtrl.Size = New System.Drawing.Size(Me.Width - 15, Me.Height - 80)
TabCtrl.TabPages.Add("rTAB1")
TabCtrl.TabPages.Add("rTAB2")
AddHandler TabCtrl.Click, AddressOf MaxTab_Click
Me.Controls.Add(TabCtrl)
Me.Controls("tabr").Visible = False
End Sub
Private Sub MaxTab_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim ClickedTab As DevExpress.XtraTab.XtraTabControl = sender
MessageBox.Show(ClickedTab.SelectedTabPage.Text)
End Sub
End Class
If you need to be able to easily access the tabs later on, create a list/collection variable at class-level instead and add each new tab control to the list.
I.e. add:
Friend TabControls As List(Of XtraTabControl) = New List(Of XtraTabControl)
TabControls.Add(TabCtrl)
|
|
|
|
|
please help me how to make a video themes in desktop ang how to connect the weather in vb.net thanks
|
|
|
|
|
Your question is a bit mashed up and unclear, but all I can establish is your trying to make a gadget to pull the weather from somewhere?
1) have you read the documentation? Developing a Gadget for Windows Sidebar Part 1: The Basics[^]
2) I have made a CodeProject gadget, Windows 7 Sidebar Gadget - CodeProject Reputation Watcher[^], you might want to look at how I have done that.
3) Gadgets are zip files, you could always take a peek inside the current windows weather gadget and see how they have built it. Have a look in the Program Files | Windows Sidebar | Gadgets folder, and then look at the internals of the Weather.Gadget
|
|
|
|
|
i
t not the project i am taking about
i need to improve the gadgets.. it like a video desktop if the weather is sunny day the desktop will play a video for sunny day...that why i need to connect my vb.net to internet...
thank you so much
|
|
|
|
|
hi guyz im trying to work with code searching using textbox and listview in vb.net as what i did in vb6
example: here's my data in listview
Apple
Orange
Grapes
in vb6, when im going to put something in textbox like "a" automatically the apple will be selected and highlighted and still my cursor is still in my textbox or lets just say, the focus is still in textbox
unlike in vb.net, here's my code:
Dim foundItem As ListViewItem = _
lvUser.FindItemWithText(searchBox.Text, True, 0, True)
If (foundItem IsNot Nothing) Then
lvUser.TopItem = foundItem
Else
MsgBox("No Record Found!")
End If
when im going to type like "a", nothings happen. it will not highlight the row as what ive expected. when im going to put like lvUser.Items(0).Selected = True, yes it will but the problem is the focus will be in the listview.. do you have any idea? thanks and God bless
|
|
|
|
|
You're assuming that the FindItemWithText method will show the item found. It doesn't. All it does is what it's name suggests, find and item and return it to your code, which BTW, your ignoring the returned item!
If you want to see that item in the ListView, you have to pass the returned item to the ListView EnsureVisible method.
|
|
|
|
|
I was looking at sorting some strings today and noticed that the default comparer orders them wrong -- it sorts "a" before "A", rather than after it, for instance.
So I looked into it and read up a bit and tried the InvariantCulture and the Ordinal comparer -- Ordinal works correctly, and I'll likely use it, but I'm not happy about it.
According to http://msdn.microsoft.com/en-us/library/dd465121.aspx[^]:
"Comparisons that use StringComparison.InvariantCulture and StringComparison.Ordinal work identically on ASCII strings."
Which is not strictly true -- they order these differently.
Does anyone here know how to make a Culture (based on en-US) that does a case-sensitive sort the right way?
Edit: This is interesting... I was experimenting with the System.StringComparer.CurrentCultureIgnoreCase and discovered that it seems to do what I want -- at least in the tests I've made. Which is good.
But that means that it doesn't actually ignore the case!
Scratch that -- it's just an artifact of how I was testing it.
modified on Friday, August 19, 2011 2:13 PM
|
|
|
|