sendmessage not sending in VB dll:
-
The VB dll has in a function:
result = SendMessage(PbarHandle, 1026, 5, 0)
The VC client sends in the handle of a progressbar. I verfied that handle sent in is being received by the VB dll. However if I put a msgBox right after the
SendMessage
, it doesnt fire. In the VC client, at the call to the dll, a com error happens:void CMswayView::OnButton2() { try { CoInitialize(NULL); _Class1Ptr ptr; ptr.CreateInstance(__uuidof(Class1)); m_Progress1.SetStep(1); m_Progress1.SetRange(1, 10); long lHwnd=(long)m_Progress1.GetSafeHwnd(); ptr->CheckingStuff(&lHwnd); //com error happens here } catch(_com_error &e) { bstrDesc = e.Description(); } CoUninitialize(); }
But we know the error is happening in the VB dll since the we cant get past the sendmessage, and the very next line: msgbox doesnt fire. How can I figure out what is happening? Why is sendmessage not working? Is it that I've done something dumb in sending in the handle and its not valid anymore or something? I have a #import in my VC client for the VB dll. Thanks, ns 1026 is just setting the position. Not even 1029 (PBM_STEPIT) works. Somethigs fundamentally flawed in my assumptions here...
-
The VB dll has in a function:
result = SendMessage(PbarHandle, 1026, 5, 0)
The VC client sends in the handle of a progressbar. I verfied that handle sent in is being received by the VB dll. However if I put a msgBox right after the
SendMessage
, it doesnt fire. In the VC client, at the call to the dll, a com error happens:void CMswayView::OnButton2() { try { CoInitialize(NULL); _Class1Ptr ptr; ptr.CreateInstance(__uuidof(Class1)); m_Progress1.SetStep(1); m_Progress1.SetRange(1, 10); long lHwnd=(long)m_Progress1.GetSafeHwnd(); ptr->CheckingStuff(&lHwnd); //com error happens here } catch(_com_error &e) { bstrDesc = e.Description(); } CoUninitialize(); }
But we know the error is happening in the VB dll since the we cant get past the sendmessage, and the very next line: msgbox doesnt fire. How can I figure out what is happening? Why is sendmessage not working? Is it that I've done something dumb in sending in the handle and its not valid anymore or something? I have a #import in my VC client for the VB dll. Thanks, ns 1026 is just setting the position. Not even 1029 (PBM_STEPIT) works. Somethigs fundamentally flawed in my assumptions here...
Show me how you declared SendMessage (hint: in VB6 you used Long for Window Handle. In VB.NET you need to use Integer)
-
Show me how you declared SendMessage (hint: in VB6 you used Long for Window Handle. In VB.NET you need to use Integer)
Private Declare Function SendMessage Lib "User" (ByVal hWnd As Long, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Long) As Long
I changed it to ByVal hWnd As
Long
, it was originally integer from the msDN. But it still doesnt work.....:confused::confused: The msgbox doesnt fire,result = SendMessage(pBAr, 1029, 0, 0) MsgBox result /// never fires
The VC client gets a com error at runtime (goes into the catch(com e) block) is:
sway.exe (KERNEL32.DLL): 0xC000008F: Float Inexact Result.
Desperate!