[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?
Re: Works in compiler, not when compiled
Is it a ListBox control? it is in your App or external App?
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 :(
1 Attachment(s)
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 #
Re: Works in compiler, not when compiled
Problem solved, in project properties, I changed the compile option to compile to P-Code... :)
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.
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.
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
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.
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.
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
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.
Re: [RESOLVED] Works in compiler, not when compiled
i run win 64-bit and yes patch installs can fail on it.