Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SendMessage() Help...

Status
Not open for further replies.

AtomicChip

Programmer
May 15, 2001
622
CA
Here's my problem...

All that I'm trying to do is input a string into a ListBox (created in a Visual Basic6 project) from a simple C++ DLL.

There are two controls on the VB form. A command button (Command1), and a listbox (List1).

The code in the VB project is as follows:

(In a module)...
Public Declare Function ShowInfo Lib "ListBoxInput.dll" (winHWnd As Long) As Integer

(On the form)...
Private Sub Command1_Click()
ShowInfo List1.hwnd
End Sub

As for the code in the .dll:

#include <windows.h>

#define NOMANGLE

NOMANGLE long _stdcall ShowInfo( long winHWnd );

char* t;

NOMANGLE long _stdcall ShowInfo( long winHWnd )
{
unsigned long ADDTEXT;
ADDTEXT = LB_ADDSTRING;

SendMessage( (HWND) winHWnd, (UINT) ADDTEXT, (WPARAM) 1, (LPARAM) &quot;Hello&quot;);
return 1;

}

The function is exported using a .def file. At this point, the DLL is not generating any errors at all. It's just not sending the string (LPARAM) to the listbox.

I've been beating my head against a brick wall for hours now about this... Any help would be greatly appreciated. Thanks

-----------------------------------------------
&quot;The night sky over the planet Krikkit is the least interesting sight in the entire universe.&quot;
-Hitch Hiker's Guide To The Galaxy
 
I'm not sure about this (just a basic thing that I forget sometimes, giving me as well alot of headackes), but be certain that you have copied the new compiled DLL where you work with it... [red]Nosferatu[/red]
We are what we eat...
There's no such thing as free meal...
once stated: methane@personal.ro
 
Nosferatu - Thanks for the reply, but I have already done the things suggested (The reference to the DLL in VB is set to the specific folder that VC++ is compiling to - Haven't copied the DLL to the Sys folder). If I run a style of debugging within the DLL (return a 1 if there's any kind of an error generated by using the SendMessage() function, or 0 if there is no error), the DLL returns a 0 every time indicating that it has run properly. Funny, still nothing coming up in the listbox in VB!
-----------------------------------------------
&quot;The night sky over the planet Krikkit is the least interesting sight in the entire universe.&quot;
-Hitch Hiker's Guide To The Galaxy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top