?
Solved

MessageBoxIndirect Question

Posted on 1998-07-24
3
Medium Priority
?
278 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 800 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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 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…
Suggested Courses
Course of the Month13 days, 19 hours left to enroll

801 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