473,406 Members | 2,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

VB6, The Registry and PDF Printing

2
I have read many threads and discussions on how to supress the PDF Writer prompt screen and allocate a filename directly to the PDF file from a VB6 program. I am therefore trying to set the Registry value 'PDFFileName' to the filename I want before attempting to print.

The line of code I have is:

retval = RegSetValueExString(HKEY_CURRENT_USER, "Software\ADOBE\Acrobat PDFWriter\PDFFileName", 0, REG_SZ, MyFilename, mylen)

MyFilename is a string which has a filename with full path, and mylen is the length of this string in bytes as returned by LenB. The return value I get is 0 - ie. there is no error, and yet it doesn't actually do anything!

The information I have read about the function RegSetValueExString says that it will create the value if it is not already there.

I have tried creating the PDFFileName value directly via regedit before running the code but it doesn't set it.

I have tried creating the PDFFileName value in regedit and allocating it a valid filename and path. Then the VB6 behaves as I want, as it bypasses the prompt window from PDF Writer and creates the file (and then removes the PDFFilename setting!)

I feel like I am going round in circles - any thoughts anyone??????

Thanks
Mar 6 '08 #1
2 1811
Killer42
8,435 Expert 8TB
I think you need to "open" and "close" the key. See this example code from MS' website...

Expand|Select|Wrap|Line Numbers
  1. Private Sub SetKeyValue (sKeyName As String, sValueName As String, _
  2.    vValueSetting As Variant, lValueType As Long)
  3.   Dim lRetVal As Long         'result of the SetValueEx function
  4.   Dim hKey As Long         'handle of open key
  5.  
  6.   'open the specified key
  7.   lRetVal = RegOpenKeyEx(HKEY_CURRENT_USER, sKeyName, 0, _
  8.                                  KEY_SET_VALUE, hKey)
  9.   lRetVal = SetValueEx(hKey, sValueName, lValueType, vValueSetting)
  10.   RegCloseKey (hKey)
  11. End Sub
  12.  
Mar 7 '08 #2
MLC
2
Thanks for the reply.

I have just tried what you suggested - both the 'open' and the 'set' return a zero (no error) return value but it is still not doing anything to the registry!
Mar 7 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Rohit Santhanam | last post by:
As I am reading the .NET documentation, I get the feeling that Microsoft is trying to get rid of the registry. My understanding is that an application built using .NET does not use the registry...
0
by: vincemoon | last post by:
Below is an excerpt from my Registry Log, created by Redmon, showing the process whereby TweakUI added the compressed folder option to the new sub-menu in the right click context menu for open...
5
by: Rik Hemsley | last post by:
Hi, My ASP.NET application (running on IIS) doesn't see any of the printers installed on its server. I'd like it to be able to see, and print to, all printers. Is there a way to give the...
10
by: Ray Greene | last post by:
Are there restrictions on accessing the registry from a web application? The following code works from a Windows app but from my web app it gives the error "Object reference not set to an...
3
by: eSolTec, Inc. 501(c)(3) | last post by:
Thank you in advance for any and all assistance. Is there a way to create a registry key, but orphan it from the program that created it? Reason: Create a key, but not associate it with the...
3
by: Aussie Rules | last post by:
Hi, I want to store some data in the registry, however I have not been able to do this, and think my logic maybe flawed. Firstly I try to open the registry and read in any existing values....
6
by: JOSII | last post by:
Getting a string of boolean value into and out of the registry is no problem. Here's the problem: Although you can place an object into the registry and retreive it, I need to place an ArrayList...
3
by: Rob Latour | last post by:
The following snippet (vb.net 2005) is working just fine in xp but not in vista in xp it lists all related sub keys in the registry just fine. in vista it doesn't list certain ones (like...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.