|
Hi~
In C# compact framework, I would like to send a message to a window written using "SendMessage" method by p/Invoke.
How can I pass the string to p/invoke method so that the C++ window can get the message? If a pass string, How to convert the lparam into string in C++
windows message loop function? If pass the string as other type, then what is the type?
[DllImport("coredll.dll",EntryPoint="SendMessage", CharSet=CharSet.Auto)]<br />
private static extern void SendMessage(IntPtr hwnd, uint msg, int wparam, <big>string lparam</big>);
|
|
|
|
|
i don't know how it's done in compact framework, but in ordinary .NET framework u can use the following:
[DllImport("user32", EntryPoint = "SendMessage")]<br>public static extern int SendMessageStr(int hWnd, uint Msg, int wParam, [MarshalAs(UnmanagedType.LPStr)] string lParam);
there are no facts, only interpretations
|
|
|
|
|
Hi
I have unmanaged executable, that is in the form of .EXE.
Now I wand to call a method (from the .EXE)in my C# code.
Can any one through some information in this regard?
Thanks in Advance
Sarma
|
|
|
|
|
I am not not sure about how we can consume unmanaged .exe's in managed environment. Dotnet will support to consume unmanaged .Dlls in managed environment. I can redirect you to an URL, which will give you a clear picture of using unmanaged code in managed evironment.
Interoperating With Unmanaged Code
Sreejith Nair
[ My Articles ]
|
|
|
|
|
Can anyone provide me any relevant information about Licensing Web Services in C#.NET please?
( Apart from this site http://www.dotnetjunkies.com/Article/81DF138A-E188-413A-A63A-5BF96CBD6E1A.dcik[^] , i am in need of more information about this )
It is about enabling the access of a web method to selected users.
Please reply me, probably when you have free time.
Thanks and Regards,
Arunan Kannan.
Arunan Kannan
chennai.
|
|
|
|
|
Read about the Web Service Enhancements[^] (current version is 2.0) that implements industry standards like WS-Security to provide such functionality. The WSE ties seemlessly in with VS.NET and is easy to use (with or without VS.NET). You could implement custom authentication to authenticate callers (providing that they give you credentials) against a database or other data store.
You could do this without the WSE but then the burden of encryption and verification of headers falls on you. Especially when it comes to security, use proven third-party libraries when possible. The WSE has the added bonus that Microsoft created it and field-tested it among many other things, and we're the ones who provided you with .NET (so it's not exactly third-party, depending on how you look at it. ).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I have a usercontrol where in the Load I open the Registry, call a method GetOptions and close the Registry. In the user control the GetOptions method is empty. When I use this control on a form, I want to override the method GetOptions.
My problem is that I can't get to that method anymore. How do I override it? I also have more than 1 instance of the control on my form.
There might be a better way to solve this, so any idea's?
|
|
|
|
|
Anonymous wrote:
When I use this control on a form
Do you mean you wan to know when the control is in Design-Time? Controls have a DesignMode boolean property.
|
|
|
|
|
No what I want is that each instance of the control is reading different settings. So each time I use the control I want to write a different method to read the settings.
I just have the open and close in the base class.
|
|
|
|
|
|
Hello ,
Iam new to c#.How can i change the Form title bar color
programatically plz with example
|
|
|
|
|
Hi all,
I am writing a program on a notebook which it can alert an event preset at certain time, e.g. I can register an event at 3:00 p.m. to the application, so it can alert me at 3:00p.m for the event. And the current method I think of is to write a loop to check whether it is the time for the events. But it will certainly consume computing power for the notebook when it is in battery mode. So is there any feature in the shell that I could register an event and get a signal from it when the time matches ? or any other good method for it ?
Thanks
|
|
|
|
|
Simply use a timer for this. Calculate the number of milliseconds that have to elapse before the event should occur and use it as timer interval.
www.troschuetz.de
|
|
|
|
|
Thanks for your reply.
But there will be many events(unknown number), so I can't keep
a timer for each events(too expensive for the resource). What should I do ?
|
|
|
|
|
You could order your events in some way and use a timer for the closest event. If this event occurs restart the timer for the next event.
www.troschuetz.de
|
|
|
|
|
See System.Timers.Timer
Works like this
public class Timer2<br />
{<br />
<br />
public static void Main()<br />
{<br />
System.Timers.Timer aTimer = new System.Timers.Timer(10000);<br />
aTimer.Elapsed+=new ElapsedEventHandler(OnTimedEvent);<br />
aTimer.AutoReset = false;<br />
aTimer.Enabled = true;<br />
<br />
Console.WriteLine("Press \'q\' to quit the sample.");<br />
while(Console.Read()!='q');<br />
}<br />
<br />
private static void OnTimedEvent(object source, ElapsedEventArgs e) <br />
{<br />
Console.WriteLine("Hello World!");<br />
}<br />
}
Salil Khedkar [^]
|
|
|
|
|
A Timer could be used, but not to fire off the event you want at a specified time. Don't count down to the target time. Instead, setup the timer to fire off every, say, minute. In the timer Tick event handler, get the current system time, then compare that to your schedule of procedures that you need to execute. If the current system time (don't compare down to the second!) matches the schedule time, kick off the code you need to.
Now, you don't have to have a Timer for every event you need, and you don't have to worry about what your going to do if the system crashes and you have to restart your app, recalcualte all the timer intervals, reset the timers, and hookup the tick events again.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi! Nair,
I can not find the answer by myself in MSDN.
Can you tell me where I can get the answer to this question? or you can tell me the answer directely.
Thank!
Best regards!
momer
|
|
|
|
|
Hi ,
As anyone encountered an error message stating that the form that was specified as the MDI Parent is not an MDIContainer. I can understand that this would arise when the form has not had the IsMDiContainer property to true however i have set this property and the application was running fine until yesterday evening any ideas. i am about to unistall framework and VS2003 and reload.
Can anyone help?
Cheers
dazzler
|
|
|
|
|
That would most likely be a complete was of time. For one, VS.NET is merely a client for the .NET Framework, which is a separate component. It implements and uses code to facilitate designers and invokes the compilers to compile managed code, but nothing more (regarding the .NET Framework).
The .NET Framework - especially Windows Forms - P/Invokes and uses COM interop with native Windows APIs.
More than likely, something changed on your system. Did you install any new patches or service packs? Did you change any code - no matter how "unrelated" you think it is? Have you made sure that you're disposing any modal dialogs or other resources (like any Graphics or Bitmap instances you create)? In most cases the fault is with the code. Just re-installing the .NET Framework will almost never solve the problems. You need to first look at your code.
So be more specific about your problems and what exceptions - if any - you're betting. Give us stack traces and other details regarding your problem, but don't just go reinstalling everything. Not only is that a bad way to resolve issues (not knowing what the problem is - no matter if the fix works or not - will most likely lead to the problem happening again), but it most likely won't resolve your issue.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi guys
Does anyone know of any articles/tutorials on ANY web site that can paste files that have been copied to clipboard by Windows Explorer? Specifically I need to know how to cast the "Preferred DropEffect" clipboard format to DragDropEffect enumeration in C#. I can do this in C++, but how do I cast them in C#? Also, do I need to cast from an STGMEDIUM structure, then get the hGlobal to the DropEffect DWORD, or does Clipboard automatically do this in .net for casting from DataObjects?
Any pointers would be greatly appreciated
Thanks guys
|
|
|
|
|
This has been covered before in this forum. In the future, try searching first. You can search these forums by clicking the "Search comments" link above.
You don't need to worry about the STGMEDIUM . Basic drag and drop support is supported by .NET, and even in the COM world you don't simply cast an IDataObject (which, BTW, is a completely different interface from .NET's IDataObject ).
In both implementations, however, you do the same: you request a specific clipboard format that you support (optionally supporting multiple clipboard formats that you reference in order of preference till the data is dropped/pasted).
File names - which use the TYMED_FILE clipboard format - are easy to retrieve. Just look at the following example (assume the handler is hooked up to a DragDrop event for some control):
private void myControl_DragDrop(object sender, DragEventArgs e)
{
if ((e.AllowedEffect & DragDropEffects.Copy) != 0 &&
e.Data.GetDataPresent(DataFormats.FileDrop))
{
string[] filenames = (string[])e.Data.GetData(DataFormats.FileDrop);
foreach (string filename in filenames)
listView1.Items.Add(filename);
}
} You should read the DataFormats class documentation and the DragDrop event documentation for more information.
Only in some cases - like handling data from a stream or structure storage document do you really need to interop with the native COM drag and drop/clipboard APIs, and I've carried on long discussions about this that you can search for and read if you're interested.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
class ball
{
int x;
ball()
{ x=Random().Next(10);
}
}
I then create 10 ball, the problem is all balls have the same X. How do I solve this? Thanks
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
try creating a new random object into the class and giveing it a new seed (that could be time dependent)
<br />
class ball<br />
{<br />
int x;<br />
Random r;<br />
ball(seed)<br />
{ <br />
r=new Random(seed);<br />
x=r.Next(10);<br />
}<br />
<br />
}<br />
<\code> <br />
<br />
I hope you understand...<br />
By the way... visit <a href="http://nehe.gamedev.net">http:
|
|
|
|
|
Try to re-use the same Random:
class ball
{
int x;
Random random = new Random();
ball()
{
x=random.Next(10);
}
}
|
|
|
|