Solved

MessageBoxIndirect Question

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

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…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

772 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