Solved

Using Win16 commdlg.dll API in VB4

Posted on 1998-02-28
4
428 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 250 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

717 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