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
Solved

MessageBoxIndirect Question

Posted on 1998-07-24
3
268 Views
Last Modified: 2012-06-21
Hi,

This is Vasudevan from San Jose, CA. I have a
problem in calling MessageBoxIndirect SDK call
from VB. I have no idea as to what to pass
to lpszIcon member in the MSGBOXPARAMS structure.
I tried to pass a icon from a .RES file using
LoadResData function but in vain. The message
box appears with the text and caption but not
with the icon. I have also set MB_USERICON
constant in the dwstyle member. I have no idea as to how to make this call work. I would
appreciate if you would please look into the problem and get back to me at the earliest.

Rgds,

Vasudevan S
0
Comment
Question by:vass
3 Comments
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1466633
Try using LoadResPicture.If that doesn't work either, try loading the picture into a picture box, using the same statement to see if the problem is in the resource file.
0
 
LVL 6

Accepted Solution

by:
alamo earned 200 total points
ID: 1466634
You don't LoadResPicture, you set the lpszIcon member to the resource number (the same argument you woulg use to LoadResPicture).

Don't ask me why the API declaration for MSGBOXPARAMS has
 lpszIcon As String
change it to
 lpszIcon As Long
and then you can set it to the resource number.

Also - you need to set the MB_USERICON bit in dwstyle (&H80) and you need to set hInstance = App.hInstance (so it knows to look in your exe for the resources).

To test it's basically working, set lpszIcon  to 1, and you'll see your application icon in the messagebox if everything else is Ok. (The application icon is always resource 1). Test by making an EXE and running it, not from the development environment, only then will App.hInstance point to the right thing and it will work.

Hope this helps!
0
 

Author Comment

by:vass
ID: 1466635
Excellent help by alamo.

Thanx.

Rgds,

Vasudevan S

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
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…

860 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