|
treddie wrote: I'll google "outdated code" and see what comes up. Ah, sarcasm, the most honest forms of poetry; Google for ..
Here[^]'s the link. In short, your app might pick another assembly than you expect it to, depending on the location of the assembly, it's version and some other stuff.
treddie wrote: Another issue that might be related is for some reason a form will fail to refresh due to controls being "missing" when they were in fact always there. I find it odd that vb can lose track of controls on a form without me having made any edits that directly affect a control. It didn't, otherwise it could not claim it to be missing. It knows what control is expected, but the complaint mentions that it did not find physical code there. Or anywhere else in it's search-path. Often, it's because it's either too picky (compiled against a specific version) or not picky enough (using an older version of the assembly that's higher in the searchpath).
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Heheh...No sarcasm intended. I don't expect people to feed me on a silver platter, so I was going to go search for it on my own.
I read the article, and that seems pretty messed up. I mean, If I'm writing a program, and I have my code sitting there, it should be the only code referenced. After all, I just spent the time to edit it...I expect it to be current without some shady things going on in the background.
As an update, I forgot to mention that the form was not refreshing IN THE IDE. I'm sure you've run into that, where you click on, say, the Form1.vb [design] tab, and instead of the form popping up with all its controls, you instead get an error screen telling you something bad happened and the form can't be displayed.
|
|
|
|
|
treddie wrote: I read the article, and that seems pretty messed up. It is
treddie wrote: As an update, I forgot to mention that the form was not refreshing IN THE IDE. The runtime still has to resolve the assembly, giving the same problems.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Ahhh, but of course. Unless the compiler has a magical fix.
|
|
|
|
|
No insult intended, but never underestimate the frustration caused by pilot error when using Undo.
|
|
|
|
|
No insult taken. You may be exactly dead on correct, there, in my case!
|
|
|
|
|
Hello,
using VB.Net and TAPI 3.x I created a little application to make and recieve calls. This application uses an ordinary telephone which is connected via USB to the computer.
Most functions seem to work fine, but there are some problems which I can't solve:
- If you take the telephone receiver off the phone and then make a call via my computer application Visual Basic reports an unknown error with the code 0x80040052.
- My application don't recognizes phone events and digit events!
It would be great if someone could help me. I studied nearly everything you can find about TAPI in the internet, nevertheless I don't know how to solve these problems.
Yours faithfully,
Steven
|
|
|
|
|
Hi everyone,
i am trying to write a simple code that reads a bitmap image, i.e ("c:\test.bmp"), then i would like to read every pixel and make a check if the pixel is wether a white or black pixel , to finally counting the number of black pixels in the image:
my code was like this :
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim tst As New Bitmap("c:\tst.bmp")
PictureBox1.Image = tst
Dim x, y, bcnt As Integer
Dim c As Color = tst.GetPixel(x, y)
bcnt = 0
For y = 0 To tst.Height - 1
For x = 0 To tst.Width - 1
If tst.GetPixel(x, y) = Color.Black Then
bcnt = bcnt + 1
End If
Next
Next
MsgBox(bcnt)
End Sub
|
|
|
|
|
I'm not seeing a question in there.
You might want to search the articles for "Image processing for dummies". You'll find articles on how to go through the image data a LOT faster than GetPixel will.
|
|
|
|
|
thank u Dave, but i did not find any thing in articles. but i will do search on the internet about " LOT " function and how to use it.
any help will be appreciated.
thank u in advance.
|
|
|
|
|
sharief hussien VB wrote: but i did not find any thing in articles
I really have no idea what your question is. You never said what the problem is at all, so I'm guessing.
sharief hussien VB wrote: but i will do search on the internet about " LOT " function and how to use
it.
Read what I wrote again. There is no LOT function. I said the technique in those articles would be a lot FASTER than GetPixel.
|
|
|
|
|
sorry dave for my mysterious question, Lol
i would like to create a simple windows application that reads a bitmap image then counts the black pixels within the image, and finally print it out in a message.
i wrote the following code :
*****************************************
dim img as new bitmap ("c:\test.bmp")
dim x,y,count as integer
count = 0
for y = 0 to img.height-1
for x = 0 to img.width-1
if img.getpixel(x,y)= color.black then
count += 1
end if
next
next
mesgbox(count)
****************************************
the problem is that , the count is always 0.
why , ? i do not know?
is there any wrong with the code?
|
|
|
|
|
First, break out the GetPixel call into it's own line so you can see the value in the debugger:
Dim pixelColor As Color = img.GetPixel(x,y)
If pixelColor = color.Black Then
...
Step through the code line-by-line and look at the value of pixelColor Chances are good that the "black" you're seeing in the image is not really Color.Black, but close to it. Are you using a scanned or video image or was this text.bmp drawn in MSPaint or something else?
|
|
|
|
|
Hi frnds, Is there any codings to filter the data from the Excel Sheet using Visual Basic?
I need codings pls send it as soon as possible..
|
|
|
|
|
|
Hi.
I'm not sure whether or not this thread should go here or over in the API section, except that it involves declarations that are definitely vb.Net.
Anyway, my questions revolve around the use of IntPtr. My first thought was that since I needed to pass pointers to win32 functions, I needed to restrict myself to 32bit values. Therefore, it seems that IntPtr is only applicable when on a 32bit system. If a pointer is declared as IntPtr on a 64bit system, vb.Net is clever enough to make IntPtr fit the 64bitwidth of the current system. That makes it unusable for win32 functions because they can only deal with 32bit values. So then I thought, well, I'll switch to using UInt32, so that the API is accessible with a 32bit pointer. But then I thought, hm, that would be fine as far as the API function is concerned, but would create a problem when an API function returns a 32bit encoded address to a memory location on a 64bit system! So that seems to suggest that when you get the pointer out of the function, that it needs to be widened to a 64bit pointer so that the data there can be properly found and retrieved. So my questions are:
1. Is this logic basically correct?
2. Is IntPtr really nothing more than UInt32 or UInt64,
depending on the bitwidth of the system?
3. Again, if all of this is correct, is casting or
marshaling required to narrow and widen the pointer
when a conversion is necessary?
modified 8-Jun-13 23:14pm.
|
|
|
|
|
The IntPtr type will be 32 or 64 bits wide, as necessary, based on the target platform specified in the compiler options.
Use the best guess
|
|
|
|
|
Then if the target system is 64bit, conversion of data types will be necessary between that and the 32bit pointers required by win32, if I understand things correctly. So I can use UInt32 for a passed argument to the API and widen that on output from the API to UInt64. Which would require marshaling, correct?
|
|
|
|
|
No, just use IntPtr and the compiler will set it correctly for you.
Use the best guess
|
|
|
|
|
No, I already understand that part. The problem is that win32 API functions canNOT switch automatically...They're stuck in 32bit land. So it seems that conversion IS necessary when on a 64bit system right?
Also, just realized this morning, that for some API functions, it needs to be Int32 not UInt32, since some functions return an address of -1 on failure. Theoretically, it is the only negative number that would be returned, so this SHOULD be OK.
This whole thing bothers me though, because it means that any pointer that can be passed to a win32 function is stuck in the 32bit range of values. Although it would OK to widen this to 64bits after output from the function, by placing zeroes in the higher order 32 bits, it does not guarantee that a "low" 32bit address is even available. The only reason that might not be a problem is that a 32bit number is still awfully large and how many 32bit valid addresses ranges (blocks of memory) can you expect to be using during any Windows session, even with multitasking?
But on the other hand, is the bit order correct in an Int32 to be used directly as a pointer on a 64bit system, without having to convert to Int64? I am having return value problems in my functions and if I can put the addressing thing to rest, then I can move on to other culprits.
modified 9-Jun-13 15:24pm.
|
|
|
|
|
treddie wrote: They're stuck in 32bit land. No, they are rebuilt for 64 bit, which is why the IntPtr type is provided.
Use the best guess
|
|
|
|
|
Ahh, OK. Then my theory is poop. I will have to invent a new theory about something else, then!
Thanks for the clarification!
|
|
|
|
|
Hello,
I have an app that utilises web browser object to open a (local) html file enter pass that runs javascript within the html(nothing to do with me) that opens/ decrypts another HTML page with links to the encrypted files.. ..
All works fine for 1 or 2 files but I have 200+ that I have to convert. Without fail and at unfortunately but not on a particular file the app crashes and returns StackHash Error... I have added the exe to DEP Exceptions list. Rebooted and the error still returns.
How can i find out what is causing this error?
Hope somebody can help on this.
The crash occurs at the same piece of code. which is:
Sub HTTPDownloadFile(ByVal URL As String, ByVal LocalFileName As String)
Dim http As New Inet
Dim Contents() As Byte
On Error GoTo HTTPDownloadFile_Error
WriteLog "LInk" & URL
WriteLog "Path to save" & LocalFileName
10 ' Set http = New Inet
20 'Set http = CreateObject("InetCtls.Inet")
30 With http
40 .protocol = icHTTP
50 .URL = URL
60 Contents() = .OpenURL(.URL, icByteArray)
70 End With
80 ' Set http = Nothing
90 Open LocalFileName For Binary Access Write As #1
100 Put #1, , Contents()
110 Close #1
120 Set http = Nothing
WriteLog LocalFileName & "Saved"
On Error GoTo 0
Exit Sub
More specifically between the open and close statements.
Has anybody any suggestion as to what may cause this or how to avoid? this is my first step into vb so am cluelss about various compilation options.. would/ could any of thoese options help?
FYI am running on windows 7.
Thanks in advance.
|
|
|
|
|
champagne_charly wrote: More specifically between the open and close statements. .NET throws Exceptions, not errors; looks like VB6-code. How about you try VB.NET?
There could be more than one download at a time, but each filehandle must be unique. See the FreeFile[^] function to get a handle, as opposed to hardcoding al to #1.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Thanks.. Yes it is vb6.. Can't remember where the .net error was mention however it was in an infobox at somepoint..
I will change all ref I have to include this update. I had completely forgotten the use of freefile. My gut Is (and I hope) this is the issue although only ever one file download is triggered at a time.
Will post back.
|
|
|
|
|