Sep 12th, 2007, 07:39 PM
#1
Thread Starter
Hyperactive Member
[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
Sep 12th, 2007, 08:26 PM
#2
Thread Starter
Hyperactive Member
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
Sep 12th, 2007, 08:31 PM
#3
Thread Starter
Hyperactive Member
Re: Lvm_getitemstate
Nope thats not it, i downloaded user32.dll and renamed it and had the sendmessage function use that dll.. same problem
Sep 12th, 2007, 08:57 PM
#4
Re: Works in compiler, not when compiled
Is it a ListBox control? it is in your App or external App?
Sep 12th, 2007, 09:02 PM
#5
Thread Starter
Hyperactive Member
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 .
Sep 12th, 2007, 09:26 PM
#6
Thread Starter
Hyperactive Member
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
Last edited by bail3yz; Sep 12th, 2007 at 09:30 PM .
Sep 12th, 2007, 10:08 PM
#7
Thread Starter
Hyperactive Member
Re: Works in compiler, not when compiled
Problem solved, in project properties, I changed the compile option to compile to P-Code...
Sep 12th, 2007, 10:14 PM
#8
Thread Starter
Hyperactive Member
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.
Sep 13th, 2007, 12:47 AM
#9
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.
Sep 13th, 2007, 04:29 AM
#10
Thread Starter
Hyperactive Member
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
Sep 13th, 2007, 06:49 AM
#11
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.
Sep 13th, 2007, 07:52 AM
#12
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.
Sep 13th, 2007, 08:01 AM
#13
Thread Starter
Hyperactive Member
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
Sep 13th, 2007, 10:22 AM
#14
Re: Works in compiler, not when compiled
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.
Sep 13th, 2007, 10:33 AM
#15
Re: [RESOLVED] Works in compiler, not when compiled
i run win 64-bit and yes patch installs can fail on it.
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width