|
My problem is both simple and complex...
I am writing an RS232 protocol layer that was meant for Visual C++, however now the boss man wants me to integrate it in to Visual Basic. So I decided to convert the static library to a DLL. Everything seems to work fine, and from the outside the IDE all the visual basic apps run well. However inside the IDE, after running, the VB IDE has many problems. On my machine it only causes an application error on exit. On others, it causes application errors at random times. I thought maybe I was trashing the stack, but my DLL is not doing it. I am thinking it is the arguement passing...
These are my definitions in the DLL..
[code]
#define INCOMMSTACK_API extern "C"
INCOMMSTACK_API long WINAPI Initialize (long lHwndOwner);
INCOMMSTACK_API long WINAPI ExpediteMessageByte (LPBYTE pbMsg, DWORD cBytes);
INCOMMSTACK_API long WINAPI ExpediteMessageText (LPCTSTR szMsg, DWORD cChars);
INCOMMSTACK_API long WINAPI SendMessageByte (LPBYTE pbMsg, DWORD cBytes);
INCOMMSTACK_API long WINAPI SendMessageText (LPCTSTR szMsg, DWORD cChars);
INCOMMSTACK_API long WINAPI SetRetryCount (DWORD dwRetryCount);
INCOMMSTACK_API long WINAPI SetTimeout (DWORD dwTimeout);
INCOMMSTACK_API long WINAPI SetProtocol (DWORD dwProtocol);
INCOMMSTACK_API long WINAPI ConnectRS232 (int iCommPort, int iBaudRate);
INCOMMSTACK_API long WINAPI ConnectUDP (LPCTSTR szAddress, int iPort);
INCOMMSTACK_API long WINAPI CloseConnection ();
INCOMMSTACK_API long WINAPI GetReceivedMessage (LPBYTE pbByte,
DWORD cBytes,
DWORD wParam,
long lParam);
[/code]
and these are the declaration in VB...
[code]
Private Declare Function CreateWindowEx _
Lib "user32" Alias "CreateWindowExA" _
(ByVal dwExStyle As Long, _
ByVal lpClassName As String, _
ByVal lpWindowName As String, _
ByVal dwStyle As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal nWidht As Long, _
ByVal nHeight As Long, _
ByVal hWndParent As Long, _
ByVal hMenu As Long, _
ByVal hInstance As Long, _
lpParam As Any) As Long
Public Const GWL_WNDPROC = (-4)
Public Declare Function SetWindowLongApi _
Lib "user32" Alias "SetWindowLongA" _
(ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Public Declare Function CallWindowProc _
Lib "user32" Alias "CallWindowProcA" _
(ByVal lpPrevWndFunc As Long, _
ByVal hwnd As Long, _
ByVal msg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Private Declare Function V4Initialize _
Lib "incommstack.dll" Alias "Initialize" _
(ByVal hwndOwner As Long) As Long
Private Declare Function V4ExpediteMessageByte _
Lib "incommstack.dll" Alias "ExpediteMessageByte" _
(ByRef pbByte As Byte, ByVal cBytes As Long) As Long
Private Declare Function V4ExpediteMessageText _
Lib "incommstack.dll" Alias "ExpediteMessageText" _
(ByVal szMsg As String, ByVal cChars As Long) As Long
Private Declare Function V4SendMessageByte _
Lib "incommstack.dll" Alias "SendMessageByte" _
(ByRef pbMsg As Byte, ByVal cBytes As Long) As Long
Private Declare Function V4SendMessageText _
Lib "incommstack.dll" Alias "SendMessageText" _
(ByVal szMsg As String, ByVal cChars As Long) As Long
Private Declare Function V4SetRetryCount _
Lib "incommstack.dll" Alias "SetRetryCount" _
(ByVal lRetryCount As Long) As Long
Private Declare Function V4SetTimeout _
Lib "incommstack.dll" Alias "SetTimeout" _
(ByVal lTimeout As Long) As Long
Private Declare Function V4SetProtocol _
Lib "incommstack.dll" Alias "SetProtocol" _
(ByVal lProtocol As Long) As Long
Private Declare Function V4ConnectRS232 _
Lib "incommstack.dll" Alias "ConnectRS232" _
(ByVal iCommport As Long, ByVal iBaudRate As Long) As Long
Private Declare Function V4ConnectUDP _
Lib "incommstack.dll" Alias "ConnectUDP" _
(ByVal szAddress As String, ByVal iPort As Long) As Long
Private Declare Function V4CloseConnection _
Lib "incommstack.dll" Alias "CloseConnection" () As Long
Public Declare Function V4GetReceivedMessage _
Lib "incommstack.dll" Alias "GetReceivedMessage" _
(lpByte As Any, ByVal cBytes As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
[/code]
I included the win32 calls for handling the WM_MESSAGES that the static library used to communicate to the frame in the VC++ implementation.
Any ideas on what might be happening or am I just wading in hot water with no raft....
Thanks,
Brian
Stop the insanity and free the mallocs. If not then memory will call a work stoppage and your computer shall begin a revolt, causing the current operating system to fail. Down with the man....
|
|
|
|
|
I need to make a form that can open up and then be able to look in your hardrive and search for a file and load it into a text box. I know this isnt hard but i have not done this before. Can someone please help me?
|
|
|
|
|
I need to make a form that can open up and then be able to look in your hardrive and search for a file and load it into a text box. I know this isnt hard but i have not done this before. Can someone please help me?
|
|
|
|
|
Hi,
I use VB6 & SQL Server. My database is saved in a server. The operating system in the server is Windows NT that supports only English Language, and my data, which I need to save, is written in Arabic. The problem is that the data saves as garbage.
Note: There is no problem with Visual C in the same database.
Thanks
|
|
|
|
|
Hi,
I've solved my problem by adding this statment "Auto Translate=False" to the "ConnectionString".
|
|
|
|
|
is it possible to run a activeX control (OCX) from a server side without the client downloading it. just like using asp and activeX dlls?
|
|
|
|
|
If you are on a local network you could use DCOM to instantiate the object on the other machine. Otherwise I would recommend turning to something like SOAP to run objects on a server over the internet.
SOAP is a protocol that allows you to communicate through the firewalls and such that are located on internet servers, by simply using XML.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Hello,
How to pass arguments to application created by VB
Thanks
|
|
|
|
|
Project | Properties menu -> Make Tab -> Command Line arguements.
Good luck!
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Maybe what you want is how to receive them: through the Command$ function
Crivo
Automated Credit Assessment
|
|
|
|
|
I think the problem may be the fact I am running visual studio.net under NT4, SP6A and not Win2000 prof. but just in case...
I build a simple form and add a project ( deployemnt project)
Set the project output to the simple project and attempt to build the solution.
The problem is I always get an error which states File access violation.
I check the path and it is to the project file. No files are Read only.
Has anyone else experienced this problem.
I get the same error if I try to build a CAB project also.
Wynn
|
|
|
|
|
Whenever I compile my VB programs on my coding system, they run fine and without problem. If I were to send an application over to a friend through E-Mail or run it on another computer through floppy disk, I get this error message that the publisher isn't authorized. The same error message when you run a java applet that you haven't downloaded online from an unknown company. Any ideas on how to fix this so that the computer recognizes my programs and doesn't ask the user if they trust me?
First Programmer: "How many bits are in a bite?"
Second Programmer: "You spelled bytes wrong."
First Programmer: *stares* "It's a joke, moron."
Second Programmer: "Joke...?"
|
|
|
|
|
Have your friend copy the executable to their harddrive, then run it through explorer. This is probably a security measure that has been built into your friends email program.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Does any body know if I can control my cooling fan on my laptop computer manually because it does not seem to work auto. when it hits the right temp. I want to test it. If I can’t do it in VB. Can I do that in another language?
|
|
|
|
|
You could try a non-virtual language like "resistor, +5V, voila!". Other than that you can only (with some motherboards) observe its behaviour, which I regard a good thing. Imagine any program that could access (stop) the CPU fan and burn another Athlon?
|
|
|
|
|
Think you
Mike Nordell wrote:
Imagine any program that could access (stop) the CPU fan and burn another Athlon?
Your right that would be bad.
|
|
|
|
|
Mike Nordell wrote:
Imagine any program that could access (stop) the CPU fan and burn another Athlon?
Some of them burn with the fan running normally
Crivo
Automated Credit Assessment
|
|
|
|
|
I have a data control and I need to pass in a Data object in a function's parameter. I'm the one making the function, so I can change it to a recordset, which is "ok" but it just doesnt make a whole lot of sense to do 1/2 of what i want to do outside of a function, and the rest inside of a function! (if i would pass a recordset)
So any suggestions? my boss remembers doing it but he forgot how. (uhh huh, yeah ok)
I believe it can be done, but all i want is a Data object, because that's the only thing i've really messed with in messing with Databases (i'm pretty new to VB but a veteran to C++)
Ok, thanks in advance!
~Timothy T. Rymer
http://tim.xpertz.com
http://www.digipen.edu
http://www.ttrx.com
|
|
|
|
|
I'm not sure if this is what you are looking for.... You might what to do a search for "Data aware class" on the MSDN.
Private Sub mysub(Data As Object)
End Sub
|
|
|
|
|
You are better off passing the recordset object if thats what you are going to be playing with. Otherwise you are using late binding. Something like this :
Sub DrawData(ByVal oRec as ADODB.Recordset)
Dim dField as Field
For Each dField in oRec.Fields
MsgBox dField.Value & " " & dField.Name
Next
End Function
Sub Main()
Dim oRecord as ADODB.RecordSet
Dim ssql as String
Dim oConnect As ADODB.Connection
oConnect.Open "Blah,Blah"
ssql = "SELECT * FROM table1"
oRecord.Open ssql, oConnect, adOpenForwardOnly, adLockReadOnly
DrawData(oRecord)
MsgBox "Success"
End Sub
|
|
|
|
|
One of our VB6 apps is designed to be able to print, and prints using the basic printform command.
On most printers, it prints fine, except for one, an HP 930c DeskJet. The app gives the error "Can't print form image to this type of printer". (I believe the error code is 486.)
We've tried some of the solutions found on the 'net (even the Microsoft one), but nothing has worked so far.
Anyone have this kind of problem before?
|
|
|
|
|
Hello!!!
I would like to know how I can add background to the whole Form, while the background file is a smaller than the Form size.
I don't want to create a large background which is .bmp file, but JPEG or GIF.
Thank you !!!!
Ahuva
|
|
|
|
|
Just set the Picture property of the form.
--
David Wengier
Sonork ID: 100.14177 - Ch00k
|
|
|
|
|
Make a .JPEG that's the same size as your form and set it as the Picture property on your form... like David said
First Programmer: "How many bits are in a bite?"
Second Programmer: "You spelled bytes wrong."
First Programmer: *stares* "It's a joke, moron."
Second Programmer: "Joke...?"
|
|
|
|
|
Hello !!!
I need help !
I would like to know how I can operate a mp3 when an event is ocour. What is the code line ?
Thank You !!!
Ahuva
|
|
|
|