|
|
actually it's TypeConverter ( what makes it easier to find )
Thx for solution.
best regards,
David
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
|
I have a clean machine (WinXP)... I am running a .net app and its crashing however as I do not have vstudio intsalled - I don;t get a the crash message inside a debugger.
I know its cuase of version numbers etc - but I have no debugger installed and so when it does crash I don;t know what the files are missing / out of date version. i really do not want to install vstudio as it is no longer a clean machine... is there anyway to install the debugger without vstudio ... I just want the .net error message thats all. Will the .net sdk give me that.
Thanks
|
|
|
|
|
woodyuk wrote:
i really do not want to install vstudio as it is no longer a clean machine... is there anyway to install the debugger without vstudio
Never tried it myself but installing just the remote debugger on the target machine and using that should do the trick (see Setting Up Remote Debugging[^] and Remote Debugging Setup[^]).
Best regards
Dennis
|
|
|
|
|
Hi,
I would like to get an PDIL from a file path, but i am not sure which api funciton i have to call. Currently i use the Shell32 Com Interop, but my IShellFolder (Folder2, Folder3)class has no PDIL property.
Does anyone have some sample code?
myMsg.BehindDaKeys = "Jerry Maguire";
|
|
|
|
|
Get the what?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
SHGetFolderLocation to retrieve the folder's PIDL...
PIDL:
Address of a pointer to an item identifier list structure specifying the folder's location relative to the root of the namespace (the desktop).
Everything i have is the path of a file, but to proceed with my task i need the Shell32 PIDL of the file.
I'm a little bit confused too, that's why i asked the question
myMsg.BehindDaKeys = "Jerry Maguire";
|
|
|
|
|
Jerry Maguire wrote:
SHGetFolderLocation to retrieve the folder's PIDL...
Try the following:
[DllImport("shell32.dll")]
static extern int SHGetFolderLocation(IntPtr hwndOwner, int nFolder,
IntPtr hToken, uint dwReserved, IntPtr ppidl);
- Nick Parker My Blog | My Articles
|
|
|
|
|
int test;
Type sometype = test.GetType();
By calling this I get the type property with the datatype System.Type
Is it possible to create an Array containing all Possible System.Type Properties?
|
|
|
|
|
|
Hello everyone
I have a singleton application which works fine, sets focus to it's self if executed while still open.
Now the client wishes for this application to also be executed by a scheduled task.
Now I have the singleton working fine, and it recognises multiple instances, easy.
What I cannot get to work, is if the application is already loaded, I want to execute a public function within the main form.
This is what I have, but this fails on .Show()
private static Mutex AppMutex = new Mutex(true, "Form1");
[STAThread]
static void Main()
{
if(AppMutex.WaitOne(0, false))
{
Application.Run(new Form1());
AppMutex.ReleaseMutex();
}
else
{
Form1 _form = new Form1();
_form = (Form1) Form1.FromHandle(AppMutex.Handle);
_form.Show();
_form.Start(); // My Own Function I wish To Execute
MessageBox.Show("Already Loaded");
}
}
Thanks in advance
|
|
|
|
|
Of course the Form1 (okay, I won't comment on your choice of clas name ("Must. Control. Fist-of-death!")) you are creating is not the same instance as the one already running.
What you really want to do is simply post a custom windows message to the instance that is running, using PostMessage(), requesting it to do the operation you desire.
Matt Gerrans
|
|
|
|
|
Thanks Matt
Do you have an example or link to an example on how to do this?
BTW, I just used Form1 in a throw together, mock up application, to try to get this going
Thank you for your help
|
|
|
|
|
Sorry about the lengthy response time, but I got ravaged by some kind of stomach virus over the last few days.
Anyway, there is a Code Project article How to send a user-defined message with SendMessage, PostMessage or PostThreadMessage[^], by Georg Bedenk that I haven't read, so I'll give you a very brief description and assume that the article contains more detailed explanations, if you are interested in reading more.
Essentially, you need to define your own message, which is an integer value that won't conflict with existing Windows messages. You'll need to be able to call PostMessage() or SendMessages() Windows APIs (there may be a .NET library call for this -- Heath?) to send that message to another instance of your app. Your app will have to watch for that message and do whatever you want when it gets it (note that you could have multiple messages, or make use of lparam and wparam to get lots of different behaviors).
Here are all the chunks of code you'll need in your main form's class (which I called FormMain below), with some comments:
const int WM_APP = 0x8000;
const int WM_DO_SOMETHING_MAN = WM_APP + 1;
[DllImport("User32.Dll")]
private static extern System.Int32 PostMessage(int hwnd, int msg, int lparam, int wparam);
private static Mutex AppMutex = new Mutex(true, "TestApp");
public FormMain()
{
InitializeComponent();
SetStyle( ControlStyles.EnableNotifyMessage, true );
}
[STAThread]
static void Main()
{
if(AppMutex.WaitOne(0, false))
{
Application.Run(new FormMain());
AppMutex.ReleaseMutex();
}
else
{
Process thisProcess = Process.GetCurrentProcess();
Process [] allProcesses = System.Diagnostics.Process.GetProcesses();
foreach( Process process in allProcesses )
{
if( process.MainModule.FileName == Application.ExecutablePath )
{
if(process.Id != thisProcess.Id)
{
int hwnd = process.MainWindowHandle.ToInt32();
PostMessage( hwnd, WM_DO_SOMETHING_MAN, 0, 0 );
break;
}
}
}
}
}
protected override void OnNotifyMessage(Message m)
{
if( m.Msg == WM_DO_SOMETHING_MAN )
DoSomethingClever();
}
About the corner case bug mentioned above, there are a number of things you could do to make it more ironclad, if that is necessary. ...Actually, come to think of it, only "the one" instance that should get the messages from the stubs (all the Johnny-come-latelies that couldn't get the mutex) should have a non-zero MainWindowHandle, so adding that check may do the trick.
Anyway, you've got the gist of it and can proceed with the fine-tuning as you like.
(By the way, I had done this in C/C++ before, but not in C# or .NET before this).
Matt Gerrans
|
|
|
|
|
Mate you are a true champion!
Works a treat
Thank you so much!, If your ever in OZ, let me know, I owe you a few beers!
|
|
|
|
|
Okay, it's a deal. I wouldn't mind tossing my bike on a plane and cycling around that continent for a few weeks some time. And of course, the best fuel for that is
Matt Gerrans
|
|
|
|
|
LOL, well I can supply the , but you'll need a bit more than a few weeks to cycle around Australia, all of Western Europe fits in to Queensland, one of our 7 states/territories
BTW: The application works a treat now
|
|
|
|
|
hi
when you right click on a file we know that property page for file
appeares . ther is "Type of file" that i need to get it from my
code for any type of file.
What should i do plz?
|
|
|
|
|
I dont know the exact solution but I guess ,
you may manipulate the needed data by Using System.IO.FileInfo library
you may use the method
Path.GetExtension(), would be a solution..
|
|
|
|
|
hi,
this may be tricky bt if it's Windows system... do you know how registry works? "Type of file" is stored in H_KEY_CLASSES ... Actually there are both extentions (say ".txt") and file classes (say "txtfile"). under ".txt" key is name of file class. In file class there are subkeys describing icon, context menu, description... There is Type of file: "Text Document" stored.
Ugly... I know.. Probably switch for extentions will be enough
if not search MSDN for Registry; File Types; etc
best regards,
David 'DNH' Nohejl
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
Its not ugly unless you are only going to list the items.. and you dont want to deal with windows
By the way, the first code that I wrote down, is for a given path...
But if you want to search all items in a directory and get all the types , the following code will be sufficient..
and dont forget to add using System.File
<br />
string[] files = Directory.GetFiles(workingDirectory);<br />
<br />
foreach (string s in files)<br />
{<br />
FileInfo fi = new FileInfo(s);<br />
fi.Extension
I dont know anything about the above coding sample , but I searched a little bit , and I remembered FileInfo , and the following article ("CrytoSave"-chech it out), made the message constructed Thats the reason why I love CP
|
|
|
|
|
Bahadir Cambel wrote:
ts not ugly unless you are only going to list the items.. and you dont want to deal with windows
well, MY solution is ugly (as whole registry thing) and I stand my ground (or how it is this idiom). I didn't mean your code- it's ok afer all.
Yes he may want to know only file type... in this case your code is ok (and mine is useless - and vice versa).
Bt if he wants to get longer description of file type (how it's called on targer system - e.g .bmp may be called "bitmap file" as well as "PSP Image file" if PaintShopPro program is installed - cuz it modifies registry), then my way is way to go. AFIAK FileInfo doesn't contain this information. I did quick search at MSDN its possible I overlooked it bt again, I don't think so. (One reason - it may be Windows specific feature).
Bahadir Cambel wrote:
Thats the reason why I love CP
yeah, I love CP as well!
David
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
I know You used the "ugly" word for your registry thing..not my simple code
But as you said we didnt know what he/she wants..So lets consider the simple solution , if unsuffient , hurrahhh to the windows registriess ( Oh nooo!! )
|
|
|
|
|
I read my client configuration from a config file, and it opened my channel sucefully. But, I still have to pass my url string at Activator.GetObject... well, I want to call my activator.getobject without to pass the url or get the url dinamically with channelservices.
PS: My object isn't know at client side, so I can't do just a MyObj o = new MyObj(); I need to do something like this
MyObj o = (IObj)Activator.GetObject(typeof(IObj),"tcp://localhost:9999/MyObj"); but without this url. I want to use the channel that is already opened by RemotingConfiguration.Configure(file).
Thanks so much
Wender Oliveira
.NET Programmer
|
|
|
|