142 thoughts on “Paltalk Timer

  1. Thank you for interest guys, some rooms really need a tool like this one. specially music rooms like us. mic time 45 mins so timer would be great such a rooms like us.

  2. I still don’t know what exactly happened but I am back to where I was now, I had to revert to an old copy but that gave me a chance to clean up some of the crap I tried that failed. I will let you know if i crash Paltalk again when running it because I am at a loss on that.

    Update:
    I know what happened now, VB.NET newbie learned a valuable lesson about Timers! lol
    But it turns out the rewrite was a good thing! I now have better control over the timers. Still crashing Paltalk though.

  3. @autopilot wrote:

    As long as you are not trying to use the return value in any way, the warning can be ignored without causing any crash issues.

    Warnings must never be ignored,, every warning is a bug that will show up at some point. You are going to have bugs without warnings, don’t ignore bugs that are already there.
    If you are not using the return value make it a sub not a function.
    Warnings are logic errors that do not prevent the IDE from creating the applications but they are still errors.

  4. Okay guys, I have made a great deal of progress on my own timer, and i have all the pieces I need and the pieces are working…….Well, I had to have the Admin Bot as a starting point, and it is the perfect starting point!

    Now I did get stuck at one point and almost came back to ask for help but I remember Autopilot’s earlier advice of keeping it as simple as possible, and with that in mind I thought it out and can now step through the NicList and count each raised hand from Index position 1 until I reach a zero. I then reset the counter which triggers it to store the count. All is good there. I decided the next piece would be to check the current user status in order to determine overall room Voice Status. Meaning, if the current speaker drops mic then triggers need to be reset and processed all over again. I decided using a stopwatch timer function that checks the username and mic status every second would be in order. Seems logical, right?

    All works good even have it checking the UserNext on mic as well since the old timer posted had a bug that would call the previous speaker to mic instead of the UserNext. Figured i was on my way to having a timer running by this weekend. Well, after seven minutes of polling a rooms mic status I crash Paltalk. So yeah, I assume I am doing all of this in the Paltalk process itself and gather I need to be offloading all my data to someplace on my form. Well, I am displaying this data on my form all over the place, but maybe it is not being stored separate yet.

    The other possibility is I am trying to do too much with Paltalk at one time since his AdminBot is already monitoring text on a timer, but since it is the NicList that crashes meaning no movement on mic changes but Text still continues scroll along, I suspect I am crashing the NicList itself lol. Damn noobs lol

    I want to learn to interact with SQL databases anyway so I want to ask if it would be a huge mistake from a performance issue to invest the time with this project. In other words, if it would impact performance then this is not the project for me to learn that on.I have already been thinking getting all the Admin Bots lists in a database would allow for more flexibility.

    And what can I do to stop Paltalk from crashing every ten minutes or so lol. All I am doing is running a Stopwatch Timer and it only checks mic status of index 0 and the username of UserOnMic and UserNext. I am going to run it with out checking UserNext and UserOnMic but the UserOnMic is necessary to check for MicJump. i wouldn’t think once a second is too intensive.

    As i keep thinking I have edited this post for the last time, here i am again……..
    okay i broke Paltalk good this time lol.

    no kidding, Usually after these crashes I can restart Paltalk and everything works good til the next crash. This time none of the things that worked work anymore. None of my calls to the Niclist. Going to restart and see if that makes any difference. the ONLY thing I changed was i noticed the Timer properties was set at Interval=1000, and I figured I would be back to say no wonder it was crashing. I have since set it back to 1000 and still no joy. I was riding such a high when I got so close, then Splat! reality brought be crashing back down. I am such a noob . lol

  5. Restart did not help but it reminded me I also had copied all the controls for the Timer to a New Tab because I wanted to have that tab for Rules and Alert Configuration, my final step. But all the controls contained their original names. So Now I am scratching my head as to what the hell happened. I simply relocated the controls to a new tab, and I adjusted the Interval to where i thought i had already, from that point all my controls stopped doing there job. I already reset the timer back as it was before I “fixed” it, and I can’t imagine moving the controls to another tab would break it if they retain their names.

    I copied the project to the other PC and same issue, so now my scalp is sore. I can’t even get the NicList data at all. No Paltalk updates during this time just cosmetic changes. and of course the really bad crash of Paltalk. I’m going to revert back to a clean copy and piece back my steps all over again, but I filled up a tab with timer controls alone lol so it was days worth of work.

    This would be as comical to me as it probably will be to those that read this if it was not so damn frustrating. I was so damn close, and now nothing works, okay, even I have to laugh at it. But my laughter is because I am on the verge of insanity. lol

  6. I dunno how to explain but after someone take mic, it seems like works good in the begining but after a while it keep saying after n after “(nickname)You can take the mic now” and never stop.

  7. loco,
    that is a great start on a mic timer program and i have been looking for a long time! is there any way I can get the code for your last revision? i am new to Visual Basic and need a project like this to tinker with. I have a few ideas I want to try to implement. Keep up the great work man!

  8. it works good, can you make it when we press Stop button it must clear timing. for now when we press stop button it doesnt work and I have to re open software.

  9. Yeps only one 🙂 But I think that happen to me once while I was testing it, the shit went crazy and there were two people, with the hands up, I thought i fix it 🙂

  10. I did a quick update for ya to reset the timer and I fix another bug that when you change the time it wouldn’t reset the clock either lol 🙂

  11. So, it definitely seems to be a memory issue, and yes Departure, I will post the code 😀 for the function that I use for getting the user names. I turned off the Status checks and it still crashes Paltalk. I thought the last few lines before the Return statement freed up the memory. Let me know if you need to see the code to the button that feeds the Index position to this function.

    The only information I could gain from the Event logs pointed to palsound.dll (odd), all windows offered after the crash was to update Paltalk with no other information on what caused the crashed. I notice the crash before it happens, My app stops getting username and status updates but I still have sound and text for about five minutes, the NicList even appears to be working, then Paltalk suddenly closes. The memory usage value varies within 250 – 300 MBs (just over twice what Paltalk loads up at. I seem to be eating memory at a rate of 2MBs/3minutes. During this time there are memory releases but probably from the chat text log buffer.

    Public Function GetUserName(ByVal lstviewhwnd As IntPtr, ByVal itemIn As Integer) As String
    Dim UserName As String
    Dim result As Integer
    Dim myItem As LV_ITEMA
    Dim pHandle As Integer
    Dim pStrBufferMemory As Integer
    Dim pMyItemMemory As Integer
    Dim strBuffer() As Byte
    Dim index As Integer
    Dim tmpString As String = String.Empty
    Dim ProcessID As Integer
    Dim ItemCount As Integer
    Dim i As Short

    ItemCount = SendMessage(lstviewhwnd, LVM_GETITEMCOUNT, 0, 0)
    '**********************
    'init the string buffer
    '**********************
    ReDim strBuffer(StringBufferLength)
    '***********************************************************
    'open a handle to the process and allocate the string buffer
    '***********************************************************
    Call GetWindowThreadProcessId(lstviewhwnd, ProcessID)
    pHandle = OpenProcess(PROCESS_VM_OPERATION Or PROCESS_VM_READ Or PROCESS_VM_WRITE, False, ProcessID)
    pStrBufferMemory = VirtualAllocEx(pHandle, 0, StringBufferLength, MEM_COMMIT, PAGE_READWRITE)
    '************************************************************************************
    'initialize the local LV_ITEM structure
    'The myItem.iSubItem member is set to the index of the column that is being retrieved
    '************************************************************************************
    myItem.mask = LVIF_TEXT
    myItem.iSubItem = 0
    myItem.pszText = pStrBufferMemory
    myItem.cchTextMax = StringBufferLength
    '**********************************************************
    'write the structure into the remote process's memory space
    '**********************************************************
    pMyItemMemory = VirtualAllocEx(pHandle, 0, Len(myItem), MEM_COMMIT, PAGE_READWRITE)
    result = WriteProcessMemory(pHandle, pMyItemMemory, myItem, Len(myItem), 0)

    '*************************************************************
    '*************************************************************
    '*************************************************************
    i = itemIn
    '*************************************************************
    'send the get the item message and write back the memory space
    '*************************************************************
    result = SendMessage(lstviewhwnd, LVM_GETITEMTEXT, i, pMyItemMemory)
    result = ReadProcessMemory(pHandle, pStrBufferMemory, strBuffer(0), StringBufferLength, 0)
    result = ReadProcessMemory(pHandle, pMyItemMemory, myItem, Len(myItem), 0)
    '*************************************************************
    For index = LBound(strBuffer) To UBound(strBuffer)
    If Chr(strBuffer(index)) = vbNullChar Then Exit For
    tmpString = tmpString & Chr(strBuffer(index))
    Next index
    tmpString = Trim(tmpString)

    UserName = tmpString 'added in pititful attempt to turn it into a function
    Form1.TextBox200.Text = tmpString 'This is all i had it doing initally without a return
    tmpString = String.Empty 'added in pititful attempt to turn it into a function

    '**************************************************
    'deallocate the memory and close the process handle
    '**************************************************
    result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_RELEASE)
    result = VirtualFreeEx(pHandle, pMyItemMemory, 0, MEM_RELEASE)
    result = CloseHandle(pHandle)
    Return UserName 'added in pititful attempt to turn it into a function
    End Function
  12. Okay, I am still crashing Paltalk. I have extended my time before a crash to well over an hour. I can work around this issue, by restarting the whole timer app every so often, but would rather figure out why. I suspect I am filling up the allotted memory for my LVITEM structure. I am making a totally uneducated guess here though, and basing it solely on how I was able to extend the time until crash by turning off all ReadText calls, so all I have now are the NicList calls. I could run Paltalk for days without disconnect previously. Still can with the timer app not running. I am only making a call to get User Name and User Status once a second for the user on the mic, with a complete HandCountCheck on MicChange which only runs through the first items that have their hands raised and stops, again, even this iteration is only one per second then it increments to next Index position.

    I am still not 100% I have an issue because I rarely run it that long before I am tweaking the code again for some new idea or feature. But I have left it running in silent mode and ran errands and both times it crashed Paltalk. When ReadText calls are running it crashing withing 15 minutes.

    I really want to be able to run this AND Read Text at the same time. That however is not looking feasible given the crashes, I will report back when i have more info. Otherwise the Timer works fine, just need to add some rules and a few other thoughts.

  13. The only way you can crush paltalk with most code on this site is the nicklist calls as you are allocating and manipulating memory inside paltalk process.
    Post this code we’ll tell ya what’s wrong there.

  14. @Chike wrote:

    The only way you can crush paltalk with most code on this site is the nicklist calls as you are allocating and manipulating memory inside paltalk process.
    Post this code we’ll tell ya what’s wrong there.

    So my instincts were right. I am filling up the memory I am allocating inside the Paltalk Process. Sigh.
    I suppose i could turn off the HandCountCheck and try to split the calls for Status and Name into two ticks, with a simple modification. I will see what that gets me for now. My Code is a simple alteration of codes from Autopilot’s module thanks to a hint from other posts i stumbled on in the forums here.

    The one thing that sticks out about my two functions are they do not return value on all code paths. It suggests I am missing a Return statement. however since it was only a warning I ignored it lol. I am starting to suspect that might be why now. Posting the code is not a big issue for me except I sort of got the impression that the community is willing to help but doesn’t want to make things too easy for folks. The reason I hesitate posting it is only because I learned a great deal figuring out how to get this work to this point. I have also seen ways this could cause disruption when tied with a Mic Jumper, heck, I could make this into a Mic Jumper and have entertained that feature as a way to get someone off mic that is overtime when I did not have Admin rights. But that sort of thing will cause Paltalk to lock down there controls more and I am not in support of that. But yet, I still need help. lol

  15. @ManicMike wrote:

    The one thing that sticks out about my two functions are they do not return value on all code paths. It suggests I am missing a Return statement. however since it was only a warning I ignored it lol

    As long as you are not trying to use the return value in any way, the warning can be ignored without causing any crash issues. I know the code is based on some of my old code and I had some functions that did not return on all code paths, but while it will not crash the app, it is not good code practice to do it. If you do not need a return value, you may want to change the function into a sub.

    My guess is the more likely issue is that the allocated memory probably is not always being freed. This would leave the allocated memory injected into the pal app and cause the kinds of issues you are reporting.

  16. Departure,
    I was hoping to get your take on the function. Do you see why I felt I was releasing the memory, though clearly even I could tell it looked like a memory issue, but I just felt like that code at the end was releasing it. I should have thought to use Task manager well before Chike suggested it, but it is clearly only eating memory when I hit the NicList. I would appreciate any thoughts on why this function doesn’t appear to be releasing memory.

    I took a look at your post, and I think for now UIAutomation is out of my league. But I do plan on trying to work with it since you seem convinced that using it will help with the Paltalk updates breaking code. But I put together what I have by hacking other things and then making it do what I wanted, I can’t do that with this framework yet because there are not enough examples of what I can do with it. Remember, not only am I a noob but I am teaching myself so I am working with a dirt foundation. I am not ruling out UIAutomation, but not sure I can do anything with it at this point.

    While I was perusing Auto-Pilot’s forums, I also read that the method I am using to read the NicList does seem to eventually crash Paltalk, some guy had an even more simple app that read the first username in the NicList every 8 seconds and it crashed Paltalk within a day. Not sure if UIAutomation would still need to hook into the process itself to get the data from the listview. If it can read the list like SysExporter can than I think you are 100% right and this is the way to go, but SysExporter could not get the item.iImage, will be waiting to here if UIAutomation can get the item.Image value.

    For now, I am still enjoying working on the features for the timer, this programming stuff sure is addictive, I can’t tell you how many nights I look at the clock and it is already 3AM and I am still looking at the PC! 😀

  17. Departure,

    I took an even closer look at your demo code after getting a really general overview of UIAutomation, and correct me if I am wrong, but your demo appears to be getting both the username and the status subitems, is that true? I am assuming the 1 and 2 in your final Write statement is getting both values, would like to know if you are successful in that. It is an interesting approach Departure.

    This might help me with the next app I want to make….a fantasy football app (That’s Yankee football not Aussie football lol) This technique might make working with a browser to get team/player stats a lot easier. Am really now very curious about this library, but I biting off more than I can chew, but we’ll see how long I can chew.

  18. Don’t be looking for the easy way out and replace the code instead of debugging it.
    I already know what your problem is, and if it is the ecact same others use they have the same problem too.
    Since you already know where the problem is it should not be difficult.
    I’ll hint you though, and the hint is related to our previous discussion about ignorring warnings and definition of a routine as sub or function.
    Yes I am not making your life easy, it’s not that obviouse of a hint, think.
    But not to make your life too difficult I’ll hint you again, you can find the bug in a single debug walk on the code as posted.

  19. lol chike you got in just before me, I was going to suggest to him to set break point and look at variables while stepping through the code, Also look to make sure your not exiting the function before releasing the memory you created at the start of the function

  20. Departure,
    I am pretty positive I am freeing it up, I have the same basic code Autopilot uses at the end of his, all I really did was edit it to get the status value. Let me keep plugging away at it and see how much further I can get, I was mainly looking to narrow down the possible reasons so I don’t go off in the wrong direction. I’m only reading data so it really is odd that it is crashing Paltalk at all. Departure, I really do appreciate your thoughts though.

    Chike,
    I am inclined to agree with Autopilot in this case because I really am using the function more like a Sub anyway, it directly sets the value of a Textbox rather than passing the value back. However Chike, I think you are right about eliminating things that you can eliminate. No need to willfully introduce errors. I have corrected that issue so no more warnings, but I doubt that’s crashing paltalk and the timer works fine.
    I think I’ll add another LVITEM structure for the UserName calls other than the one I’m using for the UserStatus calls . I’ve also combed through the code and eliminated a couple extra checks. Going to institute some sort of process that only checks once every 5 or 10 seconds when no one is one mic. Let me see where I stand after all that. I do appreciate all the input though. I recognize all of you from my forum reading lol.

    Thanks again all of you.

  21. LOL you are just going to wait longer for crashes.
    You realy want to check as many times as possible and make it crush quckly, for testing only of course.

    If the Textbox is part of the class the Callback is and the callback is not shared, that’s ok.
    Rule #2: do not use global varibles.

    What reason you have to use different structure for LVITEM?

  22. I was thinking that each LVITEM structure might be it’s own chunk of memory. I was grasping at straws and i think might have shown how funny noobs can be with their odd assumptions! lol I had also thought it was just the structure that the chunk of memory would be using as well, but as i said I was grasping at straws and admittedly still piecing it all together. Clearly, I have a long way yet to go, but damn I am having fun!

    I understand what you are saying and perhaps you are right, maybe i need to think the other way and see what it is i adjust that is doing the crashing. When I was using my first attempt at making this I was able to crash Paltalk within 15 minutes, but I had one timer accidently set to check 10 times a second lol.

    Thanks for the idea Chike.

  23. Damn noobs lol. I should have thought of that. Working on crashing it now, but without tweaks, just curious how long it goes is all. I will get back when I have more information.

  24. It’s not clear from documentation what happen if you commit without reseve, but you should call VirtualAlloEx with MEM_COMMIT or MEM_RESERVE

    Would also help of you publish LVITEM structure decleration.

  25. Const StringBufferLength As Integer = 255
    Const LVM_FIRST As Integer = &H1000
    Const LVM_GETITEMCOUNT As Integer = (LVM_FIRST + 4)
    Const LVM_GETNEXTITEM As Integer = (LVM_FIRST + 12)
    Const LVM_FINDITEM As Long = (LVM_FIRST + 13)
    Const LVM_SETITEMPOSITION As Integer = (LVM_FIRST + 15)
    Const LVM_GETITEMPOSITION As Integer = (LVM_FIRST + 16)
    Const LVM_GETITEMTEXT As Integer = (LVM_FIRST + 45)
    Const LVM_SORTITEMS As Integer = (LVM_FIRST + 48)
    Const LVM_GETSELECTEDCOUNT As Integer = (LVM_FIRST + 50)
    Const LVM_GETITEM As Integer = (LVM_FIRST + 75)
    Const LVNI_SELECTED As Integer = &H2
    Const LVFI_PARAM As Integer = &H1
    Const LVIF_TEXT As Integer = &H1
    Const LVIF_IMAGE As Integer = &H2
    Const LVM_FINDITEMW As Integer = (LVM_FIRST + 83)
    Const LVIS_SELECTED As Integer = &H2
    Const LVIF_STATE As Integer = &H8
    Const LVM_SETITEMSTATE As Integer = (LVM_FIRST + 43)
    Const PROCESS_VM_OPERATION As Integer = &H8S
    Const PROCESS_VM_READ As Integer = &H10S
    Const PROCESS_VM_WRITE As Integer = &H20S
    Const MEM_COMMIT As Integer = &H1000S
    Const PAGE_READWRITE As Integer = &H4S
    Const MEM_RELEASE As Integer = &H8000S
    Const MEM_RESERVE As Integer = &H2000S


    Structure LV_ITEMA
    Dim mask As Integer
    Dim iItem As Integer
    Dim iSubItem As Integer
    Dim state As Integer
    Dim stateMask As Integer
    Dim pszText As Integer
    Dim cchTextMax As Integer
    Dim iImage As Integer
    Dim lParam As Integer
    Dim iIndent As Integer
    End Structure
  26. Chike,

    I would rather learn than have you solve it for me anyway, but I might need better hints lol!
    I totally turned this code into a sub now to rule out my inexperience with how functions function as the culprit. I also noted Departure’s advice about breakpoints. Now, I have seen that advice throughout the forums and even tried it once and was left scratching my head as to what good that was……until I decided to google debugging tips on VS2010 and realized that breakpoints is just the beginning, I had expected when i stepped through to see the variable information in the Output window or Immediate Window, had no idea you could hover over the variables and see the values and even pin them so no need to hover! Then I googled some more and learned there are conditional breakpoints and trace points and now I am getting a better idea of the tools of the trade for debugging. I figure I am still missing some pieces in the debugging process and obviously lacking experience in using the tools and deciphering it all.

    I point this all out, partly to reiterate how much of a noob I am so you guys remember that when giving hints, but I also point this out because I want you to see that I am willing to research things on my own, but do need these nudges and I am glad you guys are willing to entertain my ignorance….then again, maybe my ignorance is entertaining you! lol

    So this is where I stand now, i have added the code to the button click event that was used to feed the index position value and removed the Return statements. The Timer program still functions as it did, fortunately and unfortunately it still has the same issue. The only other warning I have is that GetwHndByClassNameByPartialCap is not returning a value on all codepaths but that warning has been with this AdminBot code since I first started playing with it and this issue only started with the Timer code i have added.

    When I was playing around with the newly discovered debugging tools, I saw the result variable was 1 all the way through the codewalk until the CloseHandle statement when it went 0, my gut tells me that is a good thing, but my head tells me that 0 could mean false and might be an error. Then it occurred to me, what is this result variable used for? My desire to see how things work I removed the “result = ” from those lines of code that had it in my sub and noticed it still worked just fine. I figure they are there for a reason, but for the life of me, I can’t figure out what this result variable is all about. Screwing around with the code is how I have put together what I have so far, I realize this is not the best method, but it is what it is.

  27. Oh wow return code has meaning, who would have thought.
    To figure it out all you need is to google the function name it the meaning of each return code will be in the documentention.
    Now back to teh code and examine carefullt those return codes.
    And here’s another jint for you” you may need to call GetLastError.

  28. Chike,

    I read up on the CloseHandle function and found out a zero is not a good thing afterall lol. so that is what return codes are for lol.

    I am trying to find out what the error is now, It looks like I need to figure out how to use Err.LastDLLError now.
    even after following examples all i get from Err.LastDLLError is a zero, which doesn’t tell me as much as I was hoping lol

    I just wanted to say all the help is appreciated, I know it is frustrating dealing with someone that should have the basics down before being at this point.

  29. Use a call to windoe’s GetLastError, that will always work.
    What is CloseHandle and VirtualFreeEx functions decleration?
    BTW the value of result is valid after making the call, meaning when the debugger is line after, when the yellow arrow is pointing on the line it has not been excecuted yet.

  30. yeah, it took me a while to figure out it was trigger after it passed the line. I am definately getting a 1 on all CloseHandle runthroughs. The zero is on the VirtualFreeEx, and yes I checked that documentation and low and behold a zero there is not a good thing either. So, clearly this is the problem point, thanks chike for letting see the troubleshooting process play out. I see how these tools play together. At first runthrough in the VirtualFreeEx docs I am wondering if I might want to think about the MEM_DECOMMIT instead? After reading it looks like MEM DECOMMIT would possibly make it worse lol. MEM_RELEASE certainly appears to be the right way to go. I will google some more.

    GetLastError is not declared. I did see on MSDN that VB is suppose to use the Err.LastDLLError property now, but I certainly could be wrong, but they printed it in bold on the CloseHandle Doc page. the example i found used a MessageBox to display the last error code using the Err.LastDLLError property. it returns a zero as well, which doesn’t tell me what the error is. bummer.

    So all I know for certain is the thing is not closing the process. again bummer.

  31. It’s weird CloseHandle returns an error.
    Do I need to beg you for functions declerations?

    Yes you need to declare it dllomport, something like

    Declare Auto Function GetLastError lib "kernel32.dll" () As ULong 

    Here, now GetLastError is declared.

  32. Ah lol
    I did see that request and truly did forget about it, lol

    ANd, No, I edited that out or the original post. It is fine. it is VirtualFreeEx thans returns a zero

    Declare Function VirtualAllocEx Lib "kernel32" (ByVal hProcess As IntPtr, ByVal lpAddress As IntPtr, ByVal dwSize As Integer, ByVal flAllocationType As Integer, ByVal flProtect As Integer) As IntPtr
    Declare Function VirtualFreeEx Lib "kernel32" (ByVal hProcess As IntPtr, ByVal lpAddress As IntPtr, ByVal dwSize As Integer, ByVal dwFreeType As Integer) As Integer
    Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As LV_ITEMA, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
    Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As LV_ITEMA, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
  33. @ManicMike wrote:

    ANd, No, I edited that out or the original post. It is fine. it is VirtualFreeEx thans returns a zero

    for that I would write code like this


    if VirtualFreeEx(..) = 0 then
    result = GetLastError()
    endif

    That would get you closer to what you are looking for.

    Is all the code originaly from autopilot code, or someone else?

  34. Yeah, it is autopilot’s code originally, but I have messed with it some, but very little. But any obvious errors are certainly my contribution lol
    Working on getting your last suggestion working now, thanks again

  35. I got some 20digit number as a return value….Not sure I have this working right.
    It consistently returns the same 20 digit value too, i am starting to wonder if this is the starting address of the memory being used, but does that help me? lol

  36. @ManicMike wrote:

    I got some 20digit number as a return value….Not sure I have this working right

    From GetLastError using this code?

    Declare Auto Function GetLastError lib "kernel32.dll" () As ULong 

    You should get onlt 2 digits.
    The return code is only meaningful it there was a call that failed and before making any other call.

  37. @ManicMike wrote:

    i am starting to wonder if this is the starting address of the memory being used, but does that help me? lol

    Of both ponters? And if it is how the @#$% did you build the user name?

  38. Ok, let me explain how I got the GetLastError to work first and how I used it.

    I first started out with your examples, but there were some expected arguments and I ad libbed with help from the IDE. It suggested I import the System.Runtime.interopservices and then it gave an error on the DLLImport itself but led me to suspect i could comment it out and run with your Declare statement and it all seemed error free. So I put the If statement in your final post right after the VirtualFreeEx statement and as I go through and VirtualFreeEx gets its 0 it runs through the If statement and returns this 20 digit number after it processes the GetLastError statement

  39. Let me also add that I am doing my breakpoint using the Status sub assuming both subs have the same issue. just the Status is the first place it hits and seemed like the logical breakpoint. I just set another breakpoint in the other name sub with the same conditional statement and am getting the same 20 digit number

    I forgot to add another ad lib that might explain the 20 digit number. I edited this part of the if statement

    if VirtualFreeEx(..) = 0 then
    result = GetLastError()
    endif

    to

    if result = 0 then
    result = GetLastError()
    endif

    that seemed logical but suddenly is making me wonder if that is why it is acting weirder than you expected

    And yes directly following the VirtualFreeEx statement right before the closeHandle

  40. @ManicMike wrote:

    I forgot to add another ad lib that might explain the 20 digit number. I edited this part of the if statement

    if VirtualFreeEx(..) = 0 then
    result = GetLastError()
    endif

    to

    if result = 0 then
    result = GetLastError()
    endif

    that seemed logical but suddenly is making me wonder if that is why it is acting weirder than you expected

    And yes directly following the VirtualFreeEx statement right before the closeHandle

    No that does not change anything
    If you break before the call to GetLastError and step over it do you see reult change? (value in red)

  41. The break is on the VirtualFreeEx line so it is before GetLastError, I do see the values change from 0 to this 20 digit number, I can go back even further and get some 1’s before the 0, but the Close handle returns a 1

  42. Chike, this process has taught me a great deal. I appreciate the help. If it is late where you are it can keep til later. but i am going to be up myself

  43. That returns value 87. Cool, I will have to learn what the difference is between these two methods. Does 87 tell you anything more about what the issue is? I see no information on what the code might mean in the documentation for VirtualFreeEx

  44. http://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx

    Hmm lets see…

    you get an error on this? with error code 87?

    result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_RELEASE)
    result = VirtualFreeEx(pHandle, pMyItemMemory, 0, MEM_RELEASE)

    MSDN says this..

    ERROR_INVALID_PARAMETER
    87 (0x57)
    The parameter is incorrect.

    You have declared the function like this…

    Declare Function VirtualFreeEx Lib “kernel32” (ByVal hProcess As IntPtr, ByVal lpAddress As IntPtr, ByVal dwSize As Integer, ByVal dwFreeType As Integer) As Integer

    You created variables like this…

    Dim pHandle As Integer
    Dim pStrBufferMemory As Integer
    Dim pMyItemMemory As Integer

    MSDN says this about VirtualFreeEx…

    Parameters
    hProcess [in]
    A handle to a process. The function frees memory within the virtual address space of the process.
    The handle must have the PROCESS_VM_OPERATION access right. For more information, see Process Security and Access Rights.
    lpAddress [in]
    A pointer to the starting address of the region of memory to be freed.
    If the dwFreeType parameter is MEM_RELEASE, lpAddress must be the base address returned by the VirtualAllocEx function when the region is reserved.
    dwSize [in]
    The size of the region of memory to free, in bytes.

    hmm Parameter lpAddress [in] requires a pointer, pStrBufferMemory As Integer and pMyItemMemory As Integer seems you are passing an integer value and not a pointer?

    I could be completely wrong here as I haven’t personally used this code or looked through it properly.

  45. Link didn’t work, trying to locate the URL the old fashioned way through google now, clearly you would not have posted a link unless it was relevant, Damn MSDN too, I was on MSDN for the documentation, I didn’t see anything about this, I found one obscure reference to this function returning 87 refers to non aligned pages or something, but that was the only thing I came up with, still googling

  46. I see why you say that…You laid that out very well. But when I hover over the pMyItemMemory is does say it is being declared as a IntPtr (after I edited it to do so) though and has a ten digit value set for it during codewalks, i am assuming that is the lpAddress

    It returns 87 whether it is declared as Integer or IntPtr

  47. @Departure wrote:

    http://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx

    i added the .aspx too and it still came out as Page not found error, but I suspect your post gave me the particulars. I am googling now to see what I can found out, Just all the other functions autopilot is using in his syslistview module seem to work the same way. Well, it is not like we use his functions once a second either. so they might have the same issue. But IntPtr made no change.

    I did a search for ms681382 and NOW I see what you where linking me too. a list of Error Codes! Awesome! lol Bookmarked for future quick access. no doubt I will use this a lot.

  48. @Departure wrote:

    hmm Parameter lpAddress [in] requires a pointer, pStrBufferMemory As Integer and pMyItemMemory As Integer seems you are passing an integer value and not a pointer?

    I could be completely wrong here as I haven’t personally used this code or looked through it properly.

    The ponters should be declared IntPtr but this does not make a difference in 32bit winfows, and it didn’t bother the write/read memory functions, so why whould it be different?

    If VirtualAllocEx returned a value greater than 32bit it would raise an exception in runtimewhen trying to assign it to an integer.

    So what other parameters are there that can turn to be a bad parameter?

    @ManicMike wrote:

    I did a search for ms681382 and NOW I see what you where linking me too. a list of Error Codes! Awesome! lol Bookmarked for future quick access. no doubt I will use this a lot.

    Yeah I did that too back in the days, now my bokmarks list is so long I just coogle “windows error codes”
    So now that you have all the information you need, chop chop.

  49. lol @ chop chop

    I get the issue is that it is not releasing the memory, but from what I can tell I am giving it the proper parameters. clearly I am not or am missing something. The Error message indicates that it doesn’t like the parameter I am giving it, but lol it is all I got to give it. I will try to think outside the box. I will study up on the functions involved and see what pops up, I have no issue with you guys holding back on me.

    Just to verify what you said about the IntPtr, it did not alter the symptoms one bit.

    I will post back if I need another hint. I can see there more than a few functions documentation that I need to read on this.

    I do appreciate the lesson in how to properly troubleshoot code issues. I feel silly now looking back at how I didn’t see the value of setting a breakpoint, just didn’t occur to me to hover over variables. That really does make troubleshooting code very logical.

  50. @ManicMike wrote:

    I get the issue is that it is not releasing the memory, but from what I can tell I am giving it the proper parameters. clearly I am not or am missing something.

    Those stupid programmers at microsoft i’m telling ya.
    “from what I can tell”…
    Lets for a moment assume them microsoft programmers are not THAT stupid, and there is/are bad parameter(s).
    We (I) already excluded the option it’s the pointers, what else we got?
    1. Process handle, but closehandle as well as VirtualAllocEx don’t fail.
    2. Size, but you pass 0 which is in comliance with the documentation and the type of free you want to make.
    3. Free type, but that looks to be what it should according to documentation, or is it? (damn big hint)

    Not everything is what it “looks” to be, you have to know how to look.

  51. Damn good hint Chike

    Now getting a return of 1

    Making changes to all subs and going to test it out. and while testing I will be googling why some Const have an S at the end. I took a guess and added it though the example I saw didn’t have it. Seemed logical to add the S since the MEM_COMMIT had it. I have learned a great deal. Thanks guys.

    Final Update to this issue:
    Issue Resolved thanks to Chike’s smacking me over the head with a clue club.

    Good call Chike.

  52. The S just make them “short” that is a 2 bytes signed integer, when converted to 4byte Integer the sign is kept and the original hex value is lost
    Mp S should have been there in the first place, if at all the all should have UI or UL.
    I think the hex constants default to integer, if they are greater than integer valu you will get an error.
    Most if not all flags in windows are DWORD, that’s an unsigned 64bit integer, that’s how they should be declared and passed to the function to avoid any complications.

    EDIT: another rule to follow” if it aint broke, don’t fix it! Particulary when you are a n00b and what may seem logical to you is a big no no.

  53. @Chike wrote:

    EDIT: another rule to follow” if it aint broke, don’t fix it! Particulary when you are a n00b and what may seem logical to you is a big no no.

    Can I get that engraved on my laptop? I had to add the CONST for it, I HAD no choice but to guess, but yes I have been known to tinker in order to see what it breaks so I understand what is happening. it has gotten me further than I expected, and that only fuels the fire to learn more lol

  54. no MEM_DECOMMIT Const at all, it had an error until I added the Const

    but I learned a great deal about how to troubleshoot thanks to you doing this the “right way” rather than the “easy way” and I am encouraged that my instincts seem fairly good and I think I might have the head for this coding thing

  55. You don’t neee no MEM_DECOMMIT, and MEM_DECOMMIT won’t cause this kind of error becase its a positive short integer value.
    You only need MEM_RELEASE and add “or MEM_RESERVE” to the allocation just to be on the safe side.
    There was no MEM_DECOMMIT it the original code you posted, DID you add the S to MEM_RELEASE or was it there before?

  56. There was only a MEM_RELEASE , MEM_COMMIT, and MEM_RESERVE Const(s) declared and yes they all had the S but I thought your hint was to use MEM_DECOMMIT which is what fixed the issue. and I had to add that Const

  57. but I did not Remove the S from MEM_RELEASE

    that was not one of my tweaks, when I asked about the S at the end of those Const it was because that was the first time I had seen them, the first thing I did was change MEM_RELEASE to MEM_DECOMMIT in the sub and it errored saying it was not accesible. I guessed at the Const. but think i guessed right. I figured it was a declaration at that point. I googled examples of how to declare a const for MEM_DECOMMIT and the one I found did not have the S on it but since I saw my code had an S on the MEM_COMMIT I went with the S

  58. C’Mon, I deserve an A+ don’t I? lol

    but could NOT have done it at all without your help Chike…seriously man I appreciate it and learned a lot

  59. @Chike wrote:

    You are talking about MEM_DECOMMIT that is not in the code you have posted, and removing the S from it/
    What code you talking about?

    That is correct, the MEM_DECOMMIT was what I used instead of MEM_RELEASE for the dwFreeType in the VirtualFreeEx statement. when I made that change the IDE gave an error that it was not accessible. I assumed that meant it was not declared and scrolled up and saw the othe MEM_* Const and noticed it needed to be added. Googled for examples, tweaked the example, and voila. issue gone now

  60. Are you sure the “issue” is gone?
    I propose to you the following code to debug:


    result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_DECOMMIT)
    result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_RELEASE)
    result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_RELEASE)

    Report back with your findings and conclusion.
    More rules to follow:
    Don’t change 2 things at a time as you won’t be able to tell which one made the difference.
    A correct return code does not mean the issue is solved.

  61. @Chike wrote:

    Are you sure the “issue” is gone?

    Pretty sure, time will definitely tell, but I based it on far more than just getting my 1 lol, I had a pretty good baseline from the previous week of how Paltalk looks when my Timer was not running and when it was. It was fairly easy to tell since when my Timer ran The Memory Set Delta was a steady 16 with occasional 20 and 24 and rare memory releases from other processes, 0’s were more rare than memory releases. But when my Timer was off there was more 0’s than anything and that is just how it is looking now. but you are right, Time will have to tell if the issue is resolved.

    @Chike wrote:

    I propose to you the following code to debug:


    result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_DECOMMIT)
    result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_RELEASE)
    result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_RELEASE)

    Report back with your findings and conclusion.

    I have another copy on another machine I am bringing up to date with this new findings and will add this code there and gladly report back. I want to let this thing run for now to see if it crashes Paltalk. but it really seems to be resolved since it is hardly even noticable in Task Manager.

    @Chike wrote:

    More rules to follow:
    Don’t change 2 things at a time as you won’t be able to tell which one made the difference.
    A correct return code does not mean the issue is solved.

    I really only made the one change which needed another change inorder to work 😆
    But absolutely an excellent Rule of Thumb

  62. @ManicMike wrote:

    @Chike wrote:

    Are you sure the “issue” is gone?

    Pretty sure, time will definately tell

    Hrere you trying to puspond instead of accelerating.
    You want t know right away, not wait a hald day or more.

    @ManicMike wrote:

    I really only made the one change which needed another change inorder to work 😆
    But absolutely an excellent Rule of Thumb

    What two changes exactly? You talking in riddles.

  63. @Chike wrote:

    The S just make them “short” that is a 2 bytes signed integer, when converted to 4byte Integer the sign is kept and the original hex value is lost
    Mp S should have been there in the first place, if at all the all should have UI or UL.
    I think the hex constants default to integer, if they are greater than integer valu you will get an error.
    Most if not all flags in windows are DWORD, that’s an unsigned 64bit integer, that’s how they should be declared and passed to the function to avoid any complications.

    EDIT: another rule to follow” if it aint broke, don’t fix it! Particulary when you are a n00b and what may seem logical to you is a big no no.

    Never seen an S like that before, I even went back on page 4 to see the declarations of consts, btw a short integer is just a word and a integer is a dword which is 32bit not 64bit… a 64bit integer is actually int64 or dword64 which I have no idea why they named such a stupid name instead of QWord or something similar.

    I would never have picked up looking at how you have declared the consts, this is just another reason why I dislike .net and the stupid declarations, Delphi has all these types of things already defined, Its only the undocumented API’s which you can define manually..

  64. I have two machines and two copies of Express, I have only been working with this one machine the other one has some code with a stripped down version of the AdminBot that i want to now get working like this one. Welcome to my manic mind Chike. I apologize in advance lol

    But I hear you i should probably crank up the timers,

    Just trying to abide by the if it ain’t broke rule lol

  65. There is a type QWORD lol they prolly have their reasons.
    Anyway converting from a signed integer value to a larger integer value, signed or unsigned, without converting it first to unsigned short integer extends the sign to reflect the actual value.

    @ManicMike
    You don’t even need the timer, just add the lines I have posted, and debug them.

  66. Yes there is but microsoft don’t call it that, but at the end of the day its size of memory allocated, I normally see types as the following because when i do programing I tend to spent alot of time in ollydebug

    byte = 1 byte = 8 bits aka Byte
    word = 2 bytes = 16 bit aka short Integer
    dword = 4 bytes = 32bits aka Integer,
    Fword = 6 bytes = 48bits aka ?
    QWord = 8 bytes = 64bit aka long integer

    Now for your singed Integers ect.. I am not sure how it works but I think its little endian and big endian that determines signed and unsigned, BUT the point being its still the same amount of memory allocated which is 32bit aka dword aka Integer

  67. lol, but then i would have to shut down my first baseline with the tweaked MEM_DECOMMIT, anyway it was not that long of a wait for me to update the other machine’s copy, the results are in paratheses and yes they are the results after it leaves the line assigned to it,

    (1) result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_DECOMMIT)
    (0) result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_RELEASE)
    (0) result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_RELEASE)

    I went ahead and added these too
    (1) result = VirtualFreeEx(pHandle, pMyItemMemory, 0, MEM_DECOMMIT)
    (0) result = VirtualFreeEx(pHandle, pMyItemMemory, 0, MEM_RELEASE)
    (0) result = VirtualFreeEx(pHandle, pMyItemMemory, 0, MEM_RELEASE)
  68. I was going to crank up the timer on the other copy to see if it might crash Paltalk, because as it is i hardly notice my Timer’s memory usage now. but it is functioning as expected

  69. Why do you insist to wate time when you can have the answer in few minutes?
    If you realy want to test it surround the alloc/free code with a 1 to million loop.

    Does my code looks like it’s a code to add to your code? I said debug it.

  70. Because I am a noob dude. last thing I want to do is fry my laptop by doing something stoopid lol

    I have already wound up with a Soltaire cascade of pop windows lol

  71. @Chike wrote:

    Why do you insist to wate time when you can have the answer in few minutes?
    If you realy want to test it surround the alloc/free code with a 1 to million loop.

    I will work on setting up the loop up and get back to you.

    @Chike wrote:

    Does my code looks like it’s a code to add to your code? I said debug it.

    Actually, yeah, I figured you had your reasons, you want to see Error codes, gotcha.

  72. @ManicMike wrote:

    @Chike wrote:

    Does my code looks like it’s a code to add to your code? I said debug it.

    Actually, yeah, I figured you had your reasons, you want to see Error codes, gotcha.

    You can add GetLastError calls if you want, but we can make some “safe” assuptions(oops i’m not doing as i preach) without them.

  73. @Chike wrote:

    Where when what?
    Code is about specificities (is there such word) .
    Describe exactly what results you had, try to make a conclusion.

    'deallocate the memory and close the process handle
    '**************************************************
    (1) result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_DECOMMIT)
    (0) result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_RELEASE)
    If result = 0 Then
    (87) result = Marshal.GetLastWin32Error
    'result = GetLastError()
    End If
    (0) result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_RELEASE)
    If result = 0 Then
    (87) result = Marshal.GetLastWin32Error
    'result = GetLastError()
    End If

    The only conclusion i can draw from this at this point is that the parameters are not being satisfied adequately for the MEM_RELEASE to process properly. I suspect the clue is in how you felt that removing that S from MEM_RELEASE would fix it it lol

    Yes, I was reading the exchange between you and Departure and I suspect I more clues lie in that exchange. I will play around with trying to get MEM_RELEASE to work by removing the S and see what happens before I form any conclusions. then if that also works I will have to figure out which one is best. My gut originally was that MEM_RELEASE made more sense.

  74. I just realized why you thought that I was thinking I was supposed to add that code…it is because I took the initiative to add the lines to that other statement earlier, i assumed you were troubleshooting and I wanted to be torough, I knew you were adding those lines to troubleshoot, but I really thought you just wanted to see the return codes I did not realize you wanted full debug of the reason. And yes I totally understand and have for awhile now that the MEM_RELEASE is not liking the parameters but as you pointed out the only one that is not used elsewhere is the dwFreeType. so either I need to USE the MEM_DECOMMIT which just does not make sense to me based on the docs, though i get DECOMMIT would work. Now if it is about that S thing then that is totally new to me and I will be honest and admit that my eyes glossed over a little when I was reading that exchange since it was stuff I kinda understand and get it is going to be really important late on down the road lol but for now I just want to fix my timer so I can get back to my features lol just kidding. it is ALL really great stuff guys. I can see you guys know your stuff and I have no problem learning along the way…in fact, I insist on it lol

  75. did you guys see the mania kick in at the end there? what a run-on sentence that was lol, That is what it is like in my head. Trust me you do not want to go there lol

    Okay removing the S does fix the issue too I think. now I got a dilemma lol

  76. LOL!

    Then I must be dreaming because I have now commented out my DECOMMIT and using the MEM_RELEASE statement and it is returning a 1 on the first one and a 487 on the second one

    I went ahead and commented out the other DECOMMIT statements and re-enable MEM_RELEASE on on four of my subs and when running the program it is much better but still using more memory than what it was with the DECOMMIT. Which means I have been convinced DECOMMIT is better and think i get why too. Damn shame I had to take the long route to get here. but I couldn’t afford the Bus ticket

  77. You’re brain is a realy good subject for a study.
    Is it that complicated to run those 3 lines as I posted them and see what you get for each one of them?
    No more, no less, no commenting out anything, no adding anything anywhere else, just those 3 lines.
    I am trying to make a conclusion here.

  78. @ManicMike wrote:

    Dude, I did that three or four posts ago

    You mean this?
    @ManicMike wrote:

    Removing the S from the MEM_RELEASE Const did allow it to return a 1

  79. @Chike wrote:

    @ManicMike wrote:

    Dude, I did that three or four posts ago

    You mean this?
    @ManicMike wrote:

    Removing the S from the MEM_RELEASE Const did allow it to return a 1

    This:

        'deallocate the memory and close the process handle
    '**************************************************
    (1) result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_DECOMMIT)
    (0) result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_RELEASE)
    If result = 0 Then
    (87) result = Marshal.GetLastWin32Error
    'result = GetLastError()
    End If
    (0) result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_RELEASE)
    If result = 0 Then
    (87) result = Marshal.GetLastWin32Error
    'result = GetLastError()
    End If
  80. @Chike wrote:

    I thought we put the S behind us already.
    These are results with S though.

    Betcha $100.00 lol
    Seriously dude, That is the fix, I have full control of the issue i can recreate it at will have twice now.

    The error 87’s ONLY come WITH the S in the MEM_RELEASE Const
    i get no error at all without the S

    Do I get that A+ now?

    Cool we have two solutions, but dude seriously I could not have done it without your help. I really had no idea how to troubleshoot once using a breakpoint, i got it now, still lacking a boatload of experience though.

    The memory usage is better, I see more memory releases..the baseline is 4K memory set change deltas with a lot of 4K releases that I did not have…proof again of MEM-RELEASE functioning w/o the S

    But MEM_DECOMMIT is my choice I think, I like the idea of having the memory reserved for my LVITEM

  81. @ManicMike wrote:

    @Chike wrote:

    I thought we put the S behind us already.
    These are results with S though.

    Betcha $100.00 lol
    Seriously dude, That is the fix, I have full control of the issue i can recreate it at will have twice now.

    The error 87’s ONLY come WITH the S in the MEM_RELEASE Const
    i get no error at all without the S

    Do I get that A+ now?

    Yes the fix is removing the S, and no you’re not getting A+, actually i was thinking to denote you to A- for partial answers.

    @ManicMike wrote:

    Cool we have two solutions, but dude seriously I could not have done it without your help. I really had no idea how to troubleshoot once using a breakpoint, i got it now, still lacking a boatload of experience though.

    No there is only one solution, now you understand why I need full answers and making a solid conclusion?
    What are the results for those lines without the S?

  82. lol good thing we didn’t shake on that bet then, huh?

    I will look at exactly what that S is doing and it helps that I have a nice overview from your earlier posts.
    But you had mentioned that the S should not have been there. the S is after all the other MEM_* statements, and they seem to work just fine.

    Chike, I appreciate your patience in dragging this out. I hope I did not make it too tedious lol

  83. Without the S in MEM_RELEASE

     '**************************************************
    (1) result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_DECOMMIT)
    (1) result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_RELEASE)
    If result = 0 Then
    () result = Marshal.GetLastWin32Error
    'result = GetLastError()
    End If
    (0) result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_RELEASE)
    If result = 0 Then
    (487) result = Marshal.GetLastWin32Error
    'result = GetLastError()
    End If

    With S in MEM_RELEASE

    **************************************************
    (1) result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_DECOMMIT)
    (0) result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_RELEASE)
    If result = 0 Then
    (87) result = Marshal.GetLastWin32Error
    'result = GetLastError()
    End If
    (0) result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_RELEASE)
    If result = 0 Then
    (87) result = Marshal.GetLastWin32Error
    'result = GetLastError()
    End If

    Ergo, 😀

    When the S is used I cannot use MEM_RELEASE at all but I CAN use MEM_DECOMMIT
    Without the S I can use either MEM_RELEASE or MEM_DECOMMIT, but I think MEM_DECOMMIT is the better choice.

  84. Ah! Very well explained. I totally get what you trying to show me and there is no way I would have figured that out on my own which is why a good foundation is important and I will always lack that. I wish I could go to school for it but for now my foundation is dirt and I swear they got it from a cow pasture lol

    Thanks for all the time and for laying things out in an easy to follow manner Chike. I did learn a great deal not only about how to debug, and thanks for the hex tip, i did not know that, but I also have learned more about this memory hooking process works, clearly i have a lot to learn but now with my newly discovered debug tools I can play around. For now I really want to get my features coded, and then work on getting some of the data attached to an SQL server. it started out as just wanting to query admin lists and some of the other filters i have set up for room text on a per room basis, and a database would mean one table and an assortment of queries to get the lists for each room. Plus I want to use active filter that only runs the filters on users that are in the room. But I also want to archive room logs. Not consistently, but I want it dumping to a database and then i will decide if there was anything worth saving. But I also want to track mic events as well for statistical reasons and well mainly just cuz I can lol

    The entire project was always intended as more than just getting a much needed mic timer but to also be more fun than the “Hello World” projects.The next feature will be remote control of the program from room text and I already have ideas on that. Then I hope to start that Fantasy Football app, but that will be a massive undertaking, this is more my speed for now. And as noted I have plenty of features left to implement. Thanks again Chike for everything.

    So, it is just a relief to have this issue off my plate.

  85. So what can we learn from this.
    First the most obviouse, is that the S va’se some bad value for MEM_RELEASE, as of the whys I’ve mentioned it aroud Departurs post sp I won’t repear it again.

    BTW did I mention you can view values as hexdecimal in the debugger? Sorry if I didn’t, you can right click the value that pop up when you hover with the mouse over the variable, or in local varivles and select the hexdecimal view.

    And the second conclusion is that you can call VirtualFreeEx with MEM_RELEASE after calling it with MEM_DECOMMIT but not after MEM_RELEASE.

    You could also try calling MEM_DECOMMIT after MEM_RE:EASE and see you get the same result/

    What does that mean? It means the pointer is still valid after decommit, but is invalid after it is releaced, hence your problem cannot be solved by using decommit. It may last longer because no physical pages are commited but the address space is reserved.

    “Decommits the specified region of committed pages. After the operation, the pages are in the reserved state.”
    http://msdn.microsoft.com/en-us/library/windows/desktop/aa366894(v=vs.85).aspx

  86. If the S in the original code it was not noticed so far because this code is seldom used, only when a bounce or reddot is needed.

    LOL the hex tip might have saved you some time but I need to inflict some hard time on you too 😛

    I suggest changing flash to be UInteger ,
    You would get compilation error when the high bit is set (negative number) so just add UI (like &H80000000UI)

  87. @Chike wrote:

    If the S in the original code it was not noticed so far because this code is seldom used, only when a bounce or reddot is needed.

    The S was there originally but yeah I suspected that if I were to set it up to highlight someone every second the samething would happen but was no real need to test that theory out.

    @Chike wrote:

    LOL the hex tip might have saved you some time but I need to inflict some hard time on you too 😛

    Yeah, I half suspected that too lol. And I understand most ppl come in here expecting you to do it all for them. I wanted to learn VB all along this was a means to that end, but yes i had a need for a mic timer too but I definitely learned more doing it sorta by myself granted not from scratch but still, I really value the lessons learned more than having a timer. but I do have fun coming up with ideas and making them work.

    @Chike wrote:

    I suggest changing flash to be UInteger ,
    You would get compilation error when the high bit is set (negative number) so just add UI (like &H80000000UI)

    You totally lost me here. Flash? is that as in the list refresh flash?

  88. Yes I saw the original code, and not only the S is there but MEM_RELEASE is declared as short.
    The return code is assigned to result, I wonder how Autopilot have’nt noticed it.

    Flags. Read between the typos.
    Mosy flags are passed as DWORD which is an unsigned 32 bit integer(I stand corrected), that is UInteger.
    A value like Which has it’s high bit set will cause compilation error, so just add UI at the end of the constant to fix it. e.g.

    const some_flag as uinteger = &HA0000000

    will raise error, so declare it

    const some_flag as uinteger = &HA0000000UI
  89. So we can add to the list of things I learned today:

    That bugs will more than likely occur in our codes no matter how good the IDE are or how much we try to keep them out. thanks again Chike, learned a lot.

  90. Actually this project works well on the new version of Paltalk, I even added a new feature that will lower or raise speaker volume based on a preset setting for those ppl that have really loud mics or really low mic. I got tired of adjusting it myself. Unfortunately I have to do this auto-adjustment using the main windows volume control which can effect my alarm if I had to lower the volume too much. The only good thing is I decided early on to also flash the window when alarm was triggered and display the amount of time the speaker has gone over time. But this feature would work better if the volume adjustment were done using the Paltalk Room volume controls. Any idea how I can find the handles of the the room volume control? I tried API SPY but since I have to press the speaker icon to bring up the volume control I can;t get the yellow dot thing to work on the actual volume control.

    At any rate, what I have works but I know it would be wiser to adjust the Paltalk volume instead of the main Windows volume.

    I want to thank Chike for all his patience, and Auto and Departure for all there suggestions and teaching me the basic rule is to break the task into really small steps, and loco for making the all of this possible. Without all of your help I would have had no chance at getting this timer working and learning VB. I have a lot to learn like enumerating windows bu I still want to thank you guys for all you have done!

  91. For the record, I am still using the timer with the new version, and even added an automatic volume control feature for those with really loud mics or really low mics. Unfortunately I was only able to interact with the main windows volume which if lowered too much for a loud mic it effects the audio alarm for my timer. But I had decided to flash the window when the alarm goes off as well so it is not the end of the world. I couldn’t figure out how to interact with the Paltalk room volume control. Any ideas on how to interact with the Paltalk Chat Room volume would be appreciated. I couldn’t get the handles of the volume control with API SPY as that you have to click on the icon before the control box is shown.

    Anyway, I want to thank Chike, and Auto, and Departure, and loco for all the help they gave to get me this far. I learned a great deal but still have a long way to go.

Leave a Reply

You must Register or Login to comment on Paltalk Timer