|
Candseeme wrote: How to add a control of type TextBox or ComboBox to a ToolBar in Runtime
You already are adding controls to the form at run time - Take a look at the designer written code to see how it is done.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
use forms' topmost property to true or bring forward type methods
Mikail Çetinkaya . The C# DEveloper
|
|
|
|
|
What do I use instead of addressof.I am trying to p/invoke Win32 API CreateThread in a C# application.One of the API's parameter is the address of the function which the thread will execute.
|
|
|
|
|
|
|
And problably one based on some incorrect assumptions.
By using the unmanaged Win32 thread functions, you introduce garbage collection issues with your managed code being executed from an unmanaged thread.
There is no reason I can think of that would be good enough to justify this.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
So was I. Bummer....
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
You want entertainment…… well you got it! :
I have a C# application that invokes COM objects. I need to stop a COM instance from executing when it executes more than a predefined amount of time. Each COM instance is assigned a thread.
System.Thread.Abort() does not achieve that result because when calling Abort() on a thread, if the thread is currently executing native code (or COM in my case), nothing will happen until the thread returns to managed code. To solve the problem I thought with the help of the forum of these solutions:
1. Creating an exe (Process) that invokes the COM and assign a thread to a function that launches that exe. When a thread aborts, I will kill the exe and stop the COM execution. This approach has worked.
2. Create a MTA COM component that spawns a native thread and the COM object with methods added to the abort the Native threads.
3. Instead of using Managed Threads, I can P/Invoke Native threads by using the CreateThread/ExitThread/TerminateThread API. Aborting threads occurs in a rare occasion.
I appreciate any useful comment.
|
|
|
|
|
If anyone is interested ,delegates are used instead of addressof.
|
|
|
|
|
Well, it took me looking into your message histroy to see what's you're really trying to do here. Launching multiple instances of VB6-created .DLL, COM based. Hmmmm....interesting since VB6 runtime doesn't support threading, directly anyway.
Creating a seperate .EXE will work, since each launch of the .EXE will, of course, spawn on it's own thread. This will also make any communication with the instance of the .DLL a huge PITA, since now your crossing a Process boundry. I hope this .DLL doesn't do anything useful to the form.
In my opinion, option number 2 is your best bet. Keep manangement of the unmanaged threads in a COM-based component that exposes any interface your .NET app can use to control the launching and shutdown of the VB6 component instances. This COM component can also handle communication to and from the VB6 stuff for your Managed code to.
Why do I say this? Because in your original post, that you didn't tell us anything about, it sounds like this VB6 component could be replaced sometime in the future. By creating a wrapper for the VB6 threads, you can easily replace this interface component with a different interface when the VB6 component is finally replaced by managed code.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I needed a quick answer to a quick question!
I am working on Options 2 and 3(Option1 is done) in parallel since they hold the same complexity which is mainly working with unmanaged threads.In both cases i am creating a wrapper to the COM either with creating COM-based component or a .net assembly or class( never figured it out yet).The problem i am facing is how to stop a thread execution.TerminateThread is not the answer(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/terminatethread.asp[^]), how to gently terminate a thread keeping in mind that the COM source code cannot be changed.Any code can only be added to the Wrapper.
|
|
|
|
|
You don't have a choice here. Either your VB6 code was written to terminate itself property on some flag, or you'll have to forcefully kill it, which will lead to memory and handle leaks.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks man i appreciate it..
|
|
|
|
|
Thanks Dave i appreciate it..
|
|
|
|
|
I have a very superficial understanding of programming in Windows, and am merely trying to solve a simple problem for a friend.
Basically, I want to simulate the keystroke "VK_MEDIA_PLAY_PAUSE" allowing programs such as Winamp and/or WMP to detect and respond, in the exact same way they would if I physically pressed the key.
I've been experimenting with HWND_BROADCAST and SendMessage, but don't really understand how they work -- any insights?
|
|
|
|
|
SendMessage is used to send Windows messages to a specific window, given the handle of a window. When used with HWND_BROADCAST as the window handle, it sends the message to every window in the system. So if Winamp and Media Player are running, they would get the message too.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi to all. I am trying to provide a help file for the project I am developing. I have the test.hlp file but I have no idea how to open this file when the user click on a button. Is there any way to do this?
Thanks in advance.
|
|
|
|
|
|
Hello everyone, I'm back again...
I'm working on some printing dialog with integrated preview. The problem is how to determine corrent font size (height) for the preview.
Of course, the preview image size is measured in pixels, so for the A4 you have e.g 176x140 px large image. When I want to draw something on it with font of user-defined size in px, the preview size must be some N-times smaller. The key problem is how to get the N.
Images are printed correctly, because I can convert its sizes in some useful units, like inches or percents, so they can be drawn with knowledge of document size in hundreths-per-inch units correctly.
But with fonts, I can use only some Font.GetHeight(...) method, which returns (for my printer resolution) value of 186.8591 (inches or what ?) for the 10px font.
|
|
|
|
|
Specify the font size in points instead of pixels. One point is 1/72 of an inch.
---
b { font-weight: normal; }
|
|
|
|
|
You can use the Graphics.MeasureString( ... ) function to get the pixel height of a Font 's output.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Hello gurus,
I'd like to know how to generate a GUID in C#? Can somebody show me a code snipet please?
Best regards.
Thanks.
Fred.
There is no spoon.
|
|
|
|
|
Easiest way:
textBox1.Text = Guid.NewGuid().ToString();
|
|
|
|
|
as simple as this
thanks
There is no spoon.
|
|
|
|