Solved

Please help me with OpenDriver function

Posted on 1997-05-11
3
291 Views
Last Modified: 2010-04-06
Please describe me, how works OpenDrive function. I tried
to open the driver, such as in Delphi's help, but result was NULL :(
0
Comment
Question by:vladimir_
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 3

Expert Comment

by:sperling
ID: 1336112
Delphi 1, 2 or 3...

Please post the source you've written, and I'll look into it.

Regards,

Erik.
0
 

Author Comment

by:vladimir_
ID: 1336113
To Sperling :

Source looks like next:
 
{ HDRVR OpenDriver(LPCWSTR lpDriverName, LPCWSTR lpSectionName,
    LONG lParam); }
var
 lpDriverName : LPCWSTR;
 lpSectionName : LPCWSTR;
 lParam : Longint;
 ID : HDRVR;

begin
 lpDriverName :='ultrasnd.drv';
{if lpSectionName=NULL, it will automatically = Drivers16
(like Delphi's help)}
 ID :=OpenDriver(lpDriverName,lpSectionName,lParam);

{and ID will be NULL :( )


0
 
LVL 3

Accepted Solution

by:
sperling earned 100 total points
ID: 1336114
As you're posting the widechar OpenDriver declaration, I assume you're using Delphi 2 or 3.

There are two errors in your code. I'm not certain, but I don't think delphi automatically converts single-byte strings to wide characters on assignment, therefore you should use StringToWideChar.

And second, as you do not set lpSectionName := nil, it would probably point to some garbage string. Local variables are not initialized automatically.

Also, the default *registry key* name is Drivers32 in Win32, and the default *ini section* is Drivers16 in Win16

var
  lpDriverName : ARRAY [0..99] OF WideChar;
  ID : HDRVR;
begin
  StringToWideChar ('ultrasnd.drv', lpDriverName, 100);
  ID :=OpenDriver(lpDriverName, nil, 0);
end;

This should work under Delphi 2 or 3

Under delphi 1, try ID := OpenDriver('ultrasnd.drv', nil, 0) instead of the above code.

Regards,

Erik.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

739 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