[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Using Win16 commdlg.dll API in VB4

Posted on 1998-02-28
4
Medium Priority
?
433 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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…
Suggested Courses

650 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