Solved

Someone who knows C and VB4

Posted on 1998-08-23
5
171 Views
Last Modified: 2010-04-30
I need some help converting this C code to the VB4 equivalent:
I have this in C and i don't know C.  I need this equivalent in VB4.  Any help would be appreciated...

// Create a global named event that the LanFax printer driver will signal
// once it's done.
HANDLE hEvent = ::CreateEvent(NULL, FALSE, FALSE, "LanFaxPrinter");
if (hEvent != NULL)
{
// wait for 10 secs
DWORD dwRet = ::WaitForSingleObject(hEvent, 10000);
if (dwRet != WAIT_OBJECT_0)
{
// timeout
}
else
{
// printer driver signaled us: the conversion is done
ProcessOutputFile();
}

// close the event
::CloseHandle(hEvent);
}
thanks in advance
0
Comment
Question by:vfafel
5 Comments
 
LVL 2

Accepted Solution

by:
polygon earned 200 total points
Comment Utility
'Create a global named event that the LanFax printer driver will signal once it's done.
hEvent& = CreateEvent(vbNull, False, False, "LanFaxPrinter")
if hEvent& <> 0 then
  'Wait for 10 sec
  dwRet& = WaitForSingleObject(hEvent&, 10000)
  if dwRet <> WAIT_OBJECT_0 then
    'timeout
  else
    Call ProcessOutputFile 'this must be user-defined procedure
  End If
'Close the event
Call CloseHandle(hEvent&)
End If

---

You must get the declarations of CreateEvent, WaitForSingleObject and CloseHandle API function and WAIT_OBJECT_0 constant from VB's API Viewer.
0
 
LVL 14

Expert Comment

by:waty
Comment Utility
I have made the same conversion on another question without seeying your code polygon.  ;)
0
 

Author Comment

by:vfafel
Comment Utility
Thanks...i am getting one error when i run this "BYREF argument type mismatch" associated with the CreateEvent() call...any clues?
0
 

Author Comment

by:vfafel
Comment Utility
Polygon,
Thanks for the C to VB conversion...i am getting one error when i run this--->"BYREF argument type mismatch" associated with the CreateEvent() call...any clues?

0
 
LVL 13

Expert Comment

by:Mirkwood
Comment Utility
Bought This Question.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now