Solved

MessageBoxIndirect Question

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now