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
J

Jitse

@Jitse
About
Posts
25
Topics
7
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • 'Bumping' topics
    J Jitse

    Pete O'Hanlon wrote:

    Although I'd be really surprised if something got moved that quickly.

    Here you go, got chased into oblivion in no time, although it doesn't look too hard to solve. =/ I explained it thoroughly, gave my code, and it's a pretty specific question. Is it possible this topic has been assaulted by a... page-tsunami? (DUN DUN DUN...) http://www.codeproject.com/script/Forums/View.aspx?fid=1649&msg=2440450[^] I can see alot of other no-replies-topics at pages higher than 25 or so. Those are all victims of the Codeproject-Forums-don't-want-you-to-bump-dictatorship. ;)

    Site Bugs / Suggestions question

  • Render loop for other process
    J Jitse

    Dave Kreskowiak wrote:

    You can't say I didn't warn you.

    My way works for any game I tried, except one little unknown game, and only when you choose OpenGL as its rendering. So actually it works very well. You were saying, "did you ever try it on an DirectX window", yes I did, with several games, and it all works perfect. You don't seem to be able to explain me why it doesn't work for that one certain game when I choose OpenGL, but still works when I choose DirectX 8 or DirectX 5, or that it works with every other game I tried. Anyone else knows what's the reason for this?

    C# winforms graphics game-dev json help

  • 'Bumping' topics
    J Jitse

    And what to do when you made a new topic at an unfortunate moment, and it gets digged to the 20th page in no time? Just make a new one?

    Site Bugs / Suggestions question

  • Render loop for other process
    J Jitse

    Dave Kreskowiak wrote:

    You haven't tried to cover a DirectX window with this yet, have you??

    Was already wondering how I could ever know more than an MVP. ;) I was thinking like: "Where's that catch I'm totally missing.". :laugh: Anyway, yes I did. And it works. Hmmmwell, it almost totally works. I've noticed something weird. I tested it with a few game windows, and they all worked perfectly. (If you want to know: Lord of the Rings Online, Pro Evolution Soccer 6, Tibia.) But! With this game called 'Tibia' (don't search it up, it's a horrible game), I can choose what API to render the game with in the advanced graphics options. You can choose two versions of DirectX, and OpenGL. The DirectX rendering works fine, but when I choose OpenGL the PNG images totally get overdrawn, and are not visible anymore. This is weird though, why would it work with DirectX, but not with OpenGL...? :confused: Or is this just something about the game I tried? Still, it does seem to work perfectly with the other game windows, there's 0% flickering. And the game I primarily want to make an addon for works as well.

    C# winforms graphics game-dev json help

  • Render loop for other process
    J Jitse

    Quote: "The best you're going to be able to do is draw a small window covering just what you want, but you will not be able to "see through it"." - By Dave Kreskowiak Seems you were wrong. ;) Credit goes to Rui Godinho Lopes. This is the most important piece of code, works with with the user32.dll UpdateLayeredWindow function. Link is at the bottom. public void SetBitmap(Bitmap bitmap) { IntPtr screenDC = Win32.GetDC(IntPtr.Zero); IntPtr memoryDC = Win32.CreateCompatibleDC(screenDC); IntPtr gdiBitmap = IntPtr.Zero; IntPtr emptyBitmap = IntPtr.Zero; try { gdiBitmap = bitmap.GetHbitmap(); emptyBitmap = Win32.SelectObject(memoryDC, gdiBitmap); Win32.Point pointSource = new Win32.Point(0, 0); Win32.Point topPos = new Win32.Point(_form.Left, _form.Top); Win32.Size size = new Win32.Size(bitmap.Width, bitmap.Height); Win32.BLENDFUNCTION blendFunc = new Win32.BLENDFUNCTION(); blendFunc.AlphaFormat = Win32.AC_SRC_ALPHA; blendFunc.BlendFlags = 0; blendFunc.BlendOp = Win32.AC_SRC_OVER; blendFunc.SourceConstantAlpha = 255; // TODO: TEMP Win32.UpdateLayeredWindow( _form.Handle, screenDC, ref topPos, ref size, memoryDC, ref pointSource, 0, ref blendFunc, Win32.ULW_ALPHA); } finally { Win32.ReleaseDC(IntPtr.Zero, screenDC); if (gdiBitmap != IntPtr.Zero) { Win32.SelectObject(memoryDC, emptyBitmap); Win32.DeleteObject(gdiBitmap); } Win32.DeleteDC(memoryDC); } Here's the link: CodeProject: Per Pixel Alpha Blend in C#[^]

    C# winforms graphics game-dev json help

  • 'Bumping' topics
    J Jitse

    I don't think the disadvantages of bumping are greater than the advantages of answers longer than one post actually getting answered, instead of digged into the eternal void of oblivion. Bumping also isn't that horrible. It's mainly done by people that didn't get their question answered, but ended up quite far in the page ranking, sometimes just because of bad timing.

    Site Bugs / Suggestions question

  • 'Bumping' topics
    J Jitse

    Then there's a very simple solution. Don't allow members to double post. This shouldn't be a problem because you can edit your post any moment you like, and it's even marked with a [modified] tag (which was a very good idea, not many forums have that). You could optionally allow them to post if there hasn't been a reply for 24 or 48 hours, but only once. :) That way you won't need any moderators, and the system is foolproof.

    Site Bugs / Suggestions question

  • 'Bumping' topics
    J Jitse

    Apparently most other forums found a way to avoid that. And it's not that hard. A posting timer, so you can't post every two minutes or so. And for example you can not post twice in the same topic without anyone else replying, or you can only double post after 24 hours of no replies or so. There are dozens of ways to avoid abuse. And you always have moderators to control everything. Another reason why you get on a high page quickly, is because expanded view is default, many people won't change it to Thread View either because they don't care, or because they don't know the feature exists.

    Site Bugs / Suggestions question

  • 'Bumping' topics
    J Jitse

    Good day I've noticed a topic on this forum can in no way change its position after it's been posted. Most forums automatically make your topic jump back to the top of the board when someone replied. Why isn't this the case with this forum? It's sometimes annoying to have your topic at the sixth page, with someone that answered, and you answer back, but your topic keeps grounded to page six, between all those posted-one-day-ago topics :laugh:, doesn't really make sense. I don't think people will still digg up your topic when it's that far already, maybe only people that already replied to your topic because they subscribed to it as well. Thanks in advance

    Site Bugs / Suggestions question

  • Render loop for other process
    J Jitse

    I see, is there a way to bypass that? A window on top of a game window hides the displaying of that piece of the screen drawing, obviously without flickering (because of the z-layering of Windows itself or so). Can I in some way make draw my screen on top of the game instead of in the same window? Then the screen has to be transparent of course, and because the specific regions that are overdrawn by me, overlap the drawing of the game, Windows will automatically disable that region (as it would do with a normal window on top of another normal window), and no flickering would appear. Still the user has to be able to have the game window itself as the active window, so I'd have to make my semi-transparent window an always-on-top window or so. I could draw to a zero pointer (IntPtr.Zero), which makes it the most upper layer (thus the whole screen, ignoring other windows). Still I noticed this flickers. =/ Do you think my idea is worth a try? If yes, how would I do that? Or is it impossible to have some decent drawing in/on a game window by a third party program anyway? Thanks in advance

    C# winforms graphics game-dev json help

  • Render loop for other process
    J Jitse

    Good day I'm making a backgroundprocess that works as an addon for programs that actually don't support addons. It uses GDI+, and a global keyboard hook, to make the addon work. Now my problem is that I don't really know how to make my render loop. Normally I'd do something that interacts with Application.Idle, and keep on checking if the application is idle by using the Win32 API function PeekMessage and things, but that's when I want a render loop for my own program. Now I actually have to decide when to render for another program. And I don't think I can retrieve in any way when should be the best moment to render for another program. It's not an application though, it's a game, so it has a continuous render loop. So maybe I can just decide for myself when to render? But how would I do that? I never actually really made a good render loop. When I made a game it was the XNA Framework doing it, and if I made an application with a render window or so, it was with the Application.Idle etc. Thanks in advance.

    C# winforms graphics game-dev json help

  • DataGridView, Memory Usage
    J Jitse

    Alright, seems the GC isn't 100% perfect yet. Thanks for the reply.

    C# question css performance learning

  • DataGridView, Memory Usage
    J Jitse

    I've got .NET Framework 2 SP1, and I don't see anything interesting in that class. All it has are these two properties: // Gets a value indicating whether server garbage collection is enabled. System.Runtime.GCSettings.IsServerGC // Sets the behavior of the GC System.Runtime.GCSettings.LatencyMode The LatencyMode could be interesting, if it wouldn't only have these three unusable choices: GCLatencyMode.Batch // for non-UI applications GCLatencyMode.Interactive // for UI applications, used by default GCLatencyMode.LowLatency // when you don't want the GC to interrupt time-sensitive operations Nothing interesting there. Edit: On MSDN it says this: Use the Collect method when there is a significant reduction in the amount of memory being used at a defined point in your application's code. For example, if your application uses a complex dialog box that has several controls, calling Collect when the dialog box is closed could improve performance by immediately reclaiming the memory. If they already think a complex dialog box is a good situation to collect garbage after with GC.Collect, I think a DataGridView with a hundred thousand rows that has been cleared is a good reason too. That's just my unexperienced opinion though.

    modified on Tuesday, February 26, 2008 3:36 PM

    C# question css performance learning

  • DataGridView, Memory Usage
    J Jitse

    I've got a testing application, that has about 57MB of memory usage with filled DataGridView. Now the GC only starts working at about 200MB. That's quite alot. I'd rather have an application using 57MB all the time, instead of always getting to 200MB before optimization starts to get it back to 57MB.

    C# question css performance learning

  • DataGridView, Memory Usage
    J Jitse

    Good day I've been experimenting a bit with the DataGridView, and its memory usage. If you add a high amount of rows to the grid, and then clear it, it apparently won't clear its memory as well. It's as if the rows are still in the memory, but dereferenced. When you populate the grid again, with alot of data, the memory usage keeps on going up, as if he now has two lists of rows. This goes on for a while every time I clear and populate again, until the memory usage gets to a certain amount, then the application freezes for a very short while (some milliseconds) and the memory usage gets reduced back to the normal level of one populated DataGridView. This is just the GC doing its work, but I didn't know he did it that sporadicly. He also doesn't seem to work in function of time, but in function of total memory usage. He watches how high the memory usage goes, and when it gets to a certain level he finally starts working. The method GC.Collect() solves this all of course. So now my question is, when you're working with DataGridViews and a high amount of data, is it recommended to actually just always do a GC.Collect after you cleared the grid? Thanks in advance.

    C# question css performance learning

  • System error codes, FormatMessage, and memory reading. [modified]
    J Jitse

    Hi ho :) I've noticed something weird. When I try to read an unexisting address location (using ReadProcessMemory of kernel32 libraries), it gives an exception. This is totally normal. Then I'm able to retrieve the error code with GetLastError(). This code can be formatted, which returns a nice string message in my native language. But now I've noticed something that's not quite normal. When I run the application normally, and the expected exception happens, the FormatMessage returns something like: "A Read/WriteProcessMemory-operation is only partly executed." Riiiiiight... :wtf: Now the weirdest thing is, if I put a debugging breakpoint just before I retrieve the error code with GetLastError(), and then do a step-by-step running (you know, the F11/F10 thing), it returns something totally different: "Tried to point to an unexisting token." Which is the message I want, because that's exactly what I did wrong. But still he doesn't return it if I don't put a breakpoint just before the GetLastError() function. It's as if the system needs a little time to store the error code, and my program is too fast requesting it. I tried a System.Threading.Thread.Sleep(100); or so, but that didn't work. Here's my code, if that helps: if (!ReadProcessMemory(handle, new IntPtr(address), buffer, length, out bytesReadPtr)) { StringBuilder str = new StringBuilder(); str.Capacity = 1000; FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, IntPtr.Zero, GetLastError(), 0, str, 1000, IntPtr.Zero); throw new Exception("Unable to read process memory.\n" + str.ToString()); } Anyone knows what's going on? :) Thanks in advance. (Btw. Can't I use decent tabs in code on this forum? :confused:)

    modified on Sunday, March 2, 2008 12:03 PM

    C# c++ debugging performance help question

  • Process memory, significant addresses
    J Jitse

    Thanks, hehehe. I'll just try to make a monitoring program first then, that logs what changes in memory. Then I can see what action changes which addresses. Yes I will be making addons programmed in C#, applied to native code programs (as far as I know).

    C# architecture performance tutorial question learning

  • Process memory, significant addresses
    J Jitse

    I'm not talking about Minesweeper, I'm talking about any existing process that runs on Windows. :p I'd really like to find some pattern that can be used to find significant memory data more easily. My final purpose is to make addons for applications that actually don't support addons. :D

    C# architecture performance tutorial question learning

  • Process memory, significant addresses
    J Jitse

    Hi ho :) I've been experimenting with reading memory of other processes for a while now. And I've noticed the virtual addresses are quite weird. First of all I can't access anything from 0x0 till 0xFFFF. This seems to be a forbidden area or so. :p I've never found a process that didn't have this 'offset'. The first readable address socket is 0x10000. I first thought this previous forbidden area (lower than 0x10000) was a Windows header or so, but it seems this 0x10000 and further is the windows header, including some data like the windir, cpu architecture, and so on. Now you'd think the actual data of the process itself is just after this Windows header, but that's often not the case. Suddenly there's another piece of memory that's not accessible there. That keeps on going for a while. Now I searched up some interesting addresses for certain processes (like the Minesweeper of Windows XP), and I can for example find the width and height of a minefield. But when you look at the actual address of this data, it's extremely high (relatively of course): 0x1005334. This is a hundred times higher than the first memory address that's accessible (0x10000). I've researched a bit, but I can't find information about a certain structure Windows uses for process memory. Maybe there's a fixed virtual address where it actually starts to be interesting to read memory, because that's the actual memory allocated by the process itself? Thanks in advance. :)

    C# architecture performance tutorial question learning

  • Very weird kernel32 memory reading results.
    J Jitse

    I tried the example you gave, and it gives exactly the same result as my code. Hehehe, it seems my code was just totally perfect. Apparently many processes in Windows have certain pieces of their allocated memory identically. Is it some Windows-header or so? Anyway, I tried some other more unusual processes, like winlogon.exe (some Windows process), and he just gives something else. And I also tried some other memory positions alot further than 0xFFFF, like 0x20083, and that gives results different from process to process. Just got unlucky to try the wrong processes at the wrong places. Edit: I suddenly notice I actually succeeded reading the memory of a windows process (winlogon.exe), it didn't work after I tried it again... :wtf:

    C# debugging performance help tutorial
  • Login

  • Don't have an account? Register

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