Solved

Using Win16 commdlg.dll API in VB4

Posted on 1998-02-28
4
411 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
  • 2
4 Comments
 
LVL 8

Expert Comment

by:MikeP090797
Comment Utility
I think the string must be loaded from a resource file
0
 

Author Comment

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

Expert Comment

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

Accepted Solution

by:
mrmick earned 250 total points
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

763 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now