|
Thanks
|
|
|
|
|
That could be the infamous "Form not closing"-bug that's caused by child controls being removed from the form while they have focus.
Are you removing controls from your form at run-time?
That could be the problem.
In that case try setting the focus to a control remaining on the form before removing the other one.
Regards,
mav
|
|
|
|
|
I'm currently working on a project using a third-party tool. All of the data I'm working with is handled via MemoryStream for the most part, and in most cases need never be written to disk. (Completed document is streamed to the browser, then the stream discarded.)
Unfortunately, the 3rd-party tool I'm using only operates on files (both input and output.) I'd like to avoid having temp files everywhere if at all possible.
Is there any way through .Net that I can create an old-fashioned RAM disk to do this processing on? It'd be even better if there were a way to have a FAT record point to a memory buffer that already exists instead of having to actually duplicate the data on the RAM disk, but even that's preferable to actual disk I/O.
Thanks for whatever pointers anyone can give me.
(BTW, for those who're interested, or if it makes a difference, the 3rd-party tool I'm working with is GhostScript.)
Grim (aka Toby) MCDBA, MCSD, MCP+SB
SELECT * FROM user WHERE clue IS NOT NULL
GO
(0 row(s) affected)
|
|
|
|
|
Not the answer you're directly looking for, but GhostScript is open source, so one solution would be to hack into GS the ability to read your data directly from RAM
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
True, but I'm on a short timeline, which is the main reason I'm using 3rd-party tools in the first place.
We had found a few 3rd-party solutions for doing what we actually need from ghostscript, but they all have their own problems. In some cases, they can't even render the PDF properly. That's the only reason I'm even looking at anything as low-level as Ghostscript.
Grim (aka Toby) MCDBA, MCSD, MCP+SB
SELECT * FROM user WHERE clue IS NOT NULL
GO
(0 row(s) affected)
|
|
|
|
|
Hi
I want to write a little Tool in c# that is scanning
the Network and list all founded Computers.. I think
I should use WMI. But I don't know how to scan te Network.
Can anybody help?
Greetings from Germany
|
|
|
|
|
Use NetServerEnum() API to get the list. Here is the complete code:
<code>using System;
using System.Net;
using System.Runtime.InteropServices;
namespace EnumDomainMachines
{
class AppClass
{
[STAThread]
static void Main(string[] args)
{
NetMachinesEnum NetMachinesEnumurator = new NetMachinesEnum();
NetMachinesEnumurator.PrintList();
Console.ReadLine();
}
}
class NetMachinesEnum
{
// server types accepted by the NetServerEnum function
public enum SV_101_TYPES:uint
{
SV_TYPE_WORKSTATION= 0x00000001,
SV_TYPE_SERVER= 0x00000002,
SV_TYPE_SQLSERVER = 0x00000004,
SV_TYPE_DOMAIN_CTRL= 0x00000008,
SV_TYPE_DOMAIN_BAKCTRL= 0x00000010,
SV_TYPE_TIME_SOURCE= 0x00000020,
SV_TYPE_AFP= 0x00000040,
SV_TYPE_NOVELL= 0x00000080,
SV_TYPE_DOMAIN_MEMBER = 0x00000100,
SV_TYPE_PRINTQ_SERVER = 0x00000200,
SV_TYPE_DIALIN_SERVER = 0x00000400,
SV_TYPE_XENIX_SERVER = 0x00000800,
SV_TYPE_SERVER_UNIX= SV_TYPE_XENIX_SERVER,
SV_TYPE_NT= 0x00001000,
SV_TYPE_WFW= 0x00002000,
SV_TYPE_SERVER_MFPN= 0x00004000,
SV_TYPE_SERVER_NT = 0x00008000,
SV_TYPE_POTENTIAL_BROWSER = 0x00010000,
SV_TYPE_BACKUP_BROWSER= 0x00020000,
SV_TYPE_MASTER_BROWSER= 0x00040000,
SV_TYPE_DOMAIN_MASTER = 0x00080000,
SV_TYPE_SERVER_OSF= 0x00100000,
SV_TYPE_SERVER_VMS= 0x00200000,
SV_TYPE_WINDOWS= 0x00400000, SV_TYPE_DFS= 0x00800000, SV_TYPE_CLUSTER_NT= 0x01000000, SV_TYPE_TERMINALSERVER= 0x02000000, SV_TYPE_CLUSTER_VS_NT = 0x04000000, SV_TYPE_DCE= 0x10000000, SV_TYPE_ALTERNATE_XPORT= 0x20000000, SV_TYPE_LOCAL_LIST_ONLY= 0x40000000, SV_TYPE_DOMAIN_ENUM= 0x80000000,
SV_TYPE_ALL= 0xFFFFFFFF
};
// Server info function, returned by the NetServerEnum function
[StructLayout(LayoutKind.Sequential)]
public struct SERVER_INFO_101
{
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.U4)]
public UInt32 sv101_platform_id;
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]
public string sv101_name;
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.U4)] public UInt32 sv101_version_major;
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.U4)] public UInt32 sv101_version_minor;
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.U4)] public UInt32 sv101_type;
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)] public string sv101_comment;
};
public enum PLATFORM_ID
{
PLATFORM_ID_DOS = 300,
PLATFORM_ID_OS2 = 400,
PLATFORM_ID_NT = 500,
PLATFORM_ID_OSF = 600,
PLATFORM_ID_VMS = 700
};
// constants
public const uint ERROR_SUCCESS = 0;
public const uint ERROR_MORE_DATA = 234;
// System functions
// Imported from the NET api (See MSDN for more details)
[DllImport("netapi32.dll",EntryPoint="NetServerEnum")]
public static extern int NetServerEnum( [MarshalAs(UnmanagedType.LPWStr)]string servername,
int level,
out IntPtr bufptr,
int prefmaxlen,
ref int entriesread,
ref int totalentries,
SV_101_TYPES servertype,
[MarshalAs(UnmanagedType.LPWStr)]string domain,
int resume_handle);
[DllImport("netapi32.dll",EntryPoint="NetApiBufferFree")]
public static extern int
NetApiBufferFree(IntPtr buffer);
[DllImport ("Netapi32", CharSet=CharSet.Unicode)]
public static extern int NetMessageBufferSend(
string servername,
string msgname,
string fromname,
string buf,
int buflen);
public string GetIPAddress(string sHostName)
{
try
{
IPHostEntry ipEntry = Dns.GetHostByName(sHostName);
IPAddress [] addr = ipEntry.AddressList;
string sIPAddress = addr[0].ToString();
return sIPAddress;
}
catch
{
return("Unknown");
}
}
public void PrintList()
{
int entriesread=0,totalentries=0;
do
{
// Buffer to store the available servers
// Filled by the NetServerEnum function
IntPtr buf = new IntPtr();
// Server structure
SERVER_INFO_101 server;
// call NetServerEnum function. The '101' defines the type of
// structure returned, in this case, SERVER_INFO_101 which contains
// the type of information we need. In the preferred max length parameter
// '-1' is passed to tell the function to allocate the necessary amount of
// memory for the data. The SV_TYPE_WORKSTATION tells the function to only
// return workstation type servers.
int ret = NetServerEnum(null,101,out buf,-1,
ref entriesread,ref totalentries,
SV_101_TYPES.SV_TYPE_ALL,null,0);
// if the function returned any data, fill the tree view
if( ret == ERROR_SUCCESS ||
ret == ERROR_MORE_DATA ||
entriesread > 0)
{
Int32 ptr = buf.ToInt32();
Console.WriteLine("--------------------------------------------------------------------------");
Console.WriteLine(string.Format("{0,15} {1,17} {2,15} {3} {4} {5}",
"PLATFORM_ID",
"IP_ADDR",
"SERVER_TYPE",
"V",
"NO",
"COMMENT"));
Console.WriteLine("--------------------------------------------------------------------------");
for(int i=0; i<entriesread; i++)
{
// cast the pointer to a SERVER_INFO_101 structure
server = (SERVER_INFO_101)Marshal.PtrToStructure(new IntPtr(ptr),typeof(SERVER_INFO_101));
ptr += Marshal.SizeOf(server);
// add the workstation name to the tree view
Console.WriteLine(string.Format("{0,15} {1,17} {2,15} v{3}.{4} ({5})",
server.sv101_name.ToLower(),
GetIPAddress(server.sv101_name),
(PLATFORM_ID)server.sv101_platform_id,
server.sv101_version_major,
server.sv101_version_minor,
server.sv101_comment));
}
Console.WriteLine("--------------------------------------------------------------------------");
}
else
{
// no servers found
Console.WriteLine("No servers found in network");
}
// free the buffer
NetApiBufferFree(buf);
} while(
entriesread < totalentries &&
entriesread != 0
);
}
}
}
</code>
|
|
|
|
|
Hi Salil
Thank you for your reply! I'm really glad to get something
that I'm looking for a long time. But I get some Syntax Errors
when I try to compile your code. I don't want to change something.
for(int i=0; i **** ; expected******
{ **** invalid expression term'{' *****
Do you got the same Problems??
Regards
|
|
|
|
|
Oops since the code had special characters it got garbled. I have mosified the post above, copy-paste the code again. Or see this correction:
<code>for(int i=0; i<entriesread; i++)</code>
Anyways, the code is perfectly working. But if you still get more errors, treat it as an indicative code and build your logic on top of it... The basic idea is to use the NetServerEnum()API I described in earlier post.
If you can't make it work, I am writing a utility for a friend, which scans the network and gives hardware info report, but that will be ready next week. Ping me around next Friday.
|
|
|
|
|
No way to set the Datagrid Columns width in C# for Pocket PC by code. Can you please help me? Thanks
Gianni
|
|
|
|
|
Hello, just look this class.
public class MyClass : ArrayList
{
public MyClass ()
{}
public override int Add(object value)
{
return base.Add (value);
}
}
right, how to hide this method or make it private?
I don't want to see this method at intelisense when I call MyClass methods and properties.
tkx
Wender Oliveira
.NET Programmer
|
|
|
|
|
I don't think there is any way to hide the method in the manner you describe, and since it is a virtual method of the base (ArrayList) class, there's not really a way to obscure it - the accessibility of public virtual members can't be altered by the inheriting class.
The framework doesn't allow partial implementation inheritance. You could, however, change the behavior of your overridden version of the Add method to keep it from doing anything.
Perhaps a better option might be to create a new class that employs an ArrayList as a private field. You would then be free to manipulate the contents of the ArrayList at your discretion. Of course you lose some polymorphic benefits by doing so. You could also create a new Collection-type class (Add is not a member of the ICollection interface).
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
As far as I'm aware, it isn't possible to hide a public method inherited from a class lower in the hierarchy.
I'm not sure if the ArrayList as a base class was just for example purposes, but have you looked at derriving from System.Collections.CollectionBase instead? If the CollectionBase still exposes the method that you'd like to hide, the other solution that comes to mind would be to use the ArrayList as a private member of your class and simply wrapper the properties/methods that you'd like to expose.
Hope that helps.
--Jesse
|
|
|
|
|
Maybe EditorBrowsableAttribute can help you. It can be use to hide a member of a class from IntelliSense.
int ageval;
[EditorBrowsable(EditorBrowsableState.Never)]
public int Age
{
get { return ageval; }
set
{
if (!ageval.Equals(value))
{
ageval = value;
}
}
}
Daniel.
|
|
|
|
|
..please forgive me if my question sounds a bit basic but I am a newbie. One of the projects I've been tasked with is building a web based application that will be able to create questionnaires\surveys. This application will have various controls such as stop, start, address section, radio buttons, tickboxes, conditional boxes\sections etc.... Ideally the end user will be able to choose an element such as name, surname and date of birth as questions in the questionnaire. The user will then choose to release a version of this survey to a webserver where respondants will be able to answer the questions for the data to be collected. The main thinking behind this is that there are non technical staff that need to be able to create surveys\questionnaires without the need for in depth knowlegde of vb script or html, but an application with drag and drop or a point and click functionality would be more efficient. Is there any source code or sample available that could guide me through this? What is the best way to approach this? I have seen one approach where the application in question uses the required controls\objects to create an xml file that is uploaded to the web server which somehow translates the xml file into a set of functional web pages that collect all this data to an sql database. How difficult would that be to do? The name of the application that does this similar thing is called easyqd here is the website http://www.easyqd.com/
whether you believe you can or you can't you will be right
|
|
|
|
|
Is it possible to open a child window within an MDI and call some native windows method to run a program within the child window? I am wondering if we can run our legacy application within a window of the correct size but let the legacy application think it is in its own process space.
Is this possible?
JB
|
|
|
|
|
Hi all,
Does anyone how can I creat a mapfile for my c# project?
For c++ project it's very easy.
You can do it from Project Settings,
just need to set generation of mapfile in Link Tab.
How can I do the same for c#?
Thanks in advance,
Anna.
|
|
|
|
|
Hi all,
Does anyone how can I creat a mapfile for my c# project?
For c++ project it's very easy.
You can do it from Project Settings,
just need to set generation of mapfile in Link Tab.
How can I do the same for c#?
Thanks in advance,
Anna.
|
|
|
|
|
Hi all,
Does anyone how can I creat a mapfile for my c# project?
For c++ project it's very easy.
You can do it from Project Settings,
just need to set generation of mapfile in Link Tab.
How can I do the same for c#?
Thanks in advance,
Anna.
Anna.
|
|
|
|
|
currently, i am developing windows CE .NET application, i faced a problem which is that i am unable to display arabic charater in my application. the output is in ambiguous letters.
can anyone provide me with a working application that solves the propose problem
asmb1980
|
|
|
|
|
I'm working on a VS Add-in, and I'm not sure if what I'd like to do is possible.
By Default the VS Add-in wizard adds a menu command to the Tools menu. Is it possible to add an additional sub-menu/control(s) to this command menu item ?
I'd like to create a Drop down list control that I could populate at run-time or even just a series of sub-command control originating from the default menu item added to the Tools menu.
Any suggestions to get me started or code examples would be great.
thanks.
|
|
|
|
|
Hi,
I have a UserControl that contains a Panel in it.
I add the UserControl to a Form.
I want (at design time) to be able to add, remove, move ,etc, controls on the Panel contained in my UserControl in the same way i would do this if the Panel was placed directly on a Form.
Any Ideas?
Thanks!
|
|
|
|
|
Hi all,
I´m writing a code where I have to serialize an undefined number of objects and need to save all data in a single file. I have created a class to do the task of mapping these objects in the file such a way I can insert and retrieve an object using an identifier. But to finnish this task, I still need some way to know the size in bytes of the objects being serialized to keep track of entries in the file.
Can someone help me? is there some way to get this information from Runtime.Serialization?
I´m using BinaryFormatter.
thanks,
|
|
|
|
|
When you serialize your objects, just check the length of the serialization stream:
Hashtable table = new Hashtable();<br />
table.Add(1, "One");<br />
table.Add(2, "Two");<br />
table.Add(3, "Three");<br />
<br />
BinaryFormatter formatter = new BinaryFormatter();<br />
MemoryStream stream = new MemoryStream();<br />
formatter.Serialize(stream, table);<br />
<br />
long size = stream.Length;
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
turbochimp,
It worked fine. thank you.
|
|
|
|
|