Solved

MessageBoxIndirect Question

Posted on 1998-07-24
3
277 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
[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
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
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 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…

691 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