?
Solved

Using Win16 commdlg.dll API in VB4

Posted on 1998-02-28
4
Medium Priority
?
430 Views
Last Modified: 2008-03-17
I have determined from a previously asked question that under VB4 16-bit enviroment using the CommonDialog control there is no way to determine which file type/extension filter has been selected.  What I'm trying top do is directly access the Win16 commdlg.dll API to give me the ability to determine which file type has been selected so that I can then save a file in that format.  I've been able to successfully display the File Save dialog by writting a  C DLL function that is simply wrapper for the actual API function that I call from my VB program.  My problem is that I have formatted the lpstrFilter member of the OPENFILENAME struct to how it is described in the Win16 SDK but the "List files of type" listbox only shows the first filter name I specfied and it doesn't apply the filter to the file listings.  What am I missing here and is there an better alternative to may approah?
0
Comment
Question by:armg
[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
4 Comments
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1458150
I think the string must be loaded from a resource file
0
 

Author Comment

by:armg
ID: 1458151
What effect would loading a string from a resource file have that couldn't be achieved otherwise?
0
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1458152
Just try it, I remember that I had a simular problem and it solved it.
0
 
LVL 8

Accepted Solution

by:
mrmick earned 1000 total points
ID: 1458153
armg, you are correct in that a resource file can't make any difference except that a string would automatically be appended with a zero byte at the end.

VB5 automatically appends a zero byte to the end of a string; however, VB4 did not.  When preparing a string to be passed to the API using VB4, you need to add a zero byte to the string as follows:

strStringArg = "Any old string" & chr$(0)

If this doesn't fix the situation - email the DLL source code (if you'd like) and I'll translate and return the equivalent VB.  My email address is: mick@owen.wa.com

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month10 days, 6 hours left to enroll

762 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