|
if I have a main program named Program.cs and a dynamically loaded dll named bot.dll how can I call methods in Program.cs.
please help me cause I want to create a programming game if anyone has a sample please reply
thank you in advance!
|
|
|
|
|
I want to call methods in program.cs from bot.dll
|
|
|
|
|
I guess It's like the same as including methods from the user32.dll:
[DllImport("user32.dll", EntryPoint = "SendMessage", CharSet = CharSet.Auto, CallingConvention = CallingConvention.Winapi)]
private static extern int SendMessage(IntPtr hWnd, int uMsg, int wParam, IntPtr lParam);
|
|
|
|
|
I created a own datatype called ID. Now I want to have a function which converts a string into an ID. So I thought it would be the best to kind of append a method to the System.Convert class, so that I can simply call it with Convert.ToID("somewhat");
Is that possible?
P.S.: Sorry for asking so much ^^
|
|
|
|
|
See MSDN[^]. This should be what you are looking for.. Changes in .NET classes are possible, bt I don't like this idea (in this case). Why not to make static function ID.FromString(string s) ?
And hey! It is in Convert class... MSDN[^]
hmm thats cool!
TyronX wrote:
P.S.: Sorry for asking so much ^^
nah... how would we earn gold memberships, etc.? :P Plus from some question (like this one) I learnt something new.. isn't iot great?
best regards,
David 'DNH' Nohejl
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
dnh wrote:
See MSDN[^]. This should be what you are looking for..
I don't think so. He wants to convert a string into his own type (FromString() ) not the other way round (which would be IConvertible.ToString() ).
dnh wrote:
Changes in .NET classes are possible, bt I don't like this idea (in this case).
How would you do that?
dnh wrote:
nah... how would we earn gold memberships, etc.?
Best regards
Dennis
|
|
|
|
|
Dennis C. Dietrich wrote:
I don't think so. He wants to convert a string into his own type
you are right! [edit]what's even worse I actually told him to have stg like ID.FromString() so I understood bt just said bs then [/edit]
Dennis C. Dietrich wrote:
How would you do that?
Sorry. I was very inaccurate. I meant deriving from .NET classes (do not apply to Convert). [psst i didn't say that]change rotor & recompile [/psst]
thx for correcting me.
(how come I haven't included "what I say CAN be bullsh" yet into my sig- I was really thinking about it!)
David
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
dnh wrote:
how come I haven't included "what I say CAN be bullsh" yet into my sig- I was really thinking about it!
Don't bother! Otherwise everybody here would have to include that. Well, maybe everybody except for Heath Stewart.
Best regards
Dennis
|
|
|
|
|
Dennis C. Dietrich wrote:
Well, maybe everybody except for Heath Stewart.
LOL. that's true!
David
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
TyronX wrote:
So I thought it would be the best to kind of append a method to the System.Convert class, so that I can simply call it with Convert.ToID("somewhat");
You can't do this. The Convert Class[^] is sealed[^]. That means you can not derive classes from it. And even if it wasn't sealed and you'd derive it you would end up with a new type. You should simply provide a method ID.FromString(string) and/or a corresponding constructor for new instances (public ID(string) ).
Best regards
Dennis
|
|
|
|
|
Okay. Thanks to both of you.
|
|
|
|
|
Next Question: Can I add something to the Point Class/Structure (I need to add the TypeConverter)?
|
|
|
|
|
|
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
|
|
|
|