|
Reading the documentation is always wonderful.
I would recommend rereading the MSDN entry on the Assembly object. From the docs:
Do not use LoadFile to load assemblies that you want to execute. LoadFile does not load files into the LoadFrom context, and does not resolve dependencies using the load path, as the LoadFrom method does.
LoadFile is strictly used to inspect an assembly on a file system. This is handy when you want to "look" but not actually run anything in an assembly. It does not load dependancies or do any other checking and hence is unreliable for execution.
|
|
|
|
|
1)how can i copy all element of 1 dataset to another dataset
2)i have an datagride in my form and it's a virtual dataset , how can i update it
|
|
|
|
|
Hello,
could anybody help me, please?
How do I do the P/Invoke of the following function (from TTNCom.lib of TomTom SDK)?
static INT GetSdkVersionInfoV01(TNavVersionInfoV01& aVersionInfo);<br />
<br />
struct TNavVersionInfoV01<br />
{<br />
char iVersion[16];<br />
INT iBuildNumber;<br />
};
I've tried:
[DllImport("TTNCom.dll", EntryPoint = "?GetNavigatorVersionInfoV01@CTomTomNavigatorCom@@SGHAAUTNavVersionInfoV01@1@@Z")]<br />
extern static int GetNavigatorVersionInfoV01(ref TNavVersionInfoV01 aVersionInfo);<br />
<br />
public struct TNavVersionInfoV01 <br />
{<br />
char[] iVersion;<br />
int iBuildNumber;<br />
}
but when calling it like:
TNavVersionInfoV01 nv = new TNavVersionInfoV01();<br />
<br />
int ShowTT = GetNavigatorVersionInfoV01(ref nv);
I get System.NotSupportedException.
There must be some problem with marshalling of types ...
Thanks anyway,
Honic
|
|
|
|
|
Hi!
Besides the fact that I don't know if your EntryPoint is correct (does it work if you leave out the EntryPoint parameter altogether?), you'll have to specify the size of iVersion for marshalling.
Right now you're just saying it's an array of char (without any size given), but the original declaration says it's a char[6] .
Try this struct declaration:
public struct TNavVersionInfoV01
{
[MarshalAs( UnmanagedType.ByValArray, SizeConst=6 )]
char[] iVersion;
int iBuildNumber;
} Regards,
mav
|
|
|
|
|
Hi,
the EntryPoint is correct, there is no problem. But I forgot to mention that it should work under Compact Framework and I'm affraid MarshalAs is not supported there.
Regards.
|
|
|
|
|
I have a right text box and i want to be able to insert a table and bullets into it. How ever i need to invoke the insert table dialog. Can any one please help me? And also ideas on how to invoke the bullets too.
thanks.
Nana
|
|
|
|
|
We have a voice xml interpreter that uses Xerces parser. The interpreter is developed in pure C++ using Visual C++. We wanted to replace the xerces parser with MSXML parser. We are also planning to recompile the vxml interpreter in the Dot Net platform. I have a couple of questions in this regard.
Question 1: If I choose the latest Dot Net platform that is "Visual Studio Dot Net 2003", what version of msxml parser does it support. What additional measures should I keep in mind when I replace xerces parser with msxml parser and recompile the whole vxml interpreter in the .Net platform?
Note that we dont want to change our interpreter code while shipping it in the Dot Net platform. Isthat possible?
Question 2: What will be the main effort area for replacing the xerces parser with the msxml parser.
Currently we are using SAX techinique, assume that we will also use SAX technique for the msxml parser.
S. Roy
|
|
|
|
|
This should probably have gone in the C++/CLI forum...but I'll answer it here.
Is there a reason that you want to use the MSXML parser? If you're compiling for .NET, then you may want to switch the parser to using the .NET Framework's System.Xml namespace. The System.Xml.XmlNodeReader or XmlTextReader objects will give you a SAX interface to the Xml that you've got. Or you could try the DOM interface with the XmlDocument object.
And no, your interpreter code doesn't need to be changed. You'll want to investigate Mixed Mode assemblies. This will enable you to run part of your code as MSIL on the .NET runtime and part of it in unmanaged/native mode.
The hardest part is just going to be getting used to the .NET platform. And maybe the funky syntax for the MC++ code.
Picture a huge catholic cathedral. In it there's many people, including a gregorian monk choir. You know, those who sing beautifully. Then they start singing, in latin, as they always do: "Ad hominem..."
-Jörgen Sigvardsson
|
|
|
|
|
Hello,
i'm using SendMessage winapi function in my program like this:
<br />
[DllImport("user32.dll", SetLastError=true, EntryPoint="SendMessage", CharSet=CharSet.Auto)]<br />
public static extern IntPtr SendMessage(<br />
IntPtr hWnd, <br />
[MarshalAs(UnmanagedType.U4)] int Msg, <br />
long wParam, <br />
int lParam);<br />
So i'm executing it and i want to use the returned value. But it seems that the returned value is a pointer. How can i get the value?
The code is like this:
<br />
IntPtr hWnd = FindWindow("Winamp v1.x", null);<br />
IntPtr lResult = SendMessage(hWnd, WM_WA_IPC, 0, IPC_GETEQDATA);<br />
-- modified at 9:38 Thursday 6th October, 2005
|
|
|
|
|
Hmm, may be the problem isn't in the returned type. But when i try this code in c++ it is working and the return value is correct, but in .NET i'm always receiving 20496
|
|
|
|
|
I found my problem. It is in the SendMessage declaration. The parameters should be IntPtr instead long and int:
<br />
[DllImport("user32.dll", SetLastError=true, EntryPoint="SendMessage", CharSet = CharSet.Auto)]<br />
public static extern IntPtr SendMessage(<br />
IntPtr hWnd, <br />
[MarshalAs(UnmanagedType.U4)] int Msg,<br />
IntPtr wParam,<br />
IntPtr lParam);<br />
|
|
|
|
|
Small correction:
You _can_ use int.
The only thing that was causing troubles was the long declaration, since longs in .NET are 8 byte and not 4 like WPARAM.
Oh, and the [MarshalAs...] declaration is superfluous, btw.
Regards,
mav
|
|
|
|
|
My application runs as a tray application. And I want it to be able to capture the play/pause, next and previous buttons on my Microsoft Natural Keyboard. Anybody have a suggestion on how to do this??
|
|
|
|
|
Hi guys
ArrayList objArrayList=new ArrayList();
objArrayList.Add("a");
we are adding values through Add property but i want to add value same as array so plz tell me how it is possible?
int[] onjAr=new int[]{1,2,3,4,5,6,7,8,9};
can i add value in this format e.g- {1,2,3,4,5,6,7,8,9}
|
|
|
|
|
The following should work:
ArrayList objArrayList = new ArrayList();
objArrayList.AddRange(new int[]{1,2,3,4,5,6,7,8,9});
www.troschuetz.de
|
|
|
|
|
how can i convert aspx pages to HtML pages. please help me out. if there is any tool available for that please let me know.
Amit Grover
Amit Grover
CDAC R&D
Gist Group
pune
|
|
|
|
|
Most browsers let you save the html code of a page.
If you need to do this programatically, use a WebRequest to get the pages, and just save the response string.
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
I'd like to execute a program from within my class; how can I do this ?!?
Regards,
Stefan
|
|
|
|
|
Take a look at the Process[^] class.
The easiest way to execute a program is using its static Start method:
Process.Start("IExplore.exe"); or
Process.Start("IExplore.exe", "www.northwindtraders.com");
www.troschuetz.de
|
|
|
|
|
Ok, danke!
|
|
|
|
|
http://www.codeproject.com/csharp/start_an_external_app.asp
Easy, isn't it?
Gruß
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Easy, but hard to find... Thx!
|
|
|
|
|
hello .
plze tell me how to get the target (source) of shortcut in c# code.
thanks.
|
|
|
|
|
The easiest way is to create a Runtime-Callable Wrapper (RCW) using tlbimp.exe from the .NET Framework SDK from shell32.dll. This contains the automation objects that you can use with managed code via the RCW.
To do this, run the following
tlbimp /out:Interop.Shell32.dll /namespace:Microsoft.Interop.Shell32.dll shell32.dll You can then write code similar to the following using the Folder , FolderItem and ShellLinkObject classes:
using System;
using System.IO;
using Microsoft.Interop.Shell32;
class ShellLink
{
const int ERROR_SUCCESS = 0;
const int ERROR_FILE_NOT_FOUND = 2;
const int ERROR_PATH_NOT_FOUND = 3;
const int ERROR_INVALID_PARAMETER = 87;
const string OUTPUT_FORMAT = "{0} -> {1}";
static int Main(string[] args)
{
string directory, name = null;
switch (args.Length)
{
case 0:
directory = Environment.CurrentDirectory;
break;
case 1:
directory = args[0];
if ((directory[0] == '/' || directory[0] == '-') &&
(directory[1] == '?' || directory[1] == 'h'))
{
Usage(Console.Out);
return ERROR_SUCCESS;
}
directory = Path.Combine(Environment.CurrentDirectory, directory);
break;
case 2:
directory = args[0];
name = args[1];
break;
default:
Console.Error.WriteLine("Error: invalid number of parameters.");
Usage(Console.Error);
return ERROR_INVALID_PARAMETER;
}
ShellClass shell = new ShellClass();
Folder folder = shell.NameSpace(directory);
if (folder != null)
{
if (name != null)
{
FolderItem item = folder.ParseName(name);
if (item != null)
{
DisplayLink(item);
}
else
{
Console.Error.WriteLine("Error: file not found.");
return ERROR_FILE_NOT_FOUND;
}
}
else
{
foreach (FolderItem item in folder.Items())
{
DisplayLink(item);
}
}
}
else
{
Console.Error.WriteLine("Error: directory not found.");
return ERROR_PATH_NOT_FOUND;
}
return ERROR_SUCCESS;
}
static void DisplayLink(FolderItem item)
{
IShellLinkDual link = null;
if (item != null)
{
if (item.IsLink)
{
link = (IShellLinkDual)item.GetLink;
if (link != null)
{
Console.WriteLine(OUTPUT_FORMAT, item.Name, link.Path);
}
}
}
}
static void Usage(TextWriter writer)
{
if (writer != null)
{
writer.WriteLine("Usage: {0} [directory [name]]",
Path.GetFileName(Environment.GetCommandLineArgs()[0]));
writer.WriteLine();
writer.WriteLine("\tdirectory Path to a directory.");
writer.WriteLine("\t If not specified, the current directory is used.");
writer.WriteLine("\tname The name of a single shell link.");
writer.WriteLine("\t If not specified, all links are displayed.");
}
}
}
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi all,
Here is the scenario i have 3 database table 1.lcsh 2.sub 3. terms
i need to write a select query which will fill datatable let say we get multiple record in that multi record i will take 1 value say lcshid from lcsh with this lcshid and again run another select query for database table 2.sub, we get multi rec and again taking 1 value from say nid from sub with this nid field again running another select query for datbase table 3.terms and finally select the fields which should be display in XSLT... this execrise is for mapping two fields this is my code snippet...
objTempNodes = objXml.SelectNodes("//dc:Subject",objNameSpaceMgr);
sData[5] = "";
foreach (Xml objNode in objTempNodes)
{
foreach(XmlAttribute ElementAttr in objNode.Attributes)
{
if (ElementAttr.Value=="dcterms:LCSH")
{
SubjectLCSH=objNode.InnerText;
if(SubjectLCSH.Trim()!="")
SubjectLCSH = RemoveDups(SubjectLCSH);
objNode.InnerText = SubjectLCSH;
}
if (ElementAttr.Value=="dcterms:DLTaxonomy")
{
try
{
//Select the record in db in LCSH Terms
SqlConnection conn = new SqlConnection();
conn.ConnectionString = new SqlConnection(Global.sConnectionString);
conn.Open();
sqlAdapter = new SqlDataAdapter();
sqlAdapter.SelectCommand = new SqlCommand();
SqlDataAdapter da = new SqlDataAdapter();
//Building the query for Selecting record From the SubjectTermsMapping
da = "Select " + ConfigurationSettings.AppSettings["connstrsubjmapping"] + " where DDC ='" + strDDC + "'";
sqldataset ds = new DataSet();
da.Fill(ds);
DataTable dt = ds.Tables[0];
}
catch
{
//SubjectDL = "Final Value";
//End Here
objNode.InnerText = SubjectDL;
}
finally
{
sData[5] = "NLBTerms:~LCSH:" + SubjectLCSH + "~DLTaxonomy:" + SubjectDL + "~SASH:";
}
}
}
suggest me how to do the above mention query i need to check the condition of each field ex:lcshid is avaiable r not if no then it should not move to next query...
Regards
ybasha
|
|
|
|
|