|
-
May 19th, 2000, 02:47 AM
#1
Hopefully someone can help me on this problem since I seemed to stump everyone with my last post.
I have developed an application that, for all intents and purposes, queries a machine and stores relevant data in a database. I am using API calls (mostly GetKeyValues and GetSettingString) to get ODBC data sources from the registry and presenting them in a True DBGrid 6 grid. I am also using an API call to get printer data (EnumPrinters) and displaying that data in a DBGrid.
Here's the problem: When running in the Visual Studio development environment, all the data is collected and displayed properly. However, when I compile the application and run it from the EXE rather than the IDE, the ODBC data is not displayed (and possibly not gathered). The printer data is collected and displayed fine in both cases. I have tried this on multiple machines with the same results.
Help!!!
I am starting to add MsgBoxs throughout that portion of the code to see what happens, but in the mean time, if anyone can explain why there would be a difference or what I might do to fix this, I'd truly appreciate it.
Thanks for all your help!!!
Dan
-
May 19th, 2000, 03:34 AM
#2
I don't know if this will help or not, but the problem seems to be at the first call to RegEnumValue, where I am using the API call to get the values enumerated under HKLM\Software\ODBC\ODBC.INI\ODBC Data Sources\. This should (and does when not run as an EXE) return the names of all DSNs defined as System DSNs. When I make the call, an error code of 87. (No error is displayed, I am showing the error as a MsgBox right now.)
I'm in the process of looking up this error code. Maybe it'll give me a clue as to where to start.
Thanks again!!!
Dan
-
May 19th, 2000, 04:36 AM
#3
-
May 19th, 2000, 05:04 AM
#4
Through some ingeneous placement of MsgBox statements, I identified that the problem was in the REGENUMVALUE statement. I looked at the VBAPI.COM file on this function and found that the statement explaining the lpData and lpcbData fields is slightly incorrect (from what I can tell.) I do not need the data and datasize as returned by this call, so I supplied "ByVal 0" as the parameter value for both as instructed by the API Guide. While this worked in the IDE, it was causing an error code 87 (Incorrect Parameter) when run as a complied application. I changed the parameters to variables (data(0) and datalen as described by the API Guide) and recompiled the application. When executed, everything worked properly this time around.
As a side note, I still supplied "ByVal 0" as the parameter value for lpReserved as instructed by the API Guide.
Looks like all is well now.
Thanks for your help!!!
Dan
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|