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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with DLL

Status
Not open for further replies.

paul1941

Programmer
May 25, 2006
32
BE
Hello all,

I'm using the following code to register my app on an users computer:

#DEFINE HKEY_LOCAL_MACHINE 2147483650 && (HKEY) 0x80000002
#DEFINE SECURITY_ACCESS_MASK 983103 && SAM value KEY_ALL_ACCESS

DECLARE RegCreateKeyEx IN ADVAPI32.DLL INTEGER,STRING,INTEGER,STRING,INTEGER,INTEGER,INTEGER,INTEGER @, INTEGER @
DECLARE RegSetValueEx IN ADVAPI32.DLL INTEGER,STRING,INTEGER,INTEGER,STRING,INTEGER

=RegCreateKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\GENCO",0,"REG_SZ",0,SECURITY_ACCESS_MASK,0,@RESULT,@DISPLAY) && Returns .T. if successful

=RegSetValueEx(RESULT,"AppName",0,1,"&rstam",150)

Sometimes, I get the following message:

Declare DLL call caused an exception

clicking on OK I can go further

How to avoid this?

regards Paul
 
Paul,

Sometimes, I get the following message:

Declare DLL call caused an exception
....
How to avoid this?

Easy. Get rid of the error.

Sorry, I don't mean to be facetious. You say that "sometimes" you get the error. The first I would do is to determine under which circumstances the error occurs. That's a first step towards solving it.

One thing to look out for ... check the the variables that you pass by reference (@Result and @Display) actually exist within your VFP code before you call the DLL functions.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Mike

The code is embedded in my main program
I can start the app 10 times without error and sometimes an error occurs
Idon't have variables for Display and Result

regards
Paul
 
Mike,


Displaying my code I forgot the following lines;

Public Display,Result
Display = 0
Result = 0

regards, Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top