|
I think reflection is not capable of getting information about the inside of a method. I need t know which classes' methods are called by a method. I want to create a call/use graph from a software (can be from source code).
|
|
|
|
|
|
Ok, I'm missing something fundamental here - I know it. Would one of you gurus be so kind as to point out my error, please.
I have a class Called ProcessInfo in the namespace Mycompany.Project that is used to store custom process information...
namespace MyCompany.Project
{
public class ProcessInfo
{
private string m_sStatus;
.
.
.
}
}
This class is used in two projects. Project A is a dll that uses the same (MyCompany.Project) namespace. Project B is an exe also uses the same namespace.
Project B dynamically loads and invokes the Project A dll. Project B passes an instance of an ArrayList to Project A, who adds instances of the ProcessInfo class to the ArrayList. Project B attempts to loop through the ArrayList to access the ProcessInfo instances as follows:
private void SomeFunction()
{
foreach (ProcessInfo oInfo in oArrayList)
{
.
.
.
}
}
I always get invalid cast exceptions on the foreach line. The debugger correctly show the oArrayList as containing instances of type {MyCompany.Project.ProcessInfo} and the contents of the individual ArrayList entries can be read (in the debugger).
What am I missing? I've tried various permutations of the above code - including fully qualifying the namespace, using IEnumerator, etc...
I have searched MSDN, but have had little luck specifying the correct query to find answers.
I would very much appreciate any help in solving this. I thank you in advance.
Peff
|
|
|
|
|
I want to retrieve the VID and PID of usb device,such as mp3 and u-disk.I know how to enum the device infomation by using some of windows API step by step.I just do not know how to define the GUID structure,how to pass the GUID as a parameter to the api,such as SetupDiGetClassDevs(),and especially how to marshal the type of those parameters.
Can you give me an detail example in C#?
|
|
|
|
|
Hi guys
Is there any way that I can set the small/large imagelists for a ListView control to the handle of the system's standard image list?
I know I can use SHGetFileInfo() function for retreiving the system image list, but how do I set it to ListView.SmallImageList? (ie. ListView.SmallImageList.Handle is READ-ONLY)
Any pointers would be appreciated
Thanks
|
|
|
|
|
Hi,
I'm trying to implement cd burning capabilities in my application with the open source console application cdrdao[^].
I'd like to run this application in the background (hidden from the user), but return all the status information "on the fly" to the user. That is, before cdrdao has terminated burning the cd.
How can I monitor what this console application is writing to the console? Also, would it be possible to simulate keystrokes in the console application, but from my code? For example, if the user clicks the Cancel button, I'd like to send a CTRL-BREAK to the console app.
Thanks!
Carl
|
|
|
|
|
Carl,
You might want to look at the System.Diagnostics.ProcessStartInfo class. The ProcessStartInfo class allows the redirecting of the standard output so that the calling application can read it. For example:
{
.
.
.
Process oProcess = new Process();
string sData;
oProcess.StartInfo.FileName = "cdrao.exe";
oProcess.StartInfo.Arguments = "-whatever";
oProcess.StartInfo.RedirectStandardOutput = true;
oProcess.StartInfo.CreateNoWindow = true;
oProcess.StartInfo.UseShellExecute = false;
oProcess.Start();
while (some condition)
{
sData = oProcess.StandardOutput.ReadToEnd();
.
.
}
I'm not sure about sending keystrokes. I know the SendKeys class will send keystrokes, but I believe it only sends them to the current app.
Hope this helps.
|
|
|
|
|
That will only work when the console app exits right? If that's the case, that's not what I want since I need to return feedback to the user while the cd is burning (especially since this can be a long process!)
Thanks!
Carl
|
|
|
|
|
Hi,
Here's some code I tried. However, the output isn't redirected to my app. If I make it open a standard console window, I can see the output on the screen (in the console window).
Process oProcess = new Process();<br />
oProcess.StartInfo.FileName = @"C:\Program Files\cdrdao\cdrdao.exe";<br />
oProcess.StartInfo.Arguments = "scanbus";<br />
oProcess.StartInfo.RedirectStandardOutput = true;<br />
oProcess.StartInfo.CreateNoWindow = true;<br />
oProcess.StartInfo.UseShellExecute = false;<br />
oProcess.Start();<br />
<br />
while (!oProcess.HasExited)<br />
{<br />
if (oProcess.StandardOutput.Peek() == -1)<br />
{<br />
System.Threading.Thread.Sleep(50);<br />
}<br />
else<br />
{<br />
char[] myOutput = new char[32];<br />
int nRead = oProcess.StandardOutput.Read(myOutput, 0, 32);<br />
if (nRead > 0)<br />
{<br />
textBox1.Text += myOutput;<br />
}<br />
}<br />
}
Any idea? I'm also interrested in knowing how to send key strokes to the console, for whoever reads this
Thanks!
|
|
|
|
|
I'm having massive difficulty trying to print weekly reports in the following way:
I have a report generated for a month, May for aregument sake. I want the data in the report broken up into 4/5 weeks, not simply flowing though the month. In other words:
Week 1:
data
data
data
Week 2:
data
data
data
Week 3:
data
data
data
Week 4:
data
data
data
Each set of data has a full DateTime variable with it. I've managed to get a week number from each date - but they're in relation to the year, not the month.
Any ideas?
|
|
|
|
|
I think you can just substract the week number u got,
with the last month week number.
This is a simple example (mm/dd/yy is the date format):
select convert(numeric(3,0), datename(ww, '02/24/2004')) - convert(numeric(3,0), datename(ww, '01/31/2004'))
The query will give u the week number relate to the month for 24th Feb 2004.
Hope this can help u,
|
|
|
|
|
Hi,
Can I actually disable alt-tab key combination, and windows key.
So the computer always stay focus on the application.
If it's possible, does anyone know how to do it?
Thank you very much in advance.
Anton
|
|
|
|
|
I don't know of a pragmatic solution, but you could try installing I Hate This Key[^] which lets you disable keys
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
Thank you very much for the suggestion, but I need to disable alt-tab or windows key programmatically.
|
|
|
|
|
Thank you very much for the suggestion, but I need to disable alt-tab or windows key programmatically.
|
|
|
|
|
Hello I am working on a gamma adjustment program in c# and I have imported the gdi32.dll file as follows,
[DllImport("gdi32.dll")]
and have then declared getDeviceGammaRamp with
private static extern bool getDeviceGammaRamp(HDC hDC, LPVOID lpRamp);
But I get errors such as HDC could not be found etc. I have tried reading up on threads such as creating screenshots for some help as they are similar in nature to my program. I can't seem to get things going.
Could somebody please explain to me how import getDeviceGammaRamp and setDeviceGammaRamp correctly in c# to adjust gamma or possibly write a small tute just like the create screenshot bitmaps one except on how to adjust monitor gamma?
Thanks for your time people
|
|
|
|
|
You need to "translate" the Win32 data types, HDC & LPVOID, into CLR data types. You can use the System.IntPtr type in both cases.
private static extern bool GetDeviceGammaRamp(IntPtr hDC, IntPtr lpRamp)
Hope this helps!
Paul Lyons, CCPL Certified Code Project Lurker
|
|
|
|
|
Hi!Paul,
Thank you very much! It do me a big favour^_^
Thank you again!!!
Best regards!
momer
|
|
|
|
|
Yes thank you for the help Paul, now I just need to convert some c++ classes to c#. It is harder than I expected.
If somebody could write up a tutorial on gdi32 and setting gamma in c# then this would help me out alot, it seems that there is almost nothing on the subect at all.
I have been searching for days
|
|
|
|
|
I wanna this happen:Within a TabControl,when I click the "OK" button on the
tabpage "OPTIONS",it automatically turn into the
tabpage "SETTINGREPORT". In other words,when I click the "OK" button on one tabpage it automatically turn into another tabpage in the same TabControl.
What code should I write with C#?
|
|
|
|
|
momer wrote:
What code should I write with C#?
If you know the index value of the tab page, you can simple use the SelectedIndex property of the TabControl . If your clicking a button, your code might look something like this:
private void button_Click(object sender, System.EventArgs e)
{
this.tabControl1.SelectedIndex = 3;
}
- Nick Parker My Blog | My Articles
|
|
|
|
|
Im creating a custom control ,which has no gui but only functionalities , i want this control to be displayed in the bar below the form designer (vs.net 2003) just like menu or OpenFileDialog do (right now its displayed like a blank square on the form)
How could I accomplish this? (A [ ] tag for vs.net ide?)
Any link with info or direct answer will be greatly appreciated.
|
|
|
|
|
you should create a "component" not a "control"
components go in the component tray below the form designer.
easiest is to add a class an just inherit from system.componentmodel.component
//Roger
|
|
|
|
|
I'm working with VS.NET 2003 and .NET 1.1 (not SP1) on Windows XP SP1. My application is using the Windows Installer Bootstrap. (I may have also installed a module which detects requirements (.NET 1.1 -> MsiNetAssembly Support.) I have a few issues and questions regarding the MSI and its properties.
* This may be my biggest annoyance at the moment. When the installer creates the target directory, it's setting them as read-only. When the application is uninstalled, the target directory is not deleted, although it's empty. I presume this is because the target directory is read-only and the installer doesn't try to force the removal, but I'm not positive. Why is this happening, anyway, and how can I correct it. I'm not certain if this has always been a problem for me with this project, but it's also not a recently new problem.
* When the user opts to install for "Everyone," I need to modify the registry for all users. I'm not sure there's a reasonable way to do this within VS.NET's IDE (or otherwise?). The User/Machine Hive is an alias for HKLM when "Everyone" is selected, so that's no help. HKEY_USERS only seems useful (ever) for setting within the .DEFAULT tree, but that doesn't handle current users. I've seen a reference to HKEY_PER_USER, which seems like what I'd want, but I don't know how to access it, and there's almost zero documentation online, so maybe it's vaporware. I suppose I could handle this programmatically, in a custom action, but it seems like a common enough need, and I'd rather have the installer handle as much as possible, anyhow! Plus, how can the custom action know that it's supposed to set keys for all users? Can the custom actions access the MSI's runtime properties?
* For that matter, I'm not sure there's a good way for users' configurations to be retained during an upgrade, and possibly my real problem here is that I have RemovePreviousVersions set to True. But if an installer is supposed to remove its files and registry keys it created, and if the installer is supposed to first uninstall previous versions (which makes sense in my case), then how are previous configurations supposed to migrate forward?
* There doesn't seem to be a good way for defining deployment projects in terms of solution configurations. For instance, I can configure the project within a certain solution configuration (e.g. Debug) to add some conditional compilation constants (e.g. TRACE, DEBUG), and I can use those constants in my code within #if blocks. How can I do something similar within a deployment project? One solution I've heard is to create a different deployment project for each solution configuration that has its own needs. That seems like a management nightmare beyond the simple case!
Thanks for any comments or answers you might provide.
Arun
|
|
|
|
|
Ok, here's the deal. I have an Active-X control on a form. I call a function off that control and get an object. This object I get does NOT have a typelib that I can create a RCW from, but I do know that functions and properties it has.
So, right now I created a class that just thunks down using the InvokeMethod stuff. However, I'd like to use standard .NET interfaces instead. The problem is that I can't seem to get the object to cast to the interface, nor do I know the GUID for the object.
Is there any way of forcing the COM object to route thru a interface I've created?
Thanks.
--
Joel Lucsy
|
|
|
|