Solved

Someone who knows C and VB4

Posted on 1998-08-23
5
174 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
ID: 1430606
'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
ID: 1430607
I have made the same conversion on another question without seeying your code polygon.  ;)
0
 

Author Comment

by:vfafel
ID: 1430608
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
ID: 1430609
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
ID: 1430610
Bought This Question.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…

790 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