Results 1 to 15 of 15

Thread: [RESOLVED] Works in compiler, not when compiled

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2005
    Posts
    399

    Resolved [RESOLVED] Works in compiler, not when compiled

    Hi, this chunk of code works when I run my project from withing VB, but once i compile it doesnt work

    Code:
    For i = 0 To numofItems - 1
        If SendMessage(listhwnd, LVM_GETITEMSTATE, i, LVIS_FOCUSED) = 2 Then
            curPosition = i
            Exit For
        End If
    Next i
    basically it goes through the list and checks which item has focus.. and changes curposition to that item on the list

    also, I have checked everything i can think of numofitems does equal the correct value all the time

    so i am pretty sure

    If SendMessage(listhwnd, LVM_GETITEMSTATE, i, LVIS_FOCUSED) = 2 Then

    somehow doesnt work once its compiled, any idea why?
    Last edited by bail3yz; Sep 12th, 2007 at 10:29 PM. Reason: title sucked

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2005
    Posts
    399

    Re: Lvm_getitemstate

    is it possible that a different version of user32.dll is being used when its runningin the compiler and when its compiled?

    I checked the values of everything, in both situations everything is the exact same... except curposition

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2005
    Posts
    399

    Re: Lvm_getitemstate

    Nope thats not it, i downloaded user32.dll and renamed it and had the sendmessage function use that dll.. same problem

  4. #4
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: Works in compiler, not when compiled

    Is it a ListBox control? it is in your App or external App?

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2005
    Posts
    399

    Re: Works in compiler, not when compiled

    it is in an external app, and its a SysListView32 (same problem occurs for ListView20WndClass, I believe they are pretty close to the same or something?)

    also i tested my code on numerous different external applications, and everytime its the same problem, if its running within visual basic it works, but once compiled that one line always equals 0 so i can never figure out which line has focus
    Last edited by bail3yz; Sep 12th, 2007 at 09:07 PM.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2005
    Posts
    399

    Re: Works in compiler, not when compiled

    Here I made an example, this example doesnt use an external app but with this code teh same problem occurs.

    I will upload the code and my compiled copy, and youll see what i mean

    First open the EXE.. select an item on the list view, and hti the command button..itll say Selected item: 0 (well it does for me)

    now open the project in VB and run it from VB.. do the same thing and itll give you the proper #
    Attached Files Attached Files
    Last edited by bail3yz; Sep 12th, 2007 at 09:30 PM.

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2005
    Posts
    399

    Re: Works in compiler, not when compiled

    Problem solved, in project properties, I changed the compile option to compile to P-Code...

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2005
    Posts
    399

    Re: Works in compiler, not when compiled

    can anyone tell me why it works in pcode and not native code? also, I read that pcode is easier to decompile, is this true?

    If possible I'd like to get it to work in native code.

  9. #9
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    Re: Works in compiler, not when compiled

    yes it is easier to decompile back into vb. But that's about it. And maybe you've discovered a bug in vb. Have you any of the patches installed? There are patches for vb6.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2005
    Posts
    399

    Re: Works in compiler, not when compiled

    Yup, I have VB SP 5 I believe, I just tried to install VB SP 6.. but it says "install was not completed successfully" and doesnt provide anymore info ahha

  11. #11
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Works in compiler, not when compiled

    Did you get the SP 6 download from Microsoft's site?

    I've never had an issue with installing that.

  12. #12
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: Works in compiler, not when compiled

    I Thing this question is answerd and Resolved in Classic VB http://www.vbforums.com/showthread.php?t=488348

    it has duplicated.

  13. #13

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2005
    Posts
    399

    Re: Works in compiler, not when compiled

    Ya hack i did, I am not worried about that tho, I bet it has something to do with me running windows 64bit

  14. #14
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Works in compiler, not when compiled

    Quote Originally Posted by bail3yz
    Ya hack i did, I am not worried about that tho, I bet it has something to do with me running windows 64bit
    This is a distinct possibility.

  15. #15
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    Re: [RESOLVED] Works in compiler, not when compiled

    i run win 64-bit and yes patch installs can fail on it.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width