Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
B

Baris Kurtlutepe

@Baris Kurtlutepe
About
Posts
66
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Need one of those file handle tracker thingies
    B Baris Kurtlutepe

    brianwelsch wrote: Is there anything to trace what's launching it? Please say "Yes, Brian and here's a link to some fine freeware, too." Yes Brian, not freeware but there is the operating system if you're using Windows NT :) Go to Administrative Tools/Local Security Policy Under Local Policies/Audit Policy -> Check Audit Process Tracking for success. Then reproduce this behavior of WMP getting launched. Open up Event Viewer/Security and there you have a list of all processes which get spawned and by what other process. Once you got the entry for WMP getting launched, you can trackback its creator process id. Which should give you a hint at the very least.

    The Lounge debugging question

  • Check Process Running?
    B Baris Kurtlutepe

    Hi, Using the System.Diagnostics namespace, you can do this: Process[] excelProcs = Process.GetProcessesByName("excel"); if (excelProcs.Length > 0) // there we have excel.exe(s) running

    .NET (Core and Framework) help question

  • Using a critical section in a high priority thread
    B Baris Kurtlutepe

    Hi Chris, 1) I don't think that I really do understand what you mean with timer interrupts, but the call to EnterCriticalSection() on the "normal" thread will cause the "realtime" thread to block on the EnterCriticalSection() call and this will give the processing cycles back to your "normal" thread, which will be happily executing until it calls LeaveCriticalSection(). Ie it is like having a high priority thread calling Sleep, so regardless of the priority of the thread, the processing time will be granted to other threads. 2) There is no need to worry about the "normal" thread, it will most probably still get the same amount of processing time (maybe even more than) that it used to get before. (Beware that I'm not saying that this processing time is enough for your normal thread to be 'responsive enough') The thing about the "realtime" thread is, you're correct it will block until the "normal" thread calls LeaveCriticalSection() so your realtime operation will probably stall. Instead of doing this you can call TryEnterCriticalSection on the realtime thread, and if it returns zero, you can skip trying to read that information and retry on the next loop. 3) As you probably already know, using real time priority in a thread is strongly discouraged and I'm not sure that all versions of Windows provides the same flexibility on multithreading (especially Win9x series) and you should expect lock-ups due to the realtime priority of your thread. Besides that, if you're concerned about corruption in single read-write's of 32bit values, I'd like to remind you that in Win32 all 32 bit operations are guaranteed to be atomic, so there is no need for synchronization if you're just reading from or writing to an integer from multiple threads. There will be no problem if in one thread you are just reading an integer and in the other thread just updating it.

    C / C++ / MFC help question

  • ListView DisplayMember
    B Baris Kurtlutepe

    Unlike the ListBox control, the ListView control does not have a DisplayMember nor does it have a DataSource, ValueMember or any similar property. Because these are properties inherited from ListControl and ListView control is not inherited from that. If you're going to implement data binding in a ListView control, you'll have to do so by yourself and depending on the structure, you have to populate the ListView's headers, item collection and -if any- subitems manually.

    C# question

  • Populating a tree view from another thread
    B Baris Kurtlutepe

    If you want to modify a control from a thread other than the thread that created it, you should use the Invoke method of the Control (in that case the TreeView) to invoke the function that adds the node to the tree. A simple example for adding a node which takes a string parameter for the node could be: private void AddNode(string nodeText) { myTreeView.Nodes.Add(nodeText); } then you can declare a delegate to call this function: private delegate void AddNodeDelegate(string nodeText); and then from any thread, you can safely do this: string nodeText = "This is my safe node text"; AddNodeDelegate myAdd = new AddNodeDelegate(AddNode); myTreeView.Invoke(myAdd, new object[] { nodeText } );

    C# database com data-structures question

  • software update project
    B Baris Kurtlutepe

    You might want to take a look at the updater application block from Microsoft.

    C# csharp announcement visual-studio sysadmin question

  • Simple (I think) Inheritance question
    B Baris Kurtlutepe

    Guinness4Strength wrote: I like to extend the TreeNode class through Inderitance to add a string property to the class. If it's only adding a string property, why are you inheriting the TreeNode class at all? You can use TreeNode's Tag property to 'tag' (associate) any object with your node, including a string.

    C# question oop

  • const parameters in c#
    B Baris Kurtlutepe

    Joel Holdsworth wrote: Putting /*[in]*/ before each parameter seems to stop them being changable at compile time No it doesn't, or better said: Thank god it doesn't. Thinking of crawling through all comments in the code just to see what other 'features' the compiler might put into the code gives me the creeps.

    C# csharp c++ help question career

  • Float problems
    B Baris Kurtlutepe

    Dave Kreskowiak wrote: Decimal is also 128-bits in size compared to the 32-bit for a float... A little overkill for the application... Yes, decimals are stored as 16 bytes (but only 13 of them are used, pity) In any case they're much slower than a float, since they are structs and do not have hardware support. But I think it's OK unless you're programming a game or an embedded system in a spaceship :)

    C# help question

  • strstr in VC#
    B Baris Kurtlutepe

    You can use the IndexOf method of the string class, of course it does not return a pointer like strstr does.

    C# question csharp

  • Float problems
    B Baris Kurtlutepe

    Have you considered using the decimal data type? It does not lose precision since it is intended for decimal arithmetic.

    C# help question

  • How to change from Byte[] to Bitmap on a Pocket PC
    B Baris Kurtlutepe

    Hi Gakujin, To construct an image object (in your case a Bitmap, which is derived from Image) from a MemoryStream object use the Image.FromStream static method. so simply replace: Bitmap bmp = new Bitmap(memory); with Image img = Image.FromStream(memory); I am not sure about the compact framework, but I presume loading from a stream should work, since you can save to a stream already. EDIT: Sorry I didn't notice that the Bitmap constructor already does this, so ignore me :)

    C# graphics help tutorial data-structures performance

  • How to dynamic load or show form by Form name ?
    B Baris Kurtlutepe

    You can use reflection. A primitive implementation would be like this: Type t = Type.GetType("FormName"); Form f = (Form) Activator.CreateInstance(t); That of course depends on what you mean with "forms are added dynamically", if the specified type is in the same assembly where the above code is executing, it should work.

    C# tutorial question

  • Set a node in a Treeview to bold
    B Baris Kurtlutepe

    Yes there is a workaround: node.Font = new Font(someotherfont..); node.Text = node.Text; I know it looks silly, but it's the only workaround I found to force the treeview to recalculate the size of text with the new font/style etc.

    C# graphics question announcement

  • Must Kill Windows Update
    B Baris Kurtlutepe

    Ryan Binns wrote: but I'll do it again and see Actually I ran into the same situation and don't know how I managed to get rid of it. Maybe you should keep trying and it will forgive you... :p P.S: Man that was a fast reply, I've seen your reply in the response I got after I've submitted the post! :wtf:

    The Lounge question announcement

  • Must Kill Windows Update
    B Baris Kurtlutepe

    Have you tried disabling and re-enabling auto-update? I believe that way it forgets what it had to download. Or at least hope so.. :~

    The Lounge question announcement

  • Rebuild VC++ Debug Library ?
    B Baris Kurtlutepe

    whybotha69 wrote: creating a Socket in one thread and then trying to use it in another thread. Hi, I hope you know that in order to use the MFC's socket object between two threads you should do a Detach() on the object which will give you a handle of type SOCKET, and then Attach() using that handle in the other thread. Which is basically: - Call Detach() on the object in order to obtain the SOCKET handle - Delete the detached object - Create the (CSocket or CAsyncSocket) object in the second thread - Attach the SOCKET handle to the newly created object using Attach() The bug mentioned in Q193101 is not about this exactly, it's about creating and using sockets objects in secondary threads.

    C / C++ / MFC c++ help com debugging question

  • CStatusBarCtrl::SetIcon() problem with icon size
    B Baris Kurtlutepe

    LoadImage() worked, thank you very much. I thought I tried LoadImage() without success before, but then I must have given incorrect parameters to it. And I didn't know that LoadIcon() stretches the bitmap to system metrics, thanks again.

    C / C++ / MFC help question

  • CStatusBarCtrl::SetIcon() problem with icon size
    B Baris Kurtlutepe

    Hi everybody, I'm trying to show an icon in one of the status bar's panes. The status bar is the CStatusBarCtrl and the problem is that I can only show 32x32 icons in the pane. When I load a 16x16 icon and call SetIcon() the icon on the statusbar becomes stretched to 32x32 in size, thus loses visibility of the most parts because the statusbar itself is about 18 or 19 pixels high. The workaround I've found is to create a 32x32 icon and place my 16x16 icon in the middle of that space and everything's fine. What am I doing wrong? Or is it that the 32x32 icons are the only ones one can display in a status bar pane? Any help would be greatly appreciated... P.S: The icons that I'm using are for the WindowsXP platform and thus 32bit icons, 24 bit colour and 8 bit transparency, maybe that's a problem?

    C / C++ / MFC help question

  • Getting IP and Language
    B Baris Kurtlutepe

    Hi Himanshu, Sorry but I really don't think that I do understand. Weren't you asking for the IP address of the local computer? Now say that's the rszHostIPAddress parameter. What are the other two? :confused: You've mentioned above you needed a function which receives no parameters, now you want to pass parameters to it? The method I've described above let's you get the IP addresses assigned to a computer, note that whilst a computer has a single hostname, it can have many IP addresses. And that about nIPSelection, I really don't understand, sorry...

    C / C++ / MFC help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups