Click here to Skip to main content
15,926,857 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: new Form by name? Pin
Nick Parker1-May-02 8:38
protectorNick Parker1-May-02 8:38 
GeneralRe: new Form by name? Pin
Andy Smith1-May-02 10:11
Andy Smith1-May-02 10:11 
AnswerRe: new Form by name? Pin
James T. Johnson1-May-02 21:43
James T. Johnson1-May-02 21:43 
GeneralRe: new Form by name? Pin
Andy Smith2-May-02 17:11
Andy Smith2-May-02 17:11 
GeneralIntegration of mp3 files in VB application Pin
Ahuva30-Apr-02 10:28
Ahuva30-Apr-02 10:28 
GeneralRe: Integration of mp3 files in VB application Pin
CSharpLady8-May-02 10:02
CSharpLady8-May-02 10:02 
GeneralRe: Integration of mp3 files in VB application Pin
SHaroz13-Jun-02 6:24
SHaroz13-Jun-02 6:24 
GeneralVB6.exe Application Error caused by using DLL Pin
SanShou30-Apr-02 4:14
SanShou30-Apr-02 4:14 
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....
GeneralFind Dialog box Pin
30-Apr-02 3:21
suss30-Apr-02 3:21 
GeneralFind Dialog box Pin
30-Apr-02 3:21
suss30-Apr-02 3:21 
GeneralLanguage Problem Pin
kag22-Apr-02 21:13
kag22-Apr-02 21:13 
GeneralMy problem is solved;) Pin
kag28-Apr-02 21:02
kag28-Apr-02 21:02 
GeneralActiveX controls overview! Pin
21-Apr-02 8:38
suss21-Apr-02 8:38 
GeneralRe: ActiveX controls overview! Pin
Paul M Watt21-Apr-02 10:29
mentorPaul M Watt21-Apr-02 10:29 
Generalarguments... for exe..... Pin
19-Apr-02 13:20
suss19-Apr-02 13:20 
GeneralRe: arguments... for exe..... Pin
Paul M Watt19-Apr-02 14:08
mentorPaul M Watt19-Apr-02 14:08 
GeneralRe: arguments... for exe..... Pin
Daniel Turini19-Apr-02 14:13
Daniel Turini19-Apr-02 14:13 
GeneralError making Windows Installer ouput file Pin
Wynn18-Apr-02 6:03
Wynn18-Apr-02 6:03 
GeneralRunning VB exe program's on other computers Pin
Aleksey Suvorov17-Apr-02 15:24
Aleksey Suvorov17-Apr-02 15:24 
GeneralRe: Running VB exe program's on other computers Pin
Paul M Watt21-Apr-02 10:31
mentorPaul M Watt21-Apr-02 10:31 
Generalcontroling fans Pin
17-Apr-02 11:58
suss17-Apr-02 11:58 
GeneralRe: controling fans Pin
Mike Nordell17-Apr-02 12:21
Mike Nordell17-Apr-02 12:21 
GeneralRe: controling fans Pin
18-Apr-02 1:41
suss18-Apr-02 1:41 
GeneralRe: controling fans Pin
Daniel Turini11-May-02 2:09
Daniel Turini11-May-02 2:09 
QuestionDataControl ---> Data "object" HowTo??? Pin
Tim Rymer16-Apr-02 3:36
Tim Rymer16-Apr-02 3:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.